Search is not available for this dataset
repo_name string | path string | license string | full_code string | full_size int64 | uncommented_code string | uncommented_size int64 | function_only_code string | function_only_size int64 | is_commented bool | is_signatured bool | n_ast_errors int64 | ast_max_depth int64 | n_whitespaces int64 | n_ast_nodes int64 | n_ast_terminals int64 | n_ast_nonterminals int64 | loc int64 | cycloplexity int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jkpl/tagenerator | src/TaGenerator/GameEngine.hs | mit | unknownAction :: ActionType -> String -> String
unknownAction at s = concat ["Don't know how to ", (show at), " ", s, "."] | 122 | unknownAction :: ActionType -> String -> String
unknownAction at s = concat ["Don't know how to ", (show at), " ", s, "."] | 122 | unknownAction at s = concat ["Don't know how to ", (show at), " ", s, "."] | 74 | false | true | 0 | 8 | 22 | 48 | 26 | 22 | null | null |
urbanslug/ghc | compiler/ghci/ByteCodeItbls.hs | bsd-3-clause | fieldSz :: Storable b => (a -> b) -> a -> Int
fieldSz sel x = sizeOf (sel x) | 76 | fieldSz :: Storable b => (a -> b) -> a -> Int
fieldSz sel x = sizeOf (sel x) | 76 | fieldSz sel x = sizeOf (sel x) | 30 | false | true | 0 | 9 | 18 | 53 | 24 | 29 | null | null |
MgaMPKAy/language-sh | Language/Sh/Arithmetic.hs | bsd-3-clause | -- what is P?
whiteSpace = P.whiteSpace lexer | 45 | whiteSpace = P.whiteSpace lexer | 31 | whiteSpace = P.whiteSpace lexer | 31 | true | false | 0 | 6 | 7 | 12 | 6 | 6 | null | null |
ddssff/lens | src/Control/Lens/Tuple.hs | bsd-3-clause | proxyN10 :: Proxy N10
proxyN10 = Proxy | 38 | proxyN10 :: Proxy N10
proxyN10 = Proxy | 38 | proxyN10 = Proxy | 16 | false | true | 0 | 6 | 6 | 20 | 8 | 12 | null | null |
joelburget/interplanetary-computation | src/Planetary/Core/Syntax/Test.hs | bsd-3-clause | unitTests :: Test ()
unitTests = scope "syntax" $ tests
[ scope "extendAbility 1" $
let uidMap = [(unitId, [TyArgVal unitTy])]
actual :: Ability Cid
actual = extendAbility emptyAbility (Adjustment uidMap)
expected = Ability OpenAbility uidMap
in expect $ expected == actual
, scope "extendAbility 2" $
let uidMap = [(unitId, [TyArgVal unitTy])]
actual :: Ability Cid
actual = extendAbility closedAbility (Adjustment uidMap)
expected = Ability ClosedAbility uidMap
in expect $ expected == actual
, scope "TODO: unify" $ tests []
] | 601 | unitTests :: Test ()
unitTests = scope "syntax" $ tests
[ scope "extendAbility 1" $
let uidMap = [(unitId, [TyArgVal unitTy])]
actual :: Ability Cid
actual = extendAbility emptyAbility (Adjustment uidMap)
expected = Ability OpenAbility uidMap
in expect $ expected == actual
, scope "extendAbility 2" $
let uidMap = [(unitId, [TyArgVal unitTy])]
actual :: Ability Cid
actual = extendAbility closedAbility (Adjustment uidMap)
expected = Ability ClosedAbility uidMap
in expect $ expected == actual
, scope "TODO: unify" $ tests []
] | 601 | unitTests = scope "syntax" $ tests
[ scope "extendAbility 1" $
let uidMap = [(unitId, [TyArgVal unitTy])]
actual :: Ability Cid
actual = extendAbility emptyAbility (Adjustment uidMap)
expected = Ability OpenAbility uidMap
in expect $ expected == actual
, scope "extendAbility 2" $
let uidMap = [(unitId, [TyArgVal unitTy])]
actual :: Ability Cid
actual = extendAbility closedAbility (Adjustment uidMap)
expected = Ability ClosedAbility uidMap
in expect $ expected == actual
, scope "TODO: unify" $ tests []
] | 580 | false | true | 0 | 15 | 153 | 203 | 100 | 103 | null | null |
maciej-bendkowski/boltzmann-brain | Data/Boltzmann/System/Sampler.hs | bsd-3-clause | genRandomArgs sys ub (List t : xs) =
do guard (ub > 0)
(arg, s) <- genRandomStrL sys t ub
(args', ub') <- genRandomArgs sys (ub -s) xs
return (listStr arg : args', s + ub') | 201 | genRandomArgs sys ub (List t : xs) =
do guard (ub > 0)
(arg, s) <- genRandomStrL sys t ub
(args', ub') <- genRandomArgs sys (ub -s) xs
return (listStr arg : args', s + ub') | 201 | genRandomArgs sys ub (List t : xs) =
do guard (ub > 0)
(arg, s) <- genRandomStrL sys t ub
(args', ub') <- genRandomArgs sys (ub -s) xs
return (listStr arg : args', s + ub') | 201 | false | false | 0 | 10 | 64 | 108 | 52 | 56 | null | null |
ijt/kdtree | test/KdTreeTest.hs | bsd-3-clause | prop_kNearestNeighborsMatchesBrute :: [Kd.Point3d] -> Int -> Kd.Point3d -> Bool
prop_kNearestNeighborsMatchesBrute points k p =
L.sort (Kd.kNearestNeighbors tree k p) == L.sort (bruteKnearestNeighbors points k p)
where tree = Kd.fromList points
bruteKnearestNeighbors points k p =
take k . L.sortBy (Kd.compareDistance p) $ points | 360 | prop_kNearestNeighborsMatchesBrute :: [Kd.Point3d] -> Int -> Kd.Point3d -> Bool
prop_kNearestNeighborsMatchesBrute points k p =
L.sort (Kd.kNearestNeighbors tree k p) == L.sort (bruteKnearestNeighbors points k p)
where tree = Kd.fromList points
bruteKnearestNeighbors points k p =
take k . L.sortBy (Kd.compareDistance p) $ points | 360 | prop_kNearestNeighborsMatchesBrute points k p =
L.sort (Kd.kNearestNeighbors tree k p) == L.sort (bruteKnearestNeighbors points k p)
where tree = Kd.fromList points
bruteKnearestNeighbors points k p =
take k . L.sortBy (Kd.compareDistance p) $ points | 280 | false | true | 0 | 12 | 72 | 121 | 59 | 62 | null | null |
comonoidial/ALFIN | Backend/OptimizeAsm.hs | mit | optimCallExps vs (((Left s, nb) :<=: ccc):xs) -- FIXME only want RefVars from vs here
| s `notElem` vs = optimCallExps vs (((Right s, nb) :<=: ccc):xs) | 154 | optimCallExps vs (((Left s, nb) :<=: ccc):xs) -- FIXME only want RefVars from vs here
| s `notElem` vs = optimCallExps vs (((Right s, nb) :<=: ccc):xs) | 154 | optimCallExps vs (((Left s, nb) :<=: ccc):xs) -- FIXME only want RefVars from vs here
| s `notElem` vs = optimCallExps vs (((Right s, nb) :<=: ccc):xs) | 154 | false | false | 0 | 12 | 29 | 77 | 40 | 37 | null | null |
foreverbell/project-euler-solutions | src/58.hs | bsd-3-clause | ptotal = p + (wrap seq1) + (wrap seq2) + (wrap seq3) | 52 | ptotal = p + (wrap seq1) + (wrap seq2) + (wrap seq3) | 52 | ptotal = p + (wrap seq1) + (wrap seq2) + (wrap seq3) | 52 | false | false | 0 | 9 | 11 | 36 | 18 | 18 | null | null |
gcampax/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | stableNameTyConKey = mkPreludeTyConUnique 52 | 65 | stableNameTyConKey = mkPreludeTyConUnique 52 | 65 | stableNameTyConKey = mkPreludeTyConUnique 52 | 65 | false | false | 0 | 5 | 24 | 9 | 4 | 5 | null | null |
mpkh/Idris-dev | src/IRTS/Lang.hs | bsd-3-clause | lsubst n new (LLet v val sc) = LLet v (lsubst n new val) (lsubst n new sc) | 74 | lsubst n new (LLet v val sc) = LLet v (lsubst n new val) (lsubst n new sc) | 74 | lsubst n new (LLet v val sc) = LLet v (lsubst n new val) (lsubst n new sc) | 74 | false | false | 0 | 7 | 17 | 53 | 24 | 29 | null | null |
yamadapc/haskell-olhovivo | bin/WSClient.hs | gpl-2.0 | application :: WS.ClientApp ()
application conn = do
hSetBuffering stdin LineBuffering
putStrLn "Connected!"
_ <- forkIO $ forever $ do
d <- WS.receiveData conn
liftIO $ T.putStrLn d
let loop = do
line <- T.getLine
unless (T.null line) $ WS.sendTextData conn line >> loop
loop | 338 | application :: WS.ClientApp ()
application conn = do
hSetBuffering stdin LineBuffering
putStrLn "Connected!"
_ <- forkIO $ forever $ do
d <- WS.receiveData conn
liftIO $ T.putStrLn d
let loop = do
line <- T.getLine
unless (T.null line) $ WS.sendTextData conn line >> loop
loop | 338 | application conn = do
hSetBuffering stdin LineBuffering
putStrLn "Connected!"
_ <- forkIO $ forever $ do
d <- WS.receiveData conn
liftIO $ T.putStrLn d
let loop = do
line <- T.getLine
unless (T.null line) $ WS.sendTextData conn line >> loop
loop | 307 | false | true | 0 | 17 | 106 | 124 | 54 | 70 | null | null |
quchen/binary-typed | src/Data/Binary/Typed.hs | bsd-2-clause | -- Inlining is crucial for caching to work!
-- | Safely decode data, yielding 'Either' an error 'String' or the value.
-- Equivalent to 'decodeTypedOrFail' stripped of the non-essential data.
-- Based on 'decodeTypedOrFail'.
--
-- @
-- encoded = 'encodeTyped' 'Full' ("hello", 1 :: 'Int', 2.34 :: 'Double')
--
-- -- Right \<value\>:
-- 'decodeTyped' encoded :: 'Either' 'String' ('String', 'Int', 'Double')
--
-- -- Left "Type error: expected (Char, Int, Double), got (String, Int, Double)"
-- 'decodeTyped' encoded :: 'Either' 'String' ('Char', 'Int', 'Double')
-- @
decodeTyped :: (Typeable a, Binary a)
=> BSL.ByteString
-> Either String a
decodeTyped = \x -> case decodeTypedOrFail x of
Left (_,_,err) -> Left err
Right (_,_,value) -> Right value
| 794 | decodeTyped :: (Typeable a, Binary a)
=> BSL.ByteString
-> Either String a
decodeTyped = \x -> case decodeTypedOrFail x of
Left (_,_,err) -> Left err
Right (_,_,value) -> Right value
| 223 | decodeTyped = \x -> case decodeTypedOrFail x of
Left (_,_,err) -> Left err
Right (_,_,value) -> Right value
| 124 | true | true | 0 | 10 | 161 | 105 | 61 | 44 | null | null |
walck/learn-physics | examples/src/sunEarthRK4.hs | bsd-3-clause | gGrav :: Double
gGrav = 6.67e-11 | 32 | gGrav :: Double
gGrav = 6.67e-11 | 32 | gGrav = 6.67e-11 | 16 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
soscpd/bee | root/tests/zguide/examples/Haskell/wuproxy.hs | mit | main :: IO ()
main = runZMQ $ do
-- This is where the weather service sits
frontend <- socket XSub
connect frontend "tcp://192.168.55.210:5556"
-- This is our public endpoint for subscribers
backend <- socket XPub
bind backend "tcp://10.1.1.0:8100"
-- Run the proxy until the user interrupts us
proxy frontend backend Nothing | 359 | main :: IO ()
main = runZMQ $ do
-- This is where the weather service sits
frontend <- socket XSub
connect frontend "tcp://192.168.55.210:5556"
-- This is our public endpoint for subscribers
backend <- socket XPub
bind backend "tcp://10.1.1.0:8100"
-- Run the proxy until the user interrupts us
proxy frontend backend Nothing | 359 | main = runZMQ $ do
-- This is where the weather service sits
frontend <- socket XSub
connect frontend "tcp://192.168.55.210:5556"
-- This is our public endpoint for subscribers
backend <- socket XPub
bind backend "tcp://10.1.1.0:8100"
-- Run the proxy until the user interrupts us
proxy frontend backend Nothing | 345 | false | true | 2 | 9 | 85 | 76 | 32 | 44 | null | null |
mightymoose/liquidhaskell | tests/neg/meas5.hs | bsd-3-clause | prop4 = liquidAssertB ((n1 + n2) == n3)
where n1 = mylen zs
n2 = mylen zs'
n3 = mylen $ myapp zs zs' | 120 | prop4 = liquidAssertB ((n1 + n2) == n3)
where n1 = mylen zs
n2 = mylen zs'
n3 = mylen $ myapp zs zs' | 120 | prop4 = liquidAssertB ((n1 + n2) == n3)
where n1 = mylen zs
n2 = mylen zs'
n3 = mylen $ myapp zs zs' | 120 | false | false | 2 | 9 | 43 | 57 | 28 | 29 | null | null |
Arguggi/documentator | data/Lens.hs | gpl-3.0 | -- | A version of ('Control.Lens.Setter.<.=') that works on 'ALens'.
(<#=) :: MonadState s m => ALens s s a b -> b -> m b
l <#= b = do
l #= b
return b
| 155 | (<#=) :: MonadState s m => ALens s s a b -> b -> m b
l <#= b = do
l #= b
return b
| 86 | l <#= b = do
l #= b
return b
| 33 | true | true | 0 | 10 | 40 | 65 | 30 | 35 | null | null |
DrSLDR/logoff | test/TestsMono.hs | mit | {------------------------------------------------------------------------------}
-- iMonoSum-1 - Simple, axiomatic test
-- [(x- (+) y-)] |- (x- .(+). y-) => [x-] |- x-; [y-] |- y-
iMonoSum_1 :: Test
iMonoSum_1 = ((==)
(iMonoSum
(Sequent
(FIStruct
(N (Sum
(N (Negative "x"))
(N (Negative "y")))))
(SSum
(OStruct (N (Negative "x")))
(OStruct (N (Negative "y"))))))
(Sequent
(FIStruct (N (Negative "x")))
(OStruct (N (Negative "x"))),
Sequent
(FIStruct (N (Negative "y")))
(OStruct (N (Negative "y")))),
True,
"iMonoSum-1"
) | 609 | iMonoSum_1 :: Test
iMonoSum_1 = ((==)
(iMonoSum
(Sequent
(FIStruct
(N (Sum
(N (Negative "x"))
(N (Negative "y")))))
(SSum
(OStruct (N (Negative "x")))
(OStruct (N (Negative "y"))))))
(Sequent
(FIStruct (N (Negative "x")))
(OStruct (N (Negative "x"))),
Sequent
(FIStruct (N (Negative "y")))
(OStruct (N (Negative "y")))),
True,
"iMonoSum-1"
) | 429 | iMonoSum_1 = ((==)
(iMonoSum
(Sequent
(FIStruct
(N (Sum
(N (Negative "x"))
(N (Negative "y")))))
(SSum
(OStruct (N (Negative "x")))
(OStruct (N (Negative "y"))))))
(Sequent
(FIStruct (N (Negative "x")))
(OStruct (N (Negative "x"))),
Sequent
(FIStruct (N (Negative "y")))
(OStruct (N (Negative "y")))),
True,
"iMonoSum-1"
) | 410 | true | true | 0 | 21 | 156 | 227 | 115 | 112 | null | null |
dan3944/emojiscript | src/Transpile.hs | mit | getMappings :: String -> Mappings
getMappings = lines >>> map words >>> map ((unwords . tail) &&& head) >>> M.fromList | 118 | getMappings :: String -> Mappings
getMappings = lines >>> map words >>> map ((unwords . tail) &&& head) >>> M.fromList | 118 | getMappings = lines >>> map words >>> map ((unwords . tail) &&& head) >>> M.fromList | 84 | false | true | 0 | 11 | 19 | 49 | 25 | 24 | null | null |
ganeti-github-testing/ganeti-test-1 | src/Ganeti/Constants.hs | bsd-2-clause | defaultRapiPort :: Int
defaultRapiPort = 5080 | 45 | defaultRapiPort :: Int
defaultRapiPort = 5080 | 45 | defaultRapiPort = 5080 | 22 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/CSSPrimitiveValue.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/CSSPrimitiveValue.getCounterValue Mozilla CSSPrimitiveValue.getCounterValue documentation>
getCounterValue_ :: (MonadDOM m) => CSSPrimitiveValue -> m ()
getCounterValue_ self
= liftDOM (void (self ^. jsf "getCounterValue" ())) | 284 | getCounterValue_ :: (MonadDOM m) => CSSPrimitiveValue -> m ()
getCounterValue_ self
= liftDOM (void (self ^. jsf "getCounterValue" ())) | 137 | getCounterValue_ self
= liftDOM (void (self ^. jsf "getCounterValue" ())) | 75 | true | true | 0 | 11 | 27 | 56 | 28 | 28 | null | null |
mlite/hLLVM | src/Llvm/Hir/Composer.hs | bsd-3-clause | half :: Type ScalarB F
half = TpHalf | 36 | half :: Type ScalarB F
half = TpHalf | 36 | half = TpHalf | 13 | false | true | 0 | 6 | 7 | 22 | 9 | 13 | null | null |
Alexander-Ignatyev/morpheus | hmatrix-morpheus/test/Numeric/Morpheus/StatisticsTest.hs | bsd-3-clause | columnStddevsRM = fromList [25.48202, 40.84116, 79.75797, 25.53429] | 67 | columnStddevsRM = fromList [25.48202, 40.84116, 79.75797, 25.53429] | 67 | columnStddevsRM = fromList [25.48202, 40.84116, 79.75797, 25.53429] | 67 | false | false | 1 | 5 | 6 | 24 | 12 | 12 | null | null |
joshuaclayton/timeline | src/Timeline/Parser/Internal.hs | mit | brackets :: Parser a -> Parser a
brackets = between (symbol "[") (symbol "]") | 77 | brackets :: Parser a -> Parser a
brackets = between (symbol "[") (symbol "]") | 77 | brackets = between (symbol "[") (symbol "]") | 44 | false | true | 0 | 7 | 13 | 38 | 18 | 20 | null | null |
diminishedprime/.org | programmey_stuff/write_yourself_a_scheme/ch_04/hello.hs | mit | showError (BadSpecialForm message form) = message ++ ": " ++ show form | 70 | showError (BadSpecialForm message form) = message ++ ": " ++ show form | 70 | showError (BadSpecialForm message form) = message ++ ": " ++ show form | 70 | false | false | 0 | 7 | 11 | 28 | 13 | 15 | null | null |
rueshyna/gogol | gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'AdvertiserGroup' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'agKind'
--
-- * 'agAccountId'
--
-- * 'agName'
--
-- * 'agId'
advertiserGroup
:: AdvertiserGroup
advertiserGroup =
AdvertiserGroup'
{ _agKind = "dfareporting#advertiserGroup"
, _agAccountId = Nothing
, _agName = Nothing
, _agId = Nothing
} | 443 | advertiserGroup
:: AdvertiserGroup
advertiserGroup =
AdvertiserGroup'
{ _agKind = "dfareporting#advertiserGroup"
, _agAccountId = Nothing
, _agName = Nothing
, _agId = Nothing
} | 205 | advertiserGroup =
AdvertiserGroup'
{ _agKind = "dfareporting#advertiserGroup"
, _agAccountId = Nothing
, _agName = Nothing
, _agId = Nothing
} | 166 | true | true | 0 | 7 | 96 | 58 | 36 | 22 | null | null |
rahulmutt/ghcvm | compiler/Eta/HsSyn/HsExpr.hs | bsd-3-clause | pprPendingSplice :: (OutputableBndr id)
=> SplicePointName -> LHsExpr id -> SDoc
pprPendingSplice n e = angleBrackets (ppr n <> comma <+> ppr e) | 161 | pprPendingSplice :: (OutputableBndr id)
=> SplicePointName -> LHsExpr id -> SDoc
pprPendingSplice n e = angleBrackets (ppr n <> comma <+> ppr e) | 161 | pprPendingSplice n e = angleBrackets (ppr n <> comma <+> ppr e) | 63 | false | true | 0 | 9 | 39 | 56 | 27 | 29 | null | null |
sacundim/tau-sigma | test/TauSigma/Statistics/SlopeTest.hs | bsd-3-clause | withSuccessors :: (a -> a -> r) -> [a] -> [r]
withSuccessors _ [] = [] | 70 | withSuccessors :: (a -> a -> r) -> [a] -> [r]
withSuccessors _ [] = [] | 70 | withSuccessors _ [] = [] | 24 | false | true | 0 | 8 | 15 | 45 | 24 | 21 | null | null |
martinra/hflint | test/HFlint/Test/FMPQ/Rational.hs | gpl-3.0 | zeroOneUnitTests :: TestTree
zeroOneUnitTests = testGroup "Zero & One Unit Tests"
[ testCase "zero" $
fromInteger (M.zero :: Integer) @=? (M.zero :: FMPQ)
, testCase "one" $
fromInteger (M.one :: Integer) @=? (M.one :: FMPQ)
] | 246 | zeroOneUnitTests :: TestTree
zeroOneUnitTests = testGroup "Zero & One Unit Tests"
[ testCase "zero" $
fromInteger (M.zero :: Integer) @=? (M.zero :: FMPQ)
, testCase "one" $
fromInteger (M.one :: Integer) @=? (M.one :: FMPQ)
] | 246 | zeroOneUnitTests = testGroup "Zero & One Unit Tests"
[ testCase "zero" $
fromInteger (M.zero :: Integer) @=? (M.zero :: FMPQ)
, testCase "one" $
fromInteger (M.one :: Integer) @=? (M.one :: FMPQ)
] | 217 | false | true | 0 | 10 | 55 | 83 | 44 | 39 | null | null |
sjakobi/stack | src/Stack/Types/StackT.hs | bsd-3-clause | -- | Write a "sticky" line to the terminal. Any subsequent lines will
-- overwrite this one, and that same line will be repeated below
-- again. In other words, the line sticks at the bottom of the output
-- forever. Running this function again will replace the sticky line
-- with a new sticky line. When you want to get rid of the sticky
-- line, run 'logStickyDone'.
--
logSticky :: Q Exp
logSticky =
logOther "sticky" | 425 | logSticky :: Q Exp
logSticky =
logOther "sticky" | 52 | logSticky =
logOther "sticky" | 33 | true | true | 0 | 5 | 81 | 24 | 15 | 9 | null | null |
forsyde/forsyde-atom | src/ForSyDe/Atom/MoC/DE/React/Lib.hs | bsd-3-clause | toDE4 s1 s2 s3 s4 = (toDE1 s1, toDE1 s2, toDE1 s3, toDE1 s4) | 60 | toDE4 s1 s2 s3 s4 = (toDE1 s1, toDE1 s2, toDE1 s3, toDE1 s4) | 60 | toDE4 s1 s2 s3 s4 = (toDE1 s1, toDE1 s2, toDE1 s3, toDE1 s4) | 60 | false | false | 0 | 6 | 13 | 39 | 19 | 20 | null | null |
armoredsoftware/protocol | demos/PaulPractice/BookSimpleTypedLambda.hs | bsd-3-clause | eval (App x y) | isValue x = App x (eval y)
| otherwise =eval (App (eval x) (eval y)) | 100 | eval (App x y) | isValue x = App x (eval y)
| otherwise =eval (App (eval x) (eval y)) | 100 | eval (App x y) | isValue x = App x (eval y)
| otherwise =eval (App (eval x) (eval y)) | 100 | false | false | 0 | 10 | 34 | 69 | 31 | 38 | null | null |
choener/GrammarProducts | old/MultiAlign.hs | gpl-3.0 | i :: Int
i = 1 | 14 | i :: Int
i = 1 | 14 | i = 1 | 5 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
dcreager/cabal | Distribution/Simple/Program.hs | bsd-3-clause | -- | Get any extra args that have been previously specified for a program.
--
userSpecifiedArgs :: Program -> ProgramConfiguration -> [ProgArg]
userSpecifiedArgs prog =
maybe [] (\(_,_,as)->as) . Map.lookup (programName prog) . unconfiguredProgs | 247 | userSpecifiedArgs :: Program -> ProgramConfiguration -> [ProgArg]
userSpecifiedArgs prog =
maybe [] (\(_,_,as)->as) . Map.lookup (programName prog) . unconfiguredProgs | 169 | userSpecifiedArgs prog =
maybe [] (\(_,_,as)->as) . Map.lookup (programName prog) . unconfiguredProgs | 103 | true | true | 0 | 9 | 35 | 75 | 39 | 36 | null | null |
coolhacks/scripts-hacks | examples/shellcheck-master/ShellCheck/Analytics.hs | mit | checkGlobbedRegex _ _ = return () | 33 | checkGlobbedRegex _ _ = return () | 33 | checkGlobbedRegex _ _ = return () | 33 | false | false | 0 | 6 | 5 | 16 | 7 | 9 | null | null |
reuleaux/pire | src/Pire/Pretty/PP.hs | bsd-3-clause | dispEps :: Eps -> M Doc
dispEps ErasedP = return $ text "ErasedP" | 66 | dispEps :: Eps -> M Doc
dispEps ErasedP = return $ text "ErasedP" | 65 | dispEps ErasedP = return $ text "ErasedP" | 41 | false | true | 0 | 7 | 13 | 32 | 14 | 18 | null | null |
Hi-Angel/yi | yi-core/src/Yi/Buffer/HighLevel.hs | gpl-2.0 | downScreensB :: Int -> BufferM ()
downScreensB = scrollScreensB | 63 | downScreensB :: Int -> BufferM ()
downScreensB = scrollScreensB | 63 | downScreensB = scrollScreensB | 29 | false | true | 0 | 7 | 8 | 20 | 10 | 10 | null | null |
elieux/ghc | compiler/hsSyn/HsDecls.hs | bsd-3-clause | pp_condecls cs -- In H98 syntax
= equals <+> sep (punctuate (ptext (sLit " |")) (map ppr cs)) | 114 | pp_condecls cs -- In H98 syntax
= equals <+> sep (punctuate (ptext (sLit " |")) (map ppr cs)) | 114 | pp_condecls cs -- In H98 syntax
= equals <+> sep (punctuate (ptext (sLit " |")) (map ppr cs)) | 114 | false | false | 0 | 12 | 38 | 45 | 22 | 23 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | tagOf_PrimOp Int64SrlOp = _ILIT(1085) | 37 | tagOf_PrimOp Int64SrlOp = _ILIT(1085) | 37 | tagOf_PrimOp Int64SrlOp = _ILIT(1085) | 37 | false | false | 0 | 6 | 3 | 15 | 7 | 8 | null | null |
lambdageek/insomnia | src/Insomnia/ToF/Module.hs | bsd-3-clause | typeAliasDefn :: ToF m
=> ModuleKind
-> Field
-> TypeAlias
-> (ModSummary -> m ans)
-> m ans
typeAliasDefn _mk f (ManifestTypeAlias bnd) kont =
U.lunbind bnd $ \ (tvks, rhs) -> do
(tlam, tK) <- withTyVars tvks $ \tvks' -> do
(rhs', kcod) <- type' rhs
return (F.tLams tvks' rhs', F.kArrs (map snd tvks') kcod)
let tsig = F.TypeSem tlam tK
tc = U.s2n f :: TyConName
xc = U.s2n f :: F.Var
mr <- F.typeSemTerm tlam tK
let
mhole = Endo $ F.Let . U.bind (xc, U.embed mr)
thisOne = ((mempty, [(F.FUser f, tsig)]),
[(F.FUser f, F.V xc)],
mhole)
local (tyConEnv %~ M.insert tc tsig) $
kont thisOne | 775 | typeAliasDefn :: ToF m
=> ModuleKind
-> Field
-> TypeAlias
-> (ModSummary -> m ans)
-> m ans
typeAliasDefn _mk f (ManifestTypeAlias bnd) kont =
U.lunbind bnd $ \ (tvks, rhs) -> do
(tlam, tK) <- withTyVars tvks $ \tvks' -> do
(rhs', kcod) <- type' rhs
return (F.tLams tvks' rhs', F.kArrs (map snd tvks') kcod)
let tsig = F.TypeSem tlam tK
tc = U.s2n f :: TyConName
xc = U.s2n f :: F.Var
mr <- F.typeSemTerm tlam tK
let
mhole = Endo $ F.Let . U.bind (xc, U.embed mr)
thisOne = ((mempty, [(F.FUser f, tsig)]),
[(F.FUser f, F.V xc)],
mhole)
local (tyConEnv %~ M.insert tc tsig) $
kont thisOne | 775 | typeAliasDefn _mk f (ManifestTypeAlias bnd) kont =
U.lunbind bnd $ \ (tvks, rhs) -> do
(tlam, tK) <- withTyVars tvks $ \tvks' -> do
(rhs', kcod) <- type' rhs
return (F.tLams tvks' rhs', F.kArrs (map snd tvks') kcod)
let tsig = F.TypeSem tlam tK
tc = U.s2n f :: TyConName
xc = U.s2n f :: F.Var
mr <- F.typeSemTerm tlam tK
let
mhole = Endo $ F.Let . U.bind (xc, U.embed mr)
thisOne = ((mempty, [(F.FUser f, tsig)]),
[(F.FUser f, F.V xc)],
mhole)
local (tyConEnv %~ M.insert tc tsig) $
kont thisOne | 597 | false | true | 0 | 18 | 296 | 330 | 166 | 164 | null | null |
melted/llvm-pretty | src/Text/LLVM/AST.hs | bsd-3-clause | ppFCmpOp Fueq = text "ueq" | 28 | ppFCmpOp Fueq = text "ueq" | 28 | ppFCmpOp Fueq = text "ueq" | 28 | false | false | 1 | 5 | 6 | 15 | 5 | 10 | null | null |
ozgurakgun/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | pureTerm _ = True | 17 | pureTerm _ = True | 17 | pureTerm _ = True | 17 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
gcampax/ghc | utils/genprimopcode/Main.hs | bsd-3-clause | ppType (TyVar "c") = "gammaTy" | 51 | ppType (TyVar "c") = "gammaTy" | 51 | ppType (TyVar "c") = "gammaTy" | 51 | false | false | 0 | 6 | 25 | 16 | 7 | 9 | null | null |
mattrrichard/darwin | src/Main.hs | bsd-3-clause | polygonConfig sourceImg s startingGen stepCount =
return Config { strategy = s
, readPop = return . PolygonImage sourceImg
, runName = "polygons"
, startingGenId = startingGen
, render = return . renderPolygonImage
, stepCount = stepCount
, tweakConfig = sourceImg
} | 380 | polygonConfig sourceImg s startingGen stepCount =
return Config { strategy = s
, readPop = return . PolygonImage sourceImg
, runName = "polygons"
, startingGenId = startingGen
, render = return . renderPolygonImage
, stepCount = stepCount
, tweakConfig = sourceImg
} | 380 | polygonConfig sourceImg s startingGen stepCount =
return Config { strategy = s
, readPop = return . PolygonImage sourceImg
, runName = "polygons"
, startingGenId = startingGen
, render = return . renderPolygonImage
, stepCount = stepCount
, tweakConfig = sourceImg
} | 380 | false | false | 0 | 8 | 155 | 73 | 42 | 31 | null | null |
yav/alsa-haskell | Sound/Alsa/Sequencer/Client.hs | mit | query_next_client :: SndSeq -> ClientInfo
-> IO Bool -- ^ Was there a next client?
query_next_client (SndSeq h) info =
check_error' (const True)
(\x -> guard (x == -2) >> return False)
=<< with_client_info info (snd_seq_query_next_client h) | 285 | query_next_client :: SndSeq -> ClientInfo
-> IO Bool
query_next_client (SndSeq h) info =
check_error' (const True)
(\x -> guard (x == -2) >> return False)
=<< with_client_info info (snd_seq_query_next_client h) | 254 | query_next_client (SndSeq h) info =
check_error' (const True)
(\x -> guard (x == -2) >> return False)
=<< with_client_info info (snd_seq_query_next_client h) | 180 | true | true | 2 | 11 | 81 | 91 | 44 | 47 | null | null |
FranklinChen/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | eqDecl = PDatadecl eqTy primfc (piBindp impl [(n "A", PType bi), (n "B", PType bi)]
(piBind [(n "x", PRef bi [] (n "A")), (n "y", PRef bi [] (n "B"))]
(PType bi)))
[(reflDoc, reflParamDoc,
eqCon, primfc, PPi impl (n "A") primfc (PType bi) (
PPi impl (n "x") primfc (PRef bi [] (n "A"))
(PApp bi (PRef bi [] eqTy) [pimp (n "A") Placeholder False,
pimp (n "B") Placeholder False,
pexp (PRef bi [] (n "x")),
pexp (PRef bi [] (n "x"))])), bi, [])]
where n a = sUN a
reflDoc = annotCode (const (Left $ Msg "")) . parseDocstring . T.pack $
"A proof that `x` in fact equals `x`. To construct this, you must have already " ++
"shown that both sides are in fact equal."
reflParamDoc = [(n "A", annotCode (const (Left $ Msg "")) . parseDocstring . T.pack $ "the type at which the equality is proven"),
(n "x", annotCode (const (Left $ Msg "")) . parseDocstring . T.pack $ "the element shown to be equal to itself.")] | 1,403 | eqDecl = PDatadecl eqTy primfc (piBindp impl [(n "A", PType bi), (n "B", PType bi)]
(piBind [(n "x", PRef bi [] (n "A")), (n "y", PRef bi [] (n "B"))]
(PType bi)))
[(reflDoc, reflParamDoc,
eqCon, primfc, PPi impl (n "A") primfc (PType bi) (
PPi impl (n "x") primfc (PRef bi [] (n "A"))
(PApp bi (PRef bi [] eqTy) [pimp (n "A") Placeholder False,
pimp (n "B") Placeholder False,
pexp (PRef bi [] (n "x")),
pexp (PRef bi [] (n "x"))])), bi, [])]
where n a = sUN a
reflDoc = annotCode (const (Left $ Msg "")) . parseDocstring . T.pack $
"A proof that `x` in fact equals `x`. To construct this, you must have already " ++
"shown that both sides are in fact equal."
reflParamDoc = [(n "A", annotCode (const (Left $ Msg "")) . parseDocstring . T.pack $ "the type at which the equality is proven"),
(n "x", annotCode (const (Left $ Msg "")) . parseDocstring . T.pack $ "the element shown to be equal to itself.")] | 1,403 | eqDecl = PDatadecl eqTy primfc (piBindp impl [(n "A", PType bi), (n "B", PType bi)]
(piBind [(n "x", PRef bi [] (n "A")), (n "y", PRef bi [] (n "B"))]
(PType bi)))
[(reflDoc, reflParamDoc,
eqCon, primfc, PPi impl (n "A") primfc (PType bi) (
PPi impl (n "x") primfc (PRef bi [] (n "A"))
(PApp bi (PRef bi [] eqTy) [pimp (n "A") Placeholder False,
pimp (n "B") Placeholder False,
pexp (PRef bi [] (n "x")),
pexp (PRef bi [] (n "x"))])), bi, [])]
where n a = sUN a
reflDoc = annotCode (const (Left $ Msg "")) . parseDocstring . T.pack $
"A proof that `x` in fact equals `x`. To construct this, you must have already " ++
"shown that both sides are in fact equal."
reflParamDoc = [(n "A", annotCode (const (Left $ Msg "")) . parseDocstring . T.pack $ "the type at which the equality is proven"),
(n "x", annotCode (const (Left $ Msg "")) . parseDocstring . T.pack $ "the element shown to be equal to itself.")] | 1,403 | false | false | 2 | 18 | 668 | 464 | 237 | 227 | null | null |
snowleopard/alga | src/Algebra/Graph/Label.hs | mit | -- | Get a finite value or @Nothing@ if the value is infinite.
getFinite :: NonNegative a -> Maybe a
getFinite (NonNegative x) = fromExtended x | 143 | getFinite :: NonNegative a -> Maybe a
getFinite (NonNegative x) = fromExtended x | 80 | getFinite (NonNegative x) = fromExtended x | 42 | true | true | 0 | 6 | 25 | 38 | 17 | 21 | null | null |
andrewthad/vinyl-vectors | src/Data/Vector/Vinyl/Default/NonEmpty/Monomorphic.hs | bsd-3-clause | -- | /O(n)/ Apply a function to every element of a vector and its index
imap :: (G.Vector Vector (Rec Identity rs), G.Vector Vector (Rec Identity ss))
=> (Int -> Rec Identity rs -> Rec Identity ss)
-> Vector (Rec Identity rs) -> Vector (Rec Identity ss)
imap = G.imap | 277 | imap :: (G.Vector Vector (Rec Identity rs), G.Vector Vector (Rec Identity ss))
=> (Int -> Rec Identity rs -> Rec Identity ss)
-> Vector (Rec Identity rs) -> Vector (Rec Identity ss)
imap = G.imap | 205 | imap = G.imap | 13 | true | true | 0 | 11 | 59 | 110 | 53 | 57 | null | null |
MedeaMelana/HoleyMonoid | Format.hs | bsd-3-clause | align :: FormatLike x a b => Dir -> Int -> x -> Format a b
align dir wid = mapFormat (align' dir wid) . toFormat | 112 | align :: FormatLike x a b => Dir -> Int -> x -> Format a b
align dir wid = mapFormat (align' dir wid) . toFormat | 112 | align dir wid = mapFormat (align' dir wid) . toFormat | 53 | false | true | 0 | 10 | 25 | 64 | 29 | 35 | null | null |
geraldus/yesod-form-richtext | src/Yesod/Form/Summernote.hs | mit | addStylesheet' :: (MonadWidget m, HandlerSite m ~ site)
=> (site -> Either (Route site) Text)
-> m ()
addStylesheet' f = do
y <- getYesod
addStylesheetEither $ f y | 201 | addStylesheet' :: (MonadWidget m, HandlerSite m ~ site)
=> (site -> Either (Route site) Text)
-> m ()
addStylesheet' f = do
y <- getYesod
addStylesheetEither $ f y | 201 | addStylesheet' f = do
y <- getYesod
addStylesheetEither $ f y | 69 | false | true | 0 | 11 | 66 | 78 | 37 | 41 | null | null |
bmsherman/haskell-vect | Data/Vect.hs | bsd-3-clause | foldr :: (a -> b -> b) -> b -> Vect n a -> b
foldr f z Nil = z | 62 | foldr :: (a -> b -> b) -> b -> Vect n a -> b
foldr f z Nil = z | 62 | foldr f z Nil = z | 17 | false | true | 0 | 9 | 20 | 52 | 24 | 28 | null | null |
Elastifile/git-sling | server/src/Sling.hs | gpl-2.0 | rejectProposal :: Options -> Git.Remote -> Proposal -> Text -> Maybe PrepushLogs -> Maybe (Text, ExitCode) -> EShell ()
rejectProposal options remote proposal reason prepushLogs err = do
let origBranchName = Proposal.toBranchName proposal
rejectedProposal = proposal { Proposal.proposalStatus = Proposal.ProposalRejected }
rejectBranchName = Proposal.toBranchName rejectedProposal
suffix = case err of
Just (msg, errCode) -> " because: '" <> reason <> "' (" <> msg <> "), exit code = " <> T.pack (show errCode)
Nothing -> ""
msgBody = "REJECT " <> Git.fromBranchName origBranchName <> suffix
eprint msgBody
sendProposalEmail options proposal ("Rejecting (" <> reason <> ")") (toHtml msgBody) prepushLogs ProposalFailureEmail
Git.fetch & ignoreError
Git.deleteBranch (Git.RemoteBranch remote rejectBranchName) & ignoreError -- in case it exists
Git.deleteBranch (Git.LocalBranch rejectBranchName) & ignoreError -- in case it exists
Git.reset Git.ResetHard Git.RefHead
_ <- Git.createLocalBranch rejectBranchName Git.RefHead
_ <- Git.pushRemoteTracking remote rejectBranchName Git.PushForceWithoutLease
-- We have to be on another branch before deleting stuff, so arbitrarily picking rejected branch
Git.checkout (Git.RefBranch $ Git.LocalBranch rejectBranchName)
Git.deleteBranch (Git.LocalBranch origBranchName) & ignoreError
Git.deleteBranch (Git.RemoteBranch remote origBranchName)
-- Checks that the proposal is valid (e.g. the onto branch still actually exists on the remote) | 1,588 | rejectProposal :: Options -> Git.Remote -> Proposal -> Text -> Maybe PrepushLogs -> Maybe (Text, ExitCode) -> EShell ()
rejectProposal options remote proposal reason prepushLogs err = do
let origBranchName = Proposal.toBranchName proposal
rejectedProposal = proposal { Proposal.proposalStatus = Proposal.ProposalRejected }
rejectBranchName = Proposal.toBranchName rejectedProposal
suffix = case err of
Just (msg, errCode) -> " because: '" <> reason <> "' (" <> msg <> "), exit code = " <> T.pack (show errCode)
Nothing -> ""
msgBody = "REJECT " <> Git.fromBranchName origBranchName <> suffix
eprint msgBody
sendProposalEmail options proposal ("Rejecting (" <> reason <> ")") (toHtml msgBody) prepushLogs ProposalFailureEmail
Git.fetch & ignoreError
Git.deleteBranch (Git.RemoteBranch remote rejectBranchName) & ignoreError -- in case it exists
Git.deleteBranch (Git.LocalBranch rejectBranchName) & ignoreError -- in case it exists
Git.reset Git.ResetHard Git.RefHead
_ <- Git.createLocalBranch rejectBranchName Git.RefHead
_ <- Git.pushRemoteTracking remote rejectBranchName Git.PushForceWithoutLease
-- We have to be on another branch before deleting stuff, so arbitrarily picking rejected branch
Git.checkout (Git.RefBranch $ Git.LocalBranch rejectBranchName)
Git.deleteBranch (Git.LocalBranch origBranchName) & ignoreError
Git.deleteBranch (Git.RemoteBranch remote origBranchName)
-- Checks that the proposal is valid (e.g. the onto branch still actually exists on the remote) | 1,588 | rejectProposal options remote proposal reason prepushLogs err = do
let origBranchName = Proposal.toBranchName proposal
rejectedProposal = proposal { Proposal.proposalStatus = Proposal.ProposalRejected }
rejectBranchName = Proposal.toBranchName rejectedProposal
suffix = case err of
Just (msg, errCode) -> " because: '" <> reason <> "' (" <> msg <> "), exit code = " <> T.pack (show errCode)
Nothing -> ""
msgBody = "REJECT " <> Git.fromBranchName origBranchName <> suffix
eprint msgBody
sendProposalEmail options proposal ("Rejecting (" <> reason <> ")") (toHtml msgBody) prepushLogs ProposalFailureEmail
Git.fetch & ignoreError
Git.deleteBranch (Git.RemoteBranch remote rejectBranchName) & ignoreError -- in case it exists
Git.deleteBranch (Git.LocalBranch rejectBranchName) & ignoreError -- in case it exists
Git.reset Git.ResetHard Git.RefHead
_ <- Git.createLocalBranch rejectBranchName Git.RefHead
_ <- Git.pushRemoteTracking remote rejectBranchName Git.PushForceWithoutLease
-- We have to be on another branch before deleting stuff, so arbitrarily picking rejected branch
Git.checkout (Git.RefBranch $ Git.LocalBranch rejectBranchName)
Git.deleteBranch (Git.LocalBranch origBranchName) & ignoreError
Git.deleteBranch (Git.RemoteBranch remote origBranchName)
-- Checks that the proposal is valid (e.g. the onto branch still actually exists on the remote) | 1,468 | false | true | 0 | 17 | 294 | 389 | 187 | 202 | null | null |
jekor/templatepg | Database/TemplatePG/SQL.hs | mit | -- |Like 'pgStringToType', but deal with possible @NULL@s. If the boolean
-- argument is 'False', that means that we know that the value is not nullable
-- and we can use 'fromJust' to keep the code simple. If it's 'True', then we
-- don't know if the value is nullable and must return a 'Maybe' value in case
-- it is.
pgStringToType' :: PGType
-> Bool -- ^ nullability indicator
-> Q Exp
pgStringToType' t False = [| ($(pgStringToType t)) . toString . fromJust |] | 498 | pgStringToType' :: PGType
-> Bool -- ^ nullability indicator
-> Q Exp
pgStringToType' t False = [| ($(pgStringToType t)) . toString . fromJust |] | 178 | pgStringToType' t False = [| ($(pgStringToType t)) . toString . fromJust |] | 75 | true | true | 0 | 7 | 117 | 36 | 22 | 14 | null | null |
bkoropoff/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | getShowArgs (e@(PExp _ _ _ tm) : xs) = e : getShowArgs xs | 57 | getShowArgs (e@(PExp _ _ _ tm) : xs) = e : getShowArgs xs | 57 | getShowArgs (e@(PExp _ _ _ tm) : xs) = e : getShowArgs xs | 57 | false | false | 0 | 10 | 12 | 38 | 19 | 19 | null | null |
nevrenato/Hets_Fork | ExtModal/Keywords.hs | gpl-2.0 | nuS :: String
nuS = "nu" | 24 | nuS :: String
nuS = "nu" | 24 | nuS = "nu" | 10 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
markus1189/xmonad-contrib-710 | XMonad/Hooks/DebugEvents.hs | bsd-3-clause | mwmFuncs :: [String]
mwmFuncs = ["all except"
,"resize"
,"move"
,"minimize"
,"maximize"
,"close"
] | 171 | mwmFuncs :: [String]
mwmFuncs = ["all except"
,"resize"
,"move"
,"minimize"
,"maximize"
,"close"
] | 171 | mwmFuncs = ["all except"
,"resize"
,"move"
,"minimize"
,"maximize"
,"close"
] | 150 | false | true | 0 | 5 | 85 | 32 | 20 | 12 | null | null |
ssaavedra/liquidhaskell | benchmarks/esop2013-submission/Base.hs | bsd-3-clause | -- | /O(log n)/. Update the value at the minimal key.
--
-- > updateMinWithKey (\ k a -> Just ((show k) ++ ":" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3,"3:b"), (5,"a")]
-- > updateMinWithKey (\ _ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
{-@ updateMinWithKey :: (k -> a -> Maybe a) -> OMap k a -> OMap k a @-}
updateMinWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a
updateMinWithKey _ Tip = Tip | 470 | updateMinWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a
updateMinWithKey _ Tip = Tip | 106 | updateMinWithKey _ Tip = Tip | 44 | true | true | 0 | 9 | 123 | 53 | 28 | 25 | null | null |
apyrgio/snf-ganeti | src/Ganeti/HTools/CLI.hs | bsd-2-clause | oIAllocSrc :: OptType
oIAllocSrc =
(Option "I" ["ialloc-src"]
(ReqArg (\ f opts -> Ok opts { optIAllocSrc = Just f }) "FILE")
"Specify an iallocator spec as the cluster data source",
OptComplFile) | 207 | oIAllocSrc :: OptType
oIAllocSrc =
(Option "I" ["ialloc-src"]
(ReqArg (\ f opts -> Ok opts { optIAllocSrc = Just f }) "FILE")
"Specify an iallocator spec as the cluster data source",
OptComplFile) | 207 | oIAllocSrc =
(Option "I" ["ialloc-src"]
(ReqArg (\ f opts -> Ok opts { optIAllocSrc = Just f }) "FILE")
"Specify an iallocator spec as the cluster data source",
OptComplFile) | 185 | false | true | 0 | 15 | 42 | 68 | 34 | 34 | null | null |
JoseD92/EasyGL | src/EasyGLUT.hs | bsd-3-clause | filterUp :: t -> t -> KeyState -> t
filterUp x _ Up = x | 62 | filterUp :: t -> t -> KeyState -> t
filterUp x _ Up = x | 61 | filterUp x _ Up = x | 25 | false | true | 0 | 9 | 21 | 36 | 16 | 20 | null | null |
shouya/thinking-dumps | sicp/chap2/2.56.hs | mit | mkP (I 0) _ = I 0 | 17 | mkP (I 0) _ = I 0 | 17 | mkP (I 0) _ = I 0 | 17 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
dan-t/cabal-bounds | lib/CabalBounds/Types.hs | bsd-3-clause | toList :: LibraryMap -> Libraries
toList libs =
map (\(name, version) -> (name, version ^. CL.versionBranchL)) $ HM.toList libs | 130 | toList :: LibraryMap -> Libraries
toList libs =
map (\(name, version) -> (name, version ^. CL.versionBranchL)) $ HM.toList libs | 130 | toList libs =
map (\(name, version) -> (name, version ^. CL.versionBranchL)) $ HM.toList libs | 96 | false | true | 0 | 11 | 21 | 56 | 30 | 26 | null | null |
ivan-m/jbi | lib/System/JBI/Commands.hs | mit | exec :: String -> Args -> Env -> WrappedTool Valid -> IO ExitCode
exec cmd args = runPrepared (\env cp -> commandExec env cp cmd args) | 134 | exec :: String -> Args -> Env -> WrappedTool Valid -> IO ExitCode
exec cmd args = runPrepared (\env cp -> commandExec env cp cmd args) | 134 | exec cmd args = runPrepared (\env cp -> commandExec env cp cmd args) | 68 | false | true | 0 | 10 | 25 | 64 | 30 | 34 | null | null |
abailly/acquire | chinese/src/Chinese/Game.hs | apache-2.0 | wrongAnswer :: Game -> Game
wrongAnswer g@Game{..} = g { playerState = failureAnswer playerState
, wordsList = tail wordsList
} | 182 | wrongAnswer :: Game -> Game
wrongAnswer g@Game{..} = g { playerState = failureAnswer playerState
, wordsList = tail wordsList
} | 182 | wrongAnswer g@Game{..} = g { playerState = failureAnswer playerState
, wordsList = tail wordsList
} | 153 | false | true | 0 | 8 | 74 | 47 | 25 | 22 | null | null |
fmapfmapfmap/amazonka | amazonka-glacier/gen/Network/AWS/Glacier/Types/Product.hs | mpl-2.0 | -- | The status code can be InProgress, Succeeded, or Failed, and indicates
-- the status of the job.
gjdStatusCode :: Lens' GlacierJobDescription (Maybe StatusCode)
gjdStatusCode = lens _gjdStatusCode (\ s a -> s{_gjdStatusCode = a}) | 234 | gjdStatusCode :: Lens' GlacierJobDescription (Maybe StatusCode)
gjdStatusCode = lens _gjdStatusCode (\ s a -> s{_gjdStatusCode = a}) | 132 | gjdStatusCode = lens _gjdStatusCode (\ s a -> s{_gjdStatusCode = a}) | 68 | true | true | 0 | 9 | 35 | 47 | 26 | 21 | null | null |
tchagnon/cs636-raytracer | a6/Math.hs | apache-2.0 | (Vec4f e0 e1 e2 e3) !. 1 = e1 | 29 | (Vec4f e0 e1 e2 e3) !. 1 = e1 | 29 | (Vec4f e0 e1 e2 e3) !. 1 = e1 | 29 | false | false | 0 | 7 | 8 | 24 | 11 | 13 | null | null |
bos/critbit | Data/CritBit/Set.hs | bsd-2-clause | -- | /O(k)/. The intersection of two sets. Elements of the
-- result come from the first set.
intersection :: (CritBitKey a) => Set a -> Set a -> Set a
intersection = wrapSS Set T.intersection | 192 | intersection :: (CritBitKey a) => Set a -> Set a -> Set a
intersection = wrapSS Set T.intersection | 98 | intersection = wrapSS Set T.intersection | 40 | true | true | 0 | 8 | 35 | 46 | 23 | 23 | null | null |
phadej/boolean-normal-forms | tests/FreeBooleanTests.hs | mit | tests :: TestTree
tests = testGroup "Free boolean"
[ monotoneLaws eq
, nonMonotoneLaws eq
, negableLaws eq
, simplifyLaws (undefined :: FreeBoolean (Either Bool Bool))
, booleanModelLaws (undefined :: FreeBoolean (Either Bool Bool))
] | 246 | tests :: TestTree
tests = testGroup "Free boolean"
[ monotoneLaws eq
, nonMonotoneLaws eq
, negableLaws eq
, simplifyLaws (undefined :: FreeBoolean (Either Bool Bool))
, booleanModelLaws (undefined :: FreeBoolean (Either Bool Bool))
] | 246 | tests = testGroup "Free boolean"
[ monotoneLaws eq
, nonMonotoneLaws eq
, negableLaws eq
, simplifyLaws (undefined :: FreeBoolean (Either Bool Bool))
, booleanModelLaws (undefined :: FreeBoolean (Either Bool Bool))
] | 228 | false | true | 0 | 10 | 45 | 81 | 41 | 40 | null | null |
yesodweb/persistent | persistent-mysql/Database/Persist/MySQL.hs | mit | mockMigrate :: MySQL.ConnectInfo
-> [EntityDef]
-> (Text -> IO Statement)
-> EntityDef
-> IO (Either [Text] [(Bool, Text)])
mockMigrate _connectInfo allDefs _getter val = do
let name = getEntityDBName val
let (newcols, udefs, fdefs) = mysqlMkColumns allDefs val
let udspair = map udToPair udefs
case () of
-- Nothing found, create everything
() -> do
let uniques = flip concatMap udspair $ \(uname, ucols) ->
[ AlterTable name $
AddUniqueConstraint uname $
map (findTypeAndMaxLen name) ucols ]
let foreigns = do
Column { cName=cname, cReference= Just ColumnReference{crTableName = refTable, crConstraintName = refConstr, crFieldCascade = cfc }} <- newcols
return $ AlterColumn name (addReference allDefs refConstr refTable cname cfc)
let foreignsAlt =
map
(\fdef ->
let (childfields, parentfields) = unzip (map (\((_,b),(_,d)) -> (b,d)) (foreignFields fdef))
in
AlterColumn
name
(AddReference
(foreignRefTableDBName fdef)
(foreignConstraintNameDBName fdef)
childfields
parentfields
(foreignFieldCascade fdef)
)
)
fdefs
return $ Right $ map showAlterDb $ (addTable newcols val): uniques ++ foreigns ++ foreignsAlt
where
findTypeAndMaxLen tblName col = let (col', ty) = findTypeOfColumn allDefs tblName col
(_, ml) = findMaxLenOfColumn allDefs tblName col
in (col', ty, ml)
-- | Mock a migration even when the database is not present.
-- This function will mock the migration for a database even when
-- the actual database isn't already present in the system. | 2,184 | mockMigrate :: MySQL.ConnectInfo
-> [EntityDef]
-> (Text -> IO Statement)
-> EntityDef
-> IO (Either [Text] [(Bool, Text)])
mockMigrate _connectInfo allDefs _getter val = do
let name = getEntityDBName val
let (newcols, udefs, fdefs) = mysqlMkColumns allDefs val
let udspair = map udToPair udefs
case () of
-- Nothing found, create everything
() -> do
let uniques = flip concatMap udspair $ \(uname, ucols) ->
[ AlterTable name $
AddUniqueConstraint uname $
map (findTypeAndMaxLen name) ucols ]
let foreigns = do
Column { cName=cname, cReference= Just ColumnReference{crTableName = refTable, crConstraintName = refConstr, crFieldCascade = cfc }} <- newcols
return $ AlterColumn name (addReference allDefs refConstr refTable cname cfc)
let foreignsAlt =
map
(\fdef ->
let (childfields, parentfields) = unzip (map (\((_,b),(_,d)) -> (b,d)) (foreignFields fdef))
in
AlterColumn
name
(AddReference
(foreignRefTableDBName fdef)
(foreignConstraintNameDBName fdef)
childfields
parentfields
(foreignFieldCascade fdef)
)
)
fdefs
return $ Right $ map showAlterDb $ (addTable newcols val): uniques ++ foreigns ++ foreignsAlt
where
findTypeAndMaxLen tblName col = let (col', ty) = findTypeOfColumn allDefs tblName col
(_, ml) = findMaxLenOfColumn allDefs tblName col
in (col', ty, ml)
-- | Mock a migration even when the database is not present.
-- This function will mock the migration for a database even when
-- the actual database isn't already present in the system. | 2,184 | mockMigrate _connectInfo allDefs _getter val = do
let name = getEntityDBName val
let (newcols, udefs, fdefs) = mysqlMkColumns allDefs val
let udspair = map udToPair udefs
case () of
-- Nothing found, create everything
() -> do
let uniques = flip concatMap udspair $ \(uname, ucols) ->
[ AlterTable name $
AddUniqueConstraint uname $
map (findTypeAndMaxLen name) ucols ]
let foreigns = do
Column { cName=cname, cReference= Just ColumnReference{crTableName = refTable, crConstraintName = refConstr, crFieldCascade = cfc }} <- newcols
return $ AlterColumn name (addReference allDefs refConstr refTable cname cfc)
let foreignsAlt =
map
(\fdef ->
let (childfields, parentfields) = unzip (map (\((_,b),(_,d)) -> (b,d)) (foreignFields fdef))
in
AlterColumn
name
(AddReference
(foreignRefTableDBName fdef)
(foreignConstraintNameDBName fdef)
childfields
parentfields
(foreignFieldCascade fdef)
)
)
fdefs
return $ Right $ map showAlterDb $ (addTable newcols val): uniques ++ foreigns ++ foreignsAlt
where
findTypeAndMaxLen tblName col = let (col', ty) = findTypeOfColumn allDefs tblName col
(_, ml) = findMaxLenOfColumn allDefs tblName col
in (col', ty, ml)
-- | Mock a migration even when the database is not present.
-- This function will mock the migration for a database even when
-- the actual database isn't already present in the system. | 2,024 | false | true | 0 | 28 | 938 | 512 | 263 | 249 | null | null |
rgaiacs/pandoc | src/Text/Pandoc/Writers/Docx.hs | gpl-2.0 | renumIdMap :: Int -> [Element] -> M.Map String String
renumIdMap _ [] = M.empty | 79 | renumIdMap :: Int -> [Element] -> M.Map String String
renumIdMap _ [] = M.empty | 79 | renumIdMap _ [] = M.empty | 25 | false | true | 0 | 8 | 13 | 38 | 19 | 19 | null | null |
fros1y/patent-api | src/Data/Patent/Providers/EPO/Parsers/XMLDocDB.hs | agpl-3.0 | parseXMLtoCitation :: XML.Cursor -> Patent.Citation
parseXMLtoCitation cursor =
Patent.Citation
{ Patent._citationCountry = cc
, Patent._citationSerial = serialNo
, Patent._citationKind = Just kindCode
, Patent._citationPubDate = Nothing
, Patent._citationSpecialCase = Nothing
}
where
cc = headDef "" $ cursor $/ XML.laxElement "country" &// XML.content
serialNo =
headDef "" $ cursor $/ XML.laxElement "doc-number" &// XML.content
kindCode = headDef "" $ cursor $/ XML.laxElement "kind" &// XML.content | 538 | parseXMLtoCitation :: XML.Cursor -> Patent.Citation
parseXMLtoCitation cursor =
Patent.Citation
{ Patent._citationCountry = cc
, Patent._citationSerial = serialNo
, Patent._citationKind = Just kindCode
, Patent._citationPubDate = Nothing
, Patent._citationSpecialCase = Nothing
}
where
cc = headDef "" $ cursor $/ XML.laxElement "country" &// XML.content
serialNo =
headDef "" $ cursor $/ XML.laxElement "doc-number" &// XML.content
kindCode = headDef "" $ cursor $/ XML.laxElement "kind" &// XML.content | 538 | parseXMLtoCitation cursor =
Patent.Citation
{ Patent._citationCountry = cc
, Patent._citationSerial = serialNo
, Patent._citationKind = Just kindCode
, Patent._citationPubDate = Nothing
, Patent._citationSpecialCase = Nothing
}
where
cc = headDef "" $ cursor $/ XML.laxElement "country" &// XML.content
serialNo =
headDef "" $ cursor $/ XML.laxElement "doc-number" &// XML.content
kindCode = headDef "" $ cursor $/ XML.laxElement "kind" &// XML.content | 486 | false | true | 0 | 8 | 98 | 157 | 80 | 77 | null | null |
ezyang/ghc | libraries/base/GHC/ByteOrder.hs | bsd-3-clause | targetByteOrder = BigEndian | 27 | targetByteOrder = BigEndian | 27 | targetByteOrder = BigEndian | 27 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
BartAdv/Idris-dev | src/Idris/Core/ProofState.hs | bsd-3-clause | processTactic EndUnify ps
= let (h, ns_in) = unified ps
ns = dropGiven (dontunify ps) ns_in (holes ps)
ns' = map (\ (n, t) -> (n, updateSolvedTerm ns t)) ns
(ns'', probs') = updateProblems ps ns' (problems ps)
tm' = updateSolved ns'' (pterm ps) in
traceWhen (unifylog ps) ("(EndUnify) Dropping holes: " ++ show (map fst ns'')) $
return (ps { pterm = tm',
unified = (h, []),
problems = probs',
notunified = updateNotunified ns'' (notunified ps),
recents = recents ps ++ map fst ns'',
holes = holes ps \\ map fst ns'' }, "") | 728 | processTactic EndUnify ps
= let (h, ns_in) = unified ps
ns = dropGiven (dontunify ps) ns_in (holes ps)
ns' = map (\ (n, t) -> (n, updateSolvedTerm ns t)) ns
(ns'', probs') = updateProblems ps ns' (problems ps)
tm' = updateSolved ns'' (pterm ps) in
traceWhen (unifylog ps) ("(EndUnify) Dropping holes: " ++ show (map fst ns'')) $
return (ps { pterm = tm',
unified = (h, []),
problems = probs',
notunified = updateNotunified ns'' (notunified ps),
recents = recents ps ++ map fst ns'',
holes = holes ps \\ map fst ns'' }, "") | 728 | processTactic EndUnify ps
= let (h, ns_in) = unified ps
ns = dropGiven (dontunify ps) ns_in (holes ps)
ns' = map (\ (n, t) -> (n, updateSolvedTerm ns t)) ns
(ns'', probs') = updateProblems ps ns' (problems ps)
tm' = updateSolved ns'' (pterm ps) in
traceWhen (unifylog ps) ("(EndUnify) Dropping holes: " ++ show (map fst ns'')) $
return (ps { pterm = tm',
unified = (h, []),
problems = probs',
notunified = updateNotunified ns'' (notunified ps),
recents = recents ps ++ map fst ns'',
holes = holes ps \\ map fst ns'' }, "") | 728 | false | false | 0 | 14 | 300 | 255 | 134 | 121 | null | null |
mathhun/stack | src/Stack/Build/Cache.hs | bsd-3-clause | writePrecompiledCache :: (MonadThrow m, MonadReader env m, HasEnvConfig env, MonadIO m)
=> BaseConfigOpts
-> PackageIdentifier
-> ConfigureOpts
-> Set GhcPkgId -- ^ dependencies
-> Installed -- ^ library
-> Set Text -- ^ executables
-> m ()
writePrecompiledCache baseConfigOpts pkgident copts depIDs mghcPkgId exes = do
file <- precompiledCacheFile pkgident copts depIDs
createTree $ parent file
mlibpath <-
case mghcPkgId of
Executable _ -> return Nothing
Library _ ipid -> liftM Just $ do
ipid' <- parseRelFile $ ghcPkgIdString ipid ++ ".conf"
return $ toFilePath $ bcoSnapDB baseConfigOpts </> ipid'
exes' <- forM (Set.toList exes) $ \exe -> do
name <- parseRelFile $ T.unpack exe
return $ toFilePath $ bcoSnapInstallRoot baseConfigOpts </> bindirSuffix </> name
liftIO $ taggedEncodeFile file PrecompiledCache
{ pcLibrary = mlibpath
, pcExes = exes'
}
-- | Check the cache for a precompiled package matching the given
-- configuration. | 1,218 | writePrecompiledCache :: (MonadThrow m, MonadReader env m, HasEnvConfig env, MonadIO m)
=> BaseConfigOpts
-> PackageIdentifier
-> ConfigureOpts
-> Set GhcPkgId -- ^ dependencies
-> Installed -- ^ library
-> Set Text -- ^ executables
-> m ()
writePrecompiledCache baseConfigOpts pkgident copts depIDs mghcPkgId exes = do
file <- precompiledCacheFile pkgident copts depIDs
createTree $ parent file
mlibpath <-
case mghcPkgId of
Executable _ -> return Nothing
Library _ ipid -> liftM Just $ do
ipid' <- parseRelFile $ ghcPkgIdString ipid ++ ".conf"
return $ toFilePath $ bcoSnapDB baseConfigOpts </> ipid'
exes' <- forM (Set.toList exes) $ \exe -> do
name <- parseRelFile $ T.unpack exe
return $ toFilePath $ bcoSnapInstallRoot baseConfigOpts </> bindirSuffix </> name
liftIO $ taggedEncodeFile file PrecompiledCache
{ pcLibrary = mlibpath
, pcExes = exes'
}
-- | Check the cache for a precompiled package matching the given
-- configuration. | 1,218 | writePrecompiledCache baseConfigOpts pkgident copts depIDs mghcPkgId exes = do
file <- precompiledCacheFile pkgident copts depIDs
createTree $ parent file
mlibpath <-
case mghcPkgId of
Executable _ -> return Nothing
Library _ ipid -> liftM Just $ do
ipid' <- parseRelFile $ ghcPkgIdString ipid ++ ".conf"
return $ toFilePath $ bcoSnapDB baseConfigOpts </> ipid'
exes' <- forM (Set.toList exes) $ \exe -> do
name <- parseRelFile $ T.unpack exe
return $ toFilePath $ bcoSnapInstallRoot baseConfigOpts </> bindirSuffix </> name
liftIO $ taggedEncodeFile file PrecompiledCache
{ pcLibrary = mlibpath
, pcExes = exes'
}
-- | Check the cache for a precompiled package matching the given
-- configuration. | 823 | false | true | 0 | 17 | 421 | 285 | 136 | 149 | null | null |
niteria/haddock | haddock-api/src/Haddock/Interface/Rename.hs | bsd-2-clause | renameTyClD :: TyClDecl Name -> RnM (TyClDecl DocName)
renameTyClD d = case d of
-- TyFamily flav lname ltyvars kind tckind -> do
FamDecl { tcdFam = decl } -> do
decl' <- renameFamilyDecl decl
return (FamDecl { tcdFam = decl' })
SynDecl { tcdLName = lname, tcdTyVars = tyvars, tcdRhs = rhs, tcdFVs = _fvs } -> do
lname' <- renameL lname
tyvars' <- renameLHsQTyVars tyvars
rhs' <- renameLType rhs
return (SynDecl { tcdLName = lname', tcdTyVars = tyvars', tcdRhs = rhs', tcdFVs = placeHolderNames })
DataDecl { tcdLName = lname, tcdTyVars = tyvars, tcdDataDefn = defn, tcdFVs = _fvs } -> do
lname' <- renameL lname
tyvars' <- renameLHsQTyVars tyvars
defn' <- renameDataDefn defn
return (DataDecl { tcdLName = lname', tcdTyVars = tyvars', tcdDataDefn = defn', tcdDataCusk = PlaceHolder, tcdFVs = placeHolderNames })
ClassDecl { tcdCtxt = lcontext, tcdLName = lname, tcdTyVars = ltyvars
, tcdFDs = lfundeps, tcdSigs = lsigs, tcdATs = ats, tcdATDefs = at_defs } -> do
lcontext' <- renameLContext lcontext
lname' <- renameL lname
ltyvars' <- renameLHsQTyVars ltyvars
lfundeps' <- mapM renameLFunDep lfundeps
lsigs' <- mapM renameLSig lsigs
ats' <- mapM (renameLThing renameFamilyDecl) ats
at_defs' <- mapM renameLTyFamDefltEqn at_defs
-- we don't need the default methods or the already collected doc entities
return (ClassDecl { tcdCtxt = lcontext', tcdLName = lname', tcdTyVars = ltyvars'
, tcdFDs = lfundeps', tcdSigs = lsigs', tcdMeths= emptyBag
, tcdATs = ats', tcdATDefs = at_defs', tcdDocs = [], tcdFVs = placeHolderNames })
where
renameLFunDep (L loc (xs, ys)) = do
xs' <- mapM rename (map unLoc xs)
ys' <- mapM rename (map unLoc ys)
return (L loc (map noLoc xs', map noLoc ys'))
renameLSig (L loc sig) = return . L loc =<< renameSig sig | 1,944 | renameTyClD :: TyClDecl Name -> RnM (TyClDecl DocName)
renameTyClD d = case d of
-- TyFamily flav lname ltyvars kind tckind -> do
FamDecl { tcdFam = decl } -> do
decl' <- renameFamilyDecl decl
return (FamDecl { tcdFam = decl' })
SynDecl { tcdLName = lname, tcdTyVars = tyvars, tcdRhs = rhs, tcdFVs = _fvs } -> do
lname' <- renameL lname
tyvars' <- renameLHsQTyVars tyvars
rhs' <- renameLType rhs
return (SynDecl { tcdLName = lname', tcdTyVars = tyvars', tcdRhs = rhs', tcdFVs = placeHolderNames })
DataDecl { tcdLName = lname, tcdTyVars = tyvars, tcdDataDefn = defn, tcdFVs = _fvs } -> do
lname' <- renameL lname
tyvars' <- renameLHsQTyVars tyvars
defn' <- renameDataDefn defn
return (DataDecl { tcdLName = lname', tcdTyVars = tyvars', tcdDataDefn = defn', tcdDataCusk = PlaceHolder, tcdFVs = placeHolderNames })
ClassDecl { tcdCtxt = lcontext, tcdLName = lname, tcdTyVars = ltyvars
, tcdFDs = lfundeps, tcdSigs = lsigs, tcdATs = ats, tcdATDefs = at_defs } -> do
lcontext' <- renameLContext lcontext
lname' <- renameL lname
ltyvars' <- renameLHsQTyVars ltyvars
lfundeps' <- mapM renameLFunDep lfundeps
lsigs' <- mapM renameLSig lsigs
ats' <- mapM (renameLThing renameFamilyDecl) ats
at_defs' <- mapM renameLTyFamDefltEqn at_defs
-- we don't need the default methods or the already collected doc entities
return (ClassDecl { tcdCtxt = lcontext', tcdLName = lname', tcdTyVars = ltyvars'
, tcdFDs = lfundeps', tcdSigs = lsigs', tcdMeths= emptyBag
, tcdATs = ats', tcdATDefs = at_defs', tcdDocs = [], tcdFVs = placeHolderNames })
where
renameLFunDep (L loc (xs, ys)) = do
xs' <- mapM rename (map unLoc xs)
ys' <- mapM rename (map unLoc ys)
return (L loc (map noLoc xs', map noLoc ys'))
renameLSig (L loc sig) = return . L loc =<< renameSig sig | 1,944 | renameTyClD d = case d of
-- TyFamily flav lname ltyvars kind tckind -> do
FamDecl { tcdFam = decl } -> do
decl' <- renameFamilyDecl decl
return (FamDecl { tcdFam = decl' })
SynDecl { tcdLName = lname, tcdTyVars = tyvars, tcdRhs = rhs, tcdFVs = _fvs } -> do
lname' <- renameL lname
tyvars' <- renameLHsQTyVars tyvars
rhs' <- renameLType rhs
return (SynDecl { tcdLName = lname', tcdTyVars = tyvars', tcdRhs = rhs', tcdFVs = placeHolderNames })
DataDecl { tcdLName = lname, tcdTyVars = tyvars, tcdDataDefn = defn, tcdFVs = _fvs } -> do
lname' <- renameL lname
tyvars' <- renameLHsQTyVars tyvars
defn' <- renameDataDefn defn
return (DataDecl { tcdLName = lname', tcdTyVars = tyvars', tcdDataDefn = defn', tcdDataCusk = PlaceHolder, tcdFVs = placeHolderNames })
ClassDecl { tcdCtxt = lcontext, tcdLName = lname, tcdTyVars = ltyvars
, tcdFDs = lfundeps, tcdSigs = lsigs, tcdATs = ats, tcdATDefs = at_defs } -> do
lcontext' <- renameLContext lcontext
lname' <- renameL lname
ltyvars' <- renameLHsQTyVars ltyvars
lfundeps' <- mapM renameLFunDep lfundeps
lsigs' <- mapM renameLSig lsigs
ats' <- mapM (renameLThing renameFamilyDecl) ats
at_defs' <- mapM renameLTyFamDefltEqn at_defs
-- we don't need the default methods or the already collected doc entities
return (ClassDecl { tcdCtxt = lcontext', tcdLName = lname', tcdTyVars = ltyvars'
, tcdFDs = lfundeps', tcdSigs = lsigs', tcdMeths= emptyBag
, tcdATs = ats', tcdATDefs = at_defs', tcdDocs = [], tcdFVs = placeHolderNames })
where
renameLFunDep (L loc (xs, ys)) = do
xs' <- mapM rename (map unLoc xs)
ys' <- mapM rename (map unLoc ys)
return (L loc (map noLoc xs', map noLoc ys'))
renameLSig (L loc sig) = return . L loc =<< renameSig sig | 1,889 | false | true | 5 | 14 | 490 | 616 | 321 | 295 | null | null |
rvl/hsoz | src/Network/Hawk/Internal.hs | bsd-3-clause | hawk1String :: HawkType -> HeaderArtifacts -> ByteString
-- corresponds to generateNormalizedString in crypto.js
hawk1String t HeaderArtifacts{..} = newlines $
[ hawk1Header t
, S8.pack . show . round $ haTimestamp
, haNonce
, S8.map toUpper haMethod
, haResource
, S8.map toLower haHost
, maybe "" (S8.pack . show) haPort
, fromMaybe "" haHash
, maybe "" escapeExt haExt
] ++ map encodeUtf8 (oz haApp haDlg)
where
oz Nothing _ = []
oz (Just a) (Just d) = [a, d]
oz (Just a) Nothing = [a] | 522 | hawk1String :: HawkType -> HeaderArtifacts -> ByteString
hawk1String t HeaderArtifacts{..} = newlines $
[ hawk1Header t
, S8.pack . show . round $ haTimestamp
, haNonce
, S8.map toUpper haMethod
, haResource
, S8.map toLower haHost
, maybe "" (S8.pack . show) haPort
, fromMaybe "" haHash
, maybe "" escapeExt haExt
] ++ map encodeUtf8 (oz haApp haDlg)
where
oz Nothing _ = []
oz (Just a) (Just d) = [a, d]
oz (Just a) Nothing = [a] | 466 | hawk1String t HeaderArtifacts{..} = newlines $
[ hawk1Header t
, S8.pack . show . round $ haTimestamp
, haNonce
, S8.map toUpper haMethod
, haResource
, S8.map toLower haHost
, maybe "" (S8.pack . show) haPort
, fromMaybe "" haHash
, maybe "" escapeExt haExt
] ++ map encodeUtf8 (oz haApp haDlg)
where
oz Nothing _ = []
oz (Just a) (Just d) = [a, d]
oz (Just a) Nothing = [a] | 409 | true | true | 2 | 11 | 118 | 200 | 103 | 97 | null | null |
input-output-hk/pos-haskell-prototype | script-runner/common/PocMode.hs | mit | nodeHandles :: PocMode (TVar (Map (Types.NodeType,Integer) NodeHandle))
nodeHandles = view acNodeHandles | 104 | nodeHandles :: PocMode (TVar (Map (Types.NodeType,Integer) NodeHandle))
nodeHandles = view acNodeHandles | 104 | nodeHandles = view acNodeHandles | 32 | false | true | 0 | 11 | 10 | 39 | 20 | 19 | null | null |
wherkendell/diagrams-contrib | drv/Diagrams/Swimunit/DotmatrixModuleNameDriver.hs | bsd-3-clause | {-|
MAIN method. Call 'main' to produce output.
-}
main :: IO ()
main = mainWith (
let mname = (
dotmatrix defdot dotfont_B6x9 "SWIMUNIT.DOTMATRIX" # fc aqua # lc dodgerblue
<>
notdotmatrix defdot dotfont_B6x9 "SWIMUNIT.DOTMATRIX" # fc black # lc darkslategray
) # centerXY
in mname
<>
backgroundrect 1.1 mname
# centerXY -- center background
) | 507 | main :: IO ()
main = mainWith (
let mname = (
dotmatrix defdot dotfont_B6x9 "SWIMUNIT.DOTMATRIX" # fc aqua # lc dodgerblue
<>
notdotmatrix defdot dotfont_B6x9 "SWIMUNIT.DOTMATRIX" # fc black # lc darkslategray
) # centerXY
in mname
<>
backgroundrect 1.1 mname
# centerXY -- center background
) | 453 | main = mainWith (
let mname = (
dotmatrix defdot dotfont_B6x9 "SWIMUNIT.DOTMATRIX" # fc aqua # lc dodgerblue
<>
notdotmatrix defdot dotfont_B6x9 "SWIMUNIT.DOTMATRIX" # fc black # lc darkslategray
) # centerXY
in mname
<>
backgroundrect 1.1 mname
# centerXY -- center background
) | 439 | true | true | 0 | 18 | 219 | 101 | 48 | 53 | null | null |
kim/amazonka | amazonka-redshift/gen/Network/AWS/Redshift/EnableLogging.hs | mpl-2.0 | -- | The name of an existing S3 bucket where the log files are to be stored.
--
-- Constraints:
--
-- Must be in the same region as the cluster The cluster must have read bucket
-- and put object permissions
elBucketName :: Lens' EnableLogging Text
elBucketName = lens _elBucketName (\s a -> s { _elBucketName = a }) | 316 | elBucketName :: Lens' EnableLogging Text
elBucketName = lens _elBucketName (\s a -> s { _elBucketName = a }) | 108 | elBucketName = lens _elBucketName (\s a -> s { _elBucketName = a }) | 67 | true | true | 0 | 9 | 59 | 45 | 27 | 18 | null | null |
clarissalittler/cs311 | DFALang.hs | mit | reservedOp = T.reservedOp lang | 30 | reservedOp = T.reservedOp lang | 30 | reservedOp = T.reservedOp lang | 30 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
urbanslug/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | rationalToDoubleName = varQual gHC_FLOAT (fsLit "rationalToDouble") rationalToDoubleIdKey | 89 | rationalToDoubleName = varQual gHC_FLOAT (fsLit "rationalToDouble") rationalToDoubleIdKey | 89 | rationalToDoubleName = varQual gHC_FLOAT (fsLit "rationalToDouble") rationalToDoubleIdKey | 89 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
daewon/til | haskell/haskell_by_example/values.hs | mpl-2.0 | main = do
putStrLn $ "haskell" ++ "lang"
putStrLn $ "1 + 1 = " ++ show (1 + 1)
putStrLn $ "7.0/3.0 = " ++ show (7.0 / 3.0)
print $ True && False
print $ True || False
print $ not True | 196 | main = do
putStrLn $ "haskell" ++ "lang"
putStrLn $ "1 + 1 = " ++ show (1 + 1)
putStrLn $ "7.0/3.0 = " ++ show (7.0 / 3.0)
print $ True && False
print $ True || False
print $ not True | 196 | main = do
putStrLn $ "haskell" ++ "lang"
putStrLn $ "1 + 1 = " ++ show (1 + 1)
putStrLn $ "7.0/3.0 = " ++ show (7.0 / 3.0)
print $ True && False
print $ True || False
print $ not True | 196 | false | false | 1 | 11 | 56 | 95 | 42 | 53 | null | null |
Happy0/lichess_csv | src/Web/Lichess/Conduit.hs | gpl-2.0 | tournamentStandings :: String -> Source IO Value
tournamentStandings tournamentId =
L.unfoldM (getTournamentStandingsPage tournamentId) 1 =$= L.concat | 157 | tournamentStandings :: String -> Source IO Value
tournamentStandings tournamentId =
L.unfoldM (getTournamentStandingsPage tournamentId) 1 =$= L.concat | 155 | tournamentStandings tournamentId =
L.unfoldM (getTournamentStandingsPage tournamentId) 1 =$= L.concat | 106 | false | true | 0 | 8 | 22 | 42 | 20 | 22 | null | null |
nevrenato/Hets_Fork | Common/Token.hs | gpl-2.0 | {- | any ('topMix1', 'topMix2', 'topMix3') mixfix components
that may follow a place ('placeT') at the top level -}
afterPlace :: ([String], [String]) -> GenParser Char st [Token]
afterPlace l = topMix1 l <|> topMix2 l <|> topMix3 l | 235 | afterPlace :: ([String], [String]) -> GenParser Char st [Token]
afterPlace l = topMix1 l <|> topMix2 l <|> topMix3 l | 116 | afterPlace l = topMix1 l <|> topMix2 l <|> topMix3 l | 52 | true | true | 0 | 8 | 41 | 62 | 31 | 31 | null | null |
chetant/LibClang | src/Clang/Cursor.hs | bsd-3-clause | getSpelling :: ClangBase m => FFI.Cursor s' -> ClangT s m (FFI.ClangString s)
getSpelling = FFI.getCursorSpelling | 113 | getSpelling :: ClangBase m => FFI.Cursor s' -> ClangT s m (FFI.ClangString s)
getSpelling = FFI.getCursorSpelling | 113 | getSpelling = FFI.getCursorSpelling | 35 | false | true | 0 | 11 | 15 | 50 | 22 | 28 | null | null |
oldmanmike/ghc | compiler/utils/Binary.hs | bsd-3-clause | tellBin :: BinHandle -> IO (Bin a)
tellBin (BinMem _ r _ _) = do ix <- readFastMutInt r; return (BinPtr ix) | 107 | tellBin :: BinHandle -> IO (Bin a)
tellBin (BinMem _ r _ _) = do ix <- readFastMutInt r; return (BinPtr ix) | 107 | tellBin (BinMem _ r _ _) = do ix <- readFastMutInt r; return (BinPtr ix) | 72 | false | true | 0 | 9 | 21 | 66 | 30 | 36 | null | null |
mgrebenets/hackerrank | alg/warmup/sherlock-and-gcd.hs | mit | subset (n, nums) = findGcd nums | 31 | subset (n, nums) = findGcd nums | 31 | subset (n, nums) = findGcd nums | 31 | false | false | 0 | 6 | 5 | 18 | 9 | 9 | null | null |
nfjinjing/yuuko | src/Text/HTML/TagSoup/Specification.hs | bsd-3-clause | charRefNum2 resume o hex S{..} = pos $ case hd of
_ | hexChar hex hd -> (if hex then EntityHex else EntityNum) & hd & charRefNum3 resume hex tl
_ -> errSeen "&" & '&' & resume o | 185 | charRefNum2 resume o hex S{..} = pos $ case hd of
_ | hexChar hex hd -> (if hex then EntityHex else EntityNum) & hd & charRefNum3 resume hex tl
_ -> errSeen "&" & '&' & resume o | 185 | charRefNum2 resume o hex S{..} = pos $ case hd of
_ | hexChar hex hd -> (if hex then EntityHex else EntityNum) & hd & charRefNum3 resume hex tl
_ -> errSeen "&" & '&' & resume o | 185 | false | false | 2 | 8 | 46 | 92 | 44 | 48 | null | null |
imalsogreg/reflex-dom | src/Reflex/Dom/Widget/Lazy.hs | bsd-3-clause | virtualListWithSelection :: forall t m k v. (MonadWidget t m, Ord k)
=> Int -- ^ The height of the visible region in pixels
-> Int -- ^ The height of each row in pixels
-> Dynamic t Int -- ^ The total number of items
-> Int -- ^ The index of the row to scroll to on initialization
-> Event t Int -- ^ An 'Event' containing a row index. Used to scroll to the given index.
-> String -- ^ The element tag for the list
-> Dynamic t (Map String String) -- ^ The attributes of the list
-> String -- ^ The element tag for a row
-> Dynamic t (Map String String) -- ^ The attributes of each row
-> (k -> Dynamic t v -> m ()) -- ^ The row child element builder
-> Dynamic t (Map k v) -- ^ The 'Map' of items
-> m (Dynamic t (Int, Int), Event t k) -- ^ A tuple containing: a 'Dynamic' of the index (based on the current scroll position) and number of items currently being rendered, and an 'Event' of the selected key
virtualListWithSelection heightPx rowPx maxIndex i0 setI listTag listAttrs rowTag rowAttrs itemBuilder items = do
totalHeightStyle <- mapDyn (toHeightStyle . (*) rowPx) maxIndex
rec (container, itemList) <- elAttr "div" outerStyle $ elAttr' "div" containerStyle $ do
currentTop <- mapDyn (listWrapperStyle . fst) window
(_, lis) <- elDynAttr "div" totalHeightStyle $ tagWrapper listTag listAttrs currentTop $ listWithKey itemsInWindow $ \k v -> do
(li,_) <- tagWrapper rowTag rowAttrs (constDyn $ toHeightStyle rowPx) $ itemBuilder k v
return $ fmap (const k) (_el_clicked li)
return lis
scrollPosition <- holdDyn 0 $ _el_scrolled container
window <- mapDyn (findWindow heightPx rowPx) scrollPosition
itemsInWindow <- combineDyn (\(_,(idx,num)) is -> Map.fromList $ take num $ drop idx $ Map.toList is) window items
postBuild <- getPostBuild
performEvent_ $ fmap (\i -> liftIO $ elementSetScrollTop (_el_element container) (i * rowPx)) $ leftmost [setI, fmap (const i0) postBuild]
indexAndLength <- mapDyn snd window
sel <- mapDyn (leftmost . Map.elems) itemList
return (indexAndLength, switch $ current sel)
where
toStyleAttr m = "style" =: (Map.foldWithKey (\k v s -> k <> ":" <> v <> ";" <> s) "" m)
outerStyle = toStyleAttr $ "position" =: "relative" <>
"height" =: (show heightPx <> "px")
containerStyle = toStyleAttr $ "overflow" =: "auto" <>
"position" =: "absolute" <>
"left" =: "0" <>
"right" =: "0" <>
"height" =: (show heightPx <> "px")
listWrapperStyle t = toStyleAttr $ "position" =: "relative" <>
"top" =: (show t <> "px")
toHeightStyle h = toStyleAttr ("height" =: (show h <> "px"))
tagWrapper elTag attrs attrsOverride c = do
attrs' <- combineDyn Map.union attrsOverride attrs
elDynAttr' elTag attrs' c
findWindow windowSize sizeIncrement startingPosition =
let (startingIndex, topOffsetPx) = startingPosition `divMod'` sizeIncrement
topPx = startingPosition - topOffsetPx
numItems = windowSize `div` sizeIncrement + 1
preItems = min startingIndex numItems
in (topPx - preItems * sizeIncrement, (startingIndex - preItems, preItems + numItems * 2)) | 3,368 | virtualListWithSelection :: forall t m k v. (MonadWidget t m, Ord k)
=> Int -- ^ The height of the visible region in pixels
-> Int -- ^ The height of each row in pixels
-> Dynamic t Int -- ^ The total number of items
-> Int -- ^ The index of the row to scroll to on initialization
-> Event t Int -- ^ An 'Event' containing a row index. Used to scroll to the given index.
-> String -- ^ The element tag for the list
-> Dynamic t (Map String String) -- ^ The attributes of the list
-> String -- ^ The element tag for a row
-> Dynamic t (Map String String) -- ^ The attributes of each row
-> (k -> Dynamic t v -> m ()) -- ^ The row child element builder
-> Dynamic t (Map k v) -- ^ The 'Map' of items
-> m (Dynamic t (Int, Int), Event t k)
virtualListWithSelection heightPx rowPx maxIndex i0 setI listTag listAttrs rowTag rowAttrs itemBuilder items = do
totalHeightStyle <- mapDyn (toHeightStyle . (*) rowPx) maxIndex
rec (container, itemList) <- elAttr "div" outerStyle $ elAttr' "div" containerStyle $ do
currentTop <- mapDyn (listWrapperStyle . fst) window
(_, lis) <- elDynAttr "div" totalHeightStyle $ tagWrapper listTag listAttrs currentTop $ listWithKey itemsInWindow $ \k v -> do
(li,_) <- tagWrapper rowTag rowAttrs (constDyn $ toHeightStyle rowPx) $ itemBuilder k v
return $ fmap (const k) (_el_clicked li)
return lis
scrollPosition <- holdDyn 0 $ _el_scrolled container
window <- mapDyn (findWindow heightPx rowPx) scrollPosition
itemsInWindow <- combineDyn (\(_,(idx,num)) is -> Map.fromList $ take num $ drop idx $ Map.toList is) window items
postBuild <- getPostBuild
performEvent_ $ fmap (\i -> liftIO $ elementSetScrollTop (_el_element container) (i * rowPx)) $ leftmost [setI, fmap (const i0) postBuild]
indexAndLength <- mapDyn snd window
sel <- mapDyn (leftmost . Map.elems) itemList
return (indexAndLength, switch $ current sel)
where
toStyleAttr m = "style" =: (Map.foldWithKey (\k v s -> k <> ":" <> v <> ";" <> s) "" m)
outerStyle = toStyleAttr $ "position" =: "relative" <>
"height" =: (show heightPx <> "px")
containerStyle = toStyleAttr $ "overflow" =: "auto" <>
"position" =: "absolute" <>
"left" =: "0" <>
"right" =: "0" <>
"height" =: (show heightPx <> "px")
listWrapperStyle t = toStyleAttr $ "position" =: "relative" <>
"top" =: (show t <> "px")
toHeightStyle h = toStyleAttr ("height" =: (show h <> "px"))
tagWrapper elTag attrs attrsOverride c = do
attrs' <- combineDyn Map.union attrsOverride attrs
elDynAttr' elTag attrs' c
findWindow windowSize sizeIncrement startingPosition =
let (startingIndex, topOffsetPx) = startingPosition `divMod'` sizeIncrement
topPx = startingPosition - topOffsetPx
numItems = windowSize `div` sizeIncrement + 1
preItems = min startingIndex numItems
in (topPx - preItems * sizeIncrement, (startingIndex - preItems, preItems + numItems * 2)) | 3,198 | virtualListWithSelection heightPx rowPx maxIndex i0 setI listTag listAttrs rowTag rowAttrs itemBuilder items = do
totalHeightStyle <- mapDyn (toHeightStyle . (*) rowPx) maxIndex
rec (container, itemList) <- elAttr "div" outerStyle $ elAttr' "div" containerStyle $ do
currentTop <- mapDyn (listWrapperStyle . fst) window
(_, lis) <- elDynAttr "div" totalHeightStyle $ tagWrapper listTag listAttrs currentTop $ listWithKey itemsInWindow $ \k v -> do
(li,_) <- tagWrapper rowTag rowAttrs (constDyn $ toHeightStyle rowPx) $ itemBuilder k v
return $ fmap (const k) (_el_clicked li)
return lis
scrollPosition <- holdDyn 0 $ _el_scrolled container
window <- mapDyn (findWindow heightPx rowPx) scrollPosition
itemsInWindow <- combineDyn (\(_,(idx,num)) is -> Map.fromList $ take num $ drop idx $ Map.toList is) window items
postBuild <- getPostBuild
performEvent_ $ fmap (\i -> liftIO $ elementSetScrollTop (_el_element container) (i * rowPx)) $ leftmost [setI, fmap (const i0) postBuild]
indexAndLength <- mapDyn snd window
sel <- mapDyn (leftmost . Map.elems) itemList
return (indexAndLength, switch $ current sel)
where
toStyleAttr m = "style" =: (Map.foldWithKey (\k v s -> k <> ":" <> v <> ";" <> s) "" m)
outerStyle = toStyleAttr $ "position" =: "relative" <>
"height" =: (show heightPx <> "px")
containerStyle = toStyleAttr $ "overflow" =: "auto" <>
"position" =: "absolute" <>
"left" =: "0" <>
"right" =: "0" <>
"height" =: (show heightPx <> "px")
listWrapperStyle t = toStyleAttr $ "position" =: "relative" <>
"top" =: (show t <> "px")
toHeightStyle h = toStyleAttr ("height" =: (show h <> "px"))
tagWrapper elTag attrs attrsOverride c = do
attrs' <- combineDyn Map.union attrsOverride attrs
elDynAttr' elTag attrs' c
findWindow windowSize sizeIncrement startingPosition =
let (startingIndex, topOffsetPx) = startingPosition `divMod'` sizeIncrement
topPx = startingPosition - topOffsetPx
numItems = windowSize `div` sizeIncrement + 1
preItems = min startingIndex numItems
in (topPx - preItems * sizeIncrement, (startingIndex - preItems, preItems + numItems * 2)) | 2,437 | true | true | 6 | 32 | 892 | 974 | 486 | 488 | null | null |
wz1000/haskell-lsp | lsp/example/Reactor.hs | mit | lspHandlers :: TChan ReactorInput -> Handlers (LspM Config)
lspHandlers rin = mapHandlers goReq goNot handle
where
goReq :: forall (a :: J.Method J.FromClient J.Request). Handler (LspM Config) a -> Handler (LspM Config) a
goReq f = \msg k -> do
env <- getLspEnv
liftIO $ atomically $ writeTChan rin $ ReactorAction (runLspT env $ f msg k)
goNot :: forall (a :: J.Method J.FromClient J.Notification). Handler (LspM Config) a -> Handler (LspM Config) a
goNot f = \msg -> do
env <- getLspEnv
liftIO $ atomically $ writeTChan rin $ ReactorAction (runLspT env $ f msg)
-- | Where the actual logic resides for handling requests and notifications. | 684 | lspHandlers :: TChan ReactorInput -> Handlers (LspM Config)
lspHandlers rin = mapHandlers goReq goNot handle
where
goReq :: forall (a :: J.Method J.FromClient J.Request). Handler (LspM Config) a -> Handler (LspM Config) a
goReq f = \msg k -> do
env <- getLspEnv
liftIO $ atomically $ writeTChan rin $ ReactorAction (runLspT env $ f msg k)
goNot :: forall (a :: J.Method J.FromClient J.Notification). Handler (LspM Config) a -> Handler (LspM Config) a
goNot f = \msg -> do
env <- getLspEnv
liftIO $ atomically $ writeTChan rin $ ReactorAction (runLspT env $ f msg)
-- | Where the actual logic resides for handling requests and notifications. | 684 | lspHandlers rin = mapHandlers goReq goNot handle
where
goReq :: forall (a :: J.Method J.FromClient J.Request). Handler (LspM Config) a -> Handler (LspM Config) a
goReq f = \msg k -> do
env <- getLspEnv
liftIO $ atomically $ writeTChan rin $ ReactorAction (runLspT env $ f msg k)
goNot :: forall (a :: J.Method J.FromClient J.Notification). Handler (LspM Config) a -> Handler (LspM Config) a
goNot f = \msg -> do
env <- getLspEnv
liftIO $ atomically $ writeTChan rin $ ReactorAction (runLspT env $ f msg)
-- | Where the actual logic resides for handling requests and notifications. | 624 | false | true | 13 | 13 | 151 | 254 | 125 | 129 | null | null |
frantisekfarka/ghc-dsi | compiler/main/DynamicLoading.hs | bsd-3-clause | getHValueSafely :: HscEnv -> Name -> Type -> IO (Maybe HValue)
getHValueSafely hsc_env val_name expected_type = do
forceLoadNameModuleInterface hsc_env (ptext (sLit "contains a name used in an invocation of getHValueSafely")) val_name
-- Now look up the names for the value and type constructor in the type environment
mb_val_thing <- lookupTypeHscEnv hsc_env val_name
case mb_val_thing of
Nothing -> throwCmdLineErrorS dflags $ missingTyThingError val_name
Just (AnId id) -> do
-- Check the value type in the interface against the type recovered from the type constructor
-- before finally casting the value to the type we assume corresponds to that constructor
if expected_type `eqType` idType id
then do
-- Link in the module that contains the value, if it has such a module
case nameModule_maybe val_name of
Just mod -> do linkModule hsc_env mod
return ()
Nothing -> return ()
-- Find the value that we just linked in and cast it given that we have proved it's type
hval <- getHValue hsc_env val_name
return (Just hval)
else return Nothing
Just val_thing -> throwCmdLineErrorS dflags $ wrongTyThingError val_name val_thing
where dflags = hsc_dflags hsc_env
-- | Coerce a value as usual, but:
--
-- 1) Evaluate it immediately to get a segfault early if the coercion was wrong
--
-- 2) Wrap it in some debug messages at verbosity 3 or higher so we can see what happened
-- if it /does/ segfault | 1,661 | getHValueSafely :: HscEnv -> Name -> Type -> IO (Maybe HValue)
getHValueSafely hsc_env val_name expected_type = do
forceLoadNameModuleInterface hsc_env (ptext (sLit "contains a name used in an invocation of getHValueSafely")) val_name
-- Now look up the names for the value and type constructor in the type environment
mb_val_thing <- lookupTypeHscEnv hsc_env val_name
case mb_val_thing of
Nothing -> throwCmdLineErrorS dflags $ missingTyThingError val_name
Just (AnId id) -> do
-- Check the value type in the interface against the type recovered from the type constructor
-- before finally casting the value to the type we assume corresponds to that constructor
if expected_type `eqType` idType id
then do
-- Link in the module that contains the value, if it has such a module
case nameModule_maybe val_name of
Just mod -> do linkModule hsc_env mod
return ()
Nothing -> return ()
-- Find the value that we just linked in and cast it given that we have proved it's type
hval <- getHValue hsc_env val_name
return (Just hval)
else return Nothing
Just val_thing -> throwCmdLineErrorS dflags $ wrongTyThingError val_name val_thing
where dflags = hsc_dflags hsc_env
-- | Coerce a value as usual, but:
--
-- 1) Evaluate it immediately to get a segfault early if the coercion was wrong
--
-- 2) Wrap it in some debug messages at verbosity 3 or higher so we can see what happened
-- if it /does/ segfault | 1,661 | getHValueSafely hsc_env val_name expected_type = do
forceLoadNameModuleInterface hsc_env (ptext (sLit "contains a name used in an invocation of getHValueSafely")) val_name
-- Now look up the names for the value and type constructor in the type environment
mb_val_thing <- lookupTypeHscEnv hsc_env val_name
case mb_val_thing of
Nothing -> throwCmdLineErrorS dflags $ missingTyThingError val_name
Just (AnId id) -> do
-- Check the value type in the interface against the type recovered from the type constructor
-- before finally casting the value to the type we assume corresponds to that constructor
if expected_type `eqType` idType id
then do
-- Link in the module that contains the value, if it has such a module
case nameModule_maybe val_name of
Just mod -> do linkModule hsc_env mod
return ()
Nothing -> return ()
-- Find the value that we just linked in and cast it given that we have proved it's type
hval <- getHValue hsc_env val_name
return (Just hval)
else return Nothing
Just val_thing -> throwCmdLineErrorS dflags $ wrongTyThingError val_name val_thing
where dflags = hsc_dflags hsc_env
-- | Coerce a value as usual, but:
--
-- 1) Evaluate it immediately to get a segfault early if the coercion was wrong
--
-- 2) Wrap it in some debug messages at verbosity 3 or higher so we can see what happened
-- if it /does/ segfault | 1,598 | false | true | 0 | 21 | 494 | 246 | 117 | 129 | null | null |
talw/crisp-compiler | src/Emit.hs | bsd-3-clause | codegenExpr (SetExp symName expr) = do
mVarPtr <- getvar symName
let ptr = fromMaybe (extern $ AST.Name symName) mVarPtr
store ptr =<< codegenExpr expr
return $ constUint nilValue | 187 | codegenExpr (SetExp symName expr) = do
mVarPtr <- getvar symName
let ptr = fromMaybe (extern $ AST.Name symName) mVarPtr
store ptr =<< codegenExpr expr
return $ constUint nilValue | 187 | codegenExpr (SetExp symName expr) = do
mVarPtr <- getvar symName
let ptr = fromMaybe (extern $ AST.Name symName) mVarPtr
store ptr =<< codegenExpr expr
return $ constUint nilValue | 187 | false | false | 0 | 14 | 35 | 77 | 33 | 44 | null | null |
kylcarte/wangtiles | src/Tile.hs | bsd-3-clause | ppFilledTileMap :: (HandleIO n, TileLogic m t, CoordType c)
=> TileSet t -> TileMap c -> ErrorT n String
ppFilledTileMap ts tm = do
g <- T.mapM (tsLookup ts) $ tileMap tm
let pg = fmap ppTile g
return $ ppSparseStringRows $ gridList pg | 243 | ppFilledTileMap :: (HandleIO n, TileLogic m t, CoordType c)
=> TileSet t -> TileMap c -> ErrorT n String
ppFilledTileMap ts tm = do
g <- T.mapM (tsLookup ts) $ tileMap tm
let pg = fmap ppTile g
return $ ppSparseStringRows $ gridList pg | 243 | ppFilledTileMap ts tm = do
g <- T.mapM (tsLookup ts) $ tileMap tm
let pg = fmap ppTile g
return $ ppSparseStringRows $ gridList pg | 136 | false | true | 0 | 11 | 51 | 111 | 51 | 60 | null | null |
nevrenato/HetsAlloy | Fpl/As.der.hs | gpl-2.0 | constBool :: AParser st FplTerm
constBool = fmap Mixfix_token (asKey trueS <|> asKey falseS) | 92 | constBool :: AParser st FplTerm
constBool = fmap Mixfix_token (asKey trueS <|> asKey falseS) | 92 | constBool = fmap Mixfix_token (asKey trueS <|> asKey falseS) | 60 | false | true | 0 | 8 | 13 | 34 | 16 | 18 | null | null |
AidanDelaney/Mira | Setup.hs | bsd-3-clause | main = defaultMainWithHooks (simpleUserHooks {runTests = runzeTests}) | 69 | main = defaultMainWithHooks (simpleUserHooks {runTests = runzeTests}) | 69 | main = defaultMainWithHooks (simpleUserHooks {runTests = runzeTests}) | 69 | false | false | 1 | 8 | 6 | 23 | 11 | 12 | null | null |
mrakgr/futhark | src/Futhark/Representation/SOACS/SOAC.hs | bsd-3-clause | getStreamOrder :: StreamForm lore -> StreamOrd
getStreamOrder (MapLike o ) = o | 81 | getStreamOrder :: StreamForm lore -> StreamOrd
getStreamOrder (MapLike o ) = o | 81 | getStreamOrder (MapLike o ) = o | 34 | false | true | 0 | 6 | 14 | 31 | 14 | 17 | null | null |
tjhunter/karps | haskell/src/Spark/Core/Internal/ColumnFunctions.hs | apache-2.0 | -- Performs the data projection. This is unsafe, it does not check that the
-- field path is valid in this case, nor that the final type is valid either.
unsafeProjectCol :: ColumnData ref a -> FieldPath -> DataType -> ColumnData ref b
unsafeProjectCol cd (FieldPath p) dtTo =
-- If the column is already a projection, flatten it.
case colOp cd of
-- No previous parent on an extraction -> we can safely append to that one.
GenColExtraction (FieldPath p') ->
cd { _cOp = GenColExtraction . FieldPath $ (p V.++ p'),
_cType = dtTo}
_ ->
-- Extract from the previous column.
cd { _cOp = GenColExtraction . FieldPath $ p,
_cType = dtTo} | 687 | unsafeProjectCol :: ColumnData ref a -> FieldPath -> DataType -> ColumnData ref b
unsafeProjectCol cd (FieldPath p) dtTo =
-- If the column is already a projection, flatten it.
case colOp cd of
-- No previous parent on an extraction -> we can safely append to that one.
GenColExtraction (FieldPath p') ->
cd { _cOp = GenColExtraction . FieldPath $ (p V.++ p'),
_cType = dtTo}
_ ->
-- Extract from the previous column.
cd { _cOp = GenColExtraction . FieldPath $ p,
_cType = dtTo} | 533 | unsafeProjectCol cd (FieldPath p) dtTo =
-- If the column is already a projection, flatten it.
case colOp cd of
-- No previous parent on an extraction -> we can safely append to that one.
GenColExtraction (FieldPath p') ->
cd { _cOp = GenColExtraction . FieldPath $ (p V.++ p'),
_cType = dtTo}
_ ->
-- Extract from the previous column.
cd { _cOp = GenColExtraction . FieldPath $ p,
_cType = dtTo} | 451 | true | true | 6 | 10 | 170 | 134 | 71 | 63 | null | null |
vikraman/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | -- | Tests whether we have to use a @case@ rather than @let@ binding for this expression
-- as per the invariants of 'CoreExpr': see "CoreSyn#let_app_invariant"
needsCaseBinding :: Type -> CoreExpr -> Bool
needsCaseBinding ty rhs = isUnliftedType ty && not (exprOkForSpeculation rhs) | 283 | needsCaseBinding :: Type -> CoreExpr -> Bool
needsCaseBinding ty rhs = isUnliftedType ty && not (exprOkForSpeculation rhs) | 122 | needsCaseBinding ty rhs = isUnliftedType ty && not (exprOkForSpeculation rhs) | 77 | true | true | 0 | 8 | 42 | 42 | 21 | 21 | null | null |
miguelpagano/equ | Equ/PreExpr/Zipper.hs | gpl-3.0 | freplicate :: (Focus -> Maybe Focus) -> Int -> (Focus -> Maybe Focus)
freplicate go 0 = go | 90 | freplicate :: (Focus -> Maybe Focus) -> Int -> (Focus -> Maybe Focus)
freplicate go 0 = go | 90 | freplicate go 0 = go | 20 | false | true | 0 | 9 | 17 | 44 | 22 | 22 | null | null |
Raveline/FQuoter | testsuite/FQuoter/Parser/ParserSpec.hs | gpl-3.0 | insertMultiauthorSource = insertS' sourceMultiauthor | 52 | insertMultiauthorSource = insertS' sourceMultiauthor | 52 | insertMultiauthorSource = insertS' sourceMultiauthor | 52 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
msakai/ptq | src/Parser.hs | lgpl-2.1 | fvs (F8 x y) = IS.union (fvs x) (fvs y) | 42 | fvs (F8 x y) = IS.union (fvs x) (fvs y) | 42 | fvs (F8 x y) = IS.union (fvs x) (fvs y) | 42 | false | false | 0 | 7 | 12 | 37 | 17 | 20 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.