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
ghcjs/jsaddle-dom
src/JSDOM/Generated/Enums.hs
mit
js_TextTrackModeHidden = "hidden"
33
js_TextTrackModeHidden = "hidden"
33
js_TextTrackModeHidden = "hidden"
33
false
false
0
4
2
6
3
3
null
null
bogwonch/SecPAL
src/SecPAL.hs
gpl-3.0
runExistentialQuery' :: Bool -> Bool -> Context -> (Assertion, [S.Substitution]) -> IO () runExistentialQuery' verbose debugging ctx (a,s) = do decision <- runAssertion ctx a verbose debugging unless (null decision) $ do --putStrLn $ pShow s ++ " ?- " ++ pShow a putStrLn $ pShow a when verbose $ (putStrLn . pShow . head) decision --printResult verbose debugging decision return ()
404
runExistentialQuery' :: Bool -> Bool -> Context -> (Assertion, [S.Substitution]) -> IO () runExistentialQuery' verbose debugging ctx (a,s) = do decision <- runAssertion ctx a verbose debugging unless (null decision) $ do --putStrLn $ pShow s ++ " ?- " ++ pShow a putStrLn $ pShow a when verbose $ (putStrLn . pShow . head) decision --printResult verbose debugging decision return ()
404
runExistentialQuery' verbose debugging ctx (a,s) = do decision <- runAssertion ctx a verbose debugging unless (null decision) $ do --putStrLn $ pShow s ++ " ?- " ++ pShow a putStrLn $ pShow a when verbose $ (putStrLn . pShow . head) decision --printResult verbose debugging decision return ()
314
false
true
0
14
83
134
65
69
null
null
demhydraz/waffle
src/Backend/Codegen/Expression.hs
bsd-3-clause
compileExpr (C.Unbox x) = compileLiteral' x
43
compileExpr (C.Unbox x) = compileLiteral' x
43
compileExpr (C.Unbox x) = compileLiteral' x
43
false
false
0
8
5
20
9
11
null
null
frontrowed/stratosphere
library-gen/Stratosphere/ResourceProperties/IoTAnalyticsPipelineActivity.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iotanalytics-pipeline-activity.html#cfn-iotanalytics-pipeline-activity-lambda itapaLambda :: Lens' IoTAnalyticsPipelineActivity (Maybe IoTAnalyticsPipelineLambda) itapaLambda = lens _ioTAnalyticsPipelineActivityLambda (\s a -> s { _ioTAnalyticsPipelineActivityLambda = a })
355
itapaLambda :: Lens' IoTAnalyticsPipelineActivity (Maybe IoTAnalyticsPipelineLambda) itapaLambda = lens _ioTAnalyticsPipelineActivityLambda (\s a -> s { _ioTAnalyticsPipelineActivityLambda = a })
195
itapaLambda = lens _ioTAnalyticsPipelineActivityLambda (\s a -> s { _ioTAnalyticsPipelineActivityLambda = a })
110
true
true
1
9
21
50
25
25
null
null
keithodulaigh/Hets
CspCASL/SignCSP.hs
gpl-2.0
-- | Compute union of two CSP CASL signatures. unionCspCASLSign :: CspCASLSign -> CspCASLSign -> Result CspCASLSign unionCspCASLSign s1 s2 = do -- Compute the unioned data signature ignoring the csp signatures let newDataSig = addSig (\ _ _ -> emptyCspSign) s1 s2 -- Check that the new data signature has local top elements rel = sortRel newDataSig diags' = LocalTop.checkLocalTops rel -- Compute the unioned csp signature with respect to the new data signature newCspSign = unionCspSign rel (extendedInfo s1) (extendedInfo s2) {- Only error will be added if there are any probelms. If there are no problems no errors will be added and hets will continue as normal. -} appendDiags diags' -- put both the new data signature and the csp signature back together return $ newDataSig {extendedInfo = newCspSign} {- | Compute union of two CSP signatures assuming the new already computed data signature. -}
937
unionCspCASLSign :: CspCASLSign -> CspCASLSign -> Result CspCASLSign unionCspCASLSign s1 s2 = do -- Compute the unioned data signature ignoring the csp signatures let newDataSig = addSig (\ _ _ -> emptyCspSign) s1 s2 -- Check that the new data signature has local top elements rel = sortRel newDataSig diags' = LocalTop.checkLocalTops rel -- Compute the unioned csp signature with respect to the new data signature newCspSign = unionCspSign rel (extendedInfo s1) (extendedInfo s2) {- Only error will be added if there are any probelms. If there are no problems no errors will be added and hets will continue as normal. -} appendDiags diags' -- put both the new data signature and the csp signature back together return $ newDataSig {extendedInfo = newCspSign} {- | Compute union of two CSP signatures assuming the new already computed data signature. -}
890
unionCspCASLSign s1 s2 = do -- Compute the unioned data signature ignoring the csp signatures let newDataSig = addSig (\ _ _ -> emptyCspSign) s1 s2 -- Check that the new data signature has local top elements rel = sortRel newDataSig diags' = LocalTop.checkLocalTops rel -- Compute the unioned csp signature with respect to the new data signature newCspSign = unionCspSign rel (extendedInfo s1) (extendedInfo s2) {- Only error will be added if there are any probelms. If there are no problems no errors will be added and hets will continue as normal. -} appendDiags diags' -- put both the new data signature and the csp signature back together return $ newDataSig {extendedInfo = newCspSign} {- | Compute union of two CSP signatures assuming the new already computed data signature. -}
821
true
true
0
12
184
128
65
63
null
null
andrewMacmurray/haskell-book-solutions
src/ch8/recur.hs
mit
dividedBy :: Integer -> Integer -> DividedResult dividedBy _ 0 = DividedByZero
78
dividedBy :: Integer -> Integer -> DividedResult dividedBy _ 0 = DividedByZero
78
dividedBy _ 0 = DividedByZero
29
false
true
0
6
11
24
12
12
null
null
poxu/pandoc
src/Text/Pandoc/Readers/Docx.hs
gpl-2.0
rewriteLink' il = return il
27
rewriteLink' il = return il
27
rewriteLink' il = return il
27
false
false
0
5
4
12
5
7
null
null
cauterize-tools/cauterize
tests/Cauterize/Specification/CompileSpec.hs
bsd-3-clause
recordIndicies :: Either a Specification -> [Integer] recordIndicies (Right (Specification { specTypes = [ Type { typeDesc = desc } ] } ) ) = case desc of Record { recordFields = fs } -> map fieldIndex fs _ -> []
222
recordIndicies :: Either a Specification -> [Integer] recordIndicies (Right (Specification { specTypes = [ Type { typeDesc = desc } ] } ) ) = case desc of Record { recordFields = fs } -> map fieldIndex fs _ -> []
222
recordIndicies (Right (Specification { specTypes = [ Type { typeDesc = desc } ] } ) ) = case desc of Record { recordFields = fs } -> map fieldIndex fs _ -> []
168
false
true
2
15
50
90
46
44
null
null
DavidAlphaFox/ghc
libraries/haskeline/System/Console/Haskeline/Command/History.hs
bsd-3-clause
firstHistory s h = let prevs = (listSave s,h):prevHistories (listSave s) h -- above makes sure we don't take the last of an empty list. (s',h') = last prevs in (listRestore s',h')
244
firstHistory s h = let prevs = (listSave s,h):prevHistories (listSave s) h -- above makes sure we don't take the last of an empty list. (s',h') = last prevs in (listRestore s',h')
244
firstHistory s h = let prevs = (listSave s,h):prevHistories (listSave s) h -- above makes sure we don't take the last of an empty list. (s',h') = last prevs in (listRestore s',h')
244
false
false
0
12
96
71
36
35
null
null
wetneb/yanker
src/TypeHierarchy.hs
gpl-3.0
-- Utility: unify two assignments unionMap m1 m2 = Map.foldlWithKey (\ m2 key value -> m2 >>= (\m2 -> case Map.lookup key m2 of Nothing -> Just $ Map.insert key value m2 Just otherVal -> if otherVal == value then Just $ Map.insert key value m2 else Nothing)) (Just m2) m1
338
unionMap m1 m2 = Map.foldlWithKey (\ m2 key value -> m2 >>= (\m2 -> case Map.lookup key m2 of Nothing -> Just $ Map.insert key value m2 Just otherVal -> if otherVal == value then Just $ Map.insert key value m2 else Nothing)) (Just m2) m1
304
unionMap m1 m2 = Map.foldlWithKey (\ m2 key value -> m2 >>= (\m2 -> case Map.lookup key m2 of Nothing -> Just $ Map.insert key value m2 Just otherVal -> if otherVal == value then Just $ Map.insert key value m2 else Nothing)) (Just m2) m1
304
true
false
0
16
117
117
58
59
null
null
bkoropoff/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
-- | Pretty-print a high-level closed Idris term with no information about precedence/associativity prettyImp :: PPOption -- ^^ pretty printing options -> PTerm -- ^^ the term to pretty-print -> Doc OutputAnnotation prettyImp impl = pprintPTerm impl [] [] []
278
prettyImp :: PPOption -- ^^ pretty printing options -> PTerm -- ^^ the term to pretty-print -> Doc OutputAnnotation prettyImp impl = pprintPTerm impl [] [] []
178
prettyImp impl = pprintPTerm impl [] [] []
42
true
true
0
7
59
43
22
21
null
null
mgsloan/compconfig
env/src/Focus.hs
mit
lockWorkspaceSwitching :: XX () lockWorkspaceSwitching = toXX $ State.put SwitchingLocked
89
lockWorkspaceSwitching :: XX () lockWorkspaceSwitching = toXX $ State.put SwitchingLocked
89
lockWorkspaceSwitching = toXX $ State.put SwitchingLocked
57
false
true
0
7
9
25
12
13
null
null
beni55/fay
fay-base/src/Data/MutMap.hs
bsd-3-clause
mutKeysI :: MutMap a -> Fay [Salted] mutKeysI = ffi "function() { var r = []; for (var k in %1) { r.push(k); } return r; }()"
125
mutKeysI :: MutMap a -> Fay [Salted] mutKeysI = ffi "function() { var r = []; for (var k in %1) { r.push(k); } return r; }()"
125
mutKeysI = ffi "function() { var r = []; for (var k in %1) { r.push(k); } return r; }()"
88
false
true
0
8
26
33
14
19
null
null
facebookincubator/duckling
Duckling/Rules.hs
bsd-3-clause
defaultRules VI = VIRules.defaultRules
38
defaultRules VI = VIRules.defaultRules
38
defaultRules VI = VIRules.defaultRules
38
false
false
0
5
3
11
5
6
null
null
jspahrsummers/RxHaskell
Signal/Subscriber.hs
mit
acquireSubscriber :: Subscriber s v -> ThreadId -> STM Bool acquireSubscriber sub tid = do d <- readTVar (disposed sub) if d then return False else do -- TODO: Skip all this synchronization for singleton scheduler types. tlc <- readTVar (threadLockCounter sub) lt <- readTVar (lockedThread sub) when (tlc > 0 && lt /= tid) retry writeTVar (lockedThread sub) tid writeTVar (threadLockCounter sub) $ tlc + 1 return True -- | Releases a subscriber from the specified thread's ownership. -- -- This must match a previous call to 'acquireSubscriber'.
657
acquireSubscriber :: Subscriber s v -> ThreadId -> STM Bool acquireSubscriber sub tid = do d <- readTVar (disposed sub) if d then return False else do -- TODO: Skip all this synchronization for singleton scheduler types. tlc <- readTVar (threadLockCounter sub) lt <- readTVar (lockedThread sub) when (tlc > 0 && lt /= tid) retry writeTVar (lockedThread sub) tid writeTVar (threadLockCounter sub) $ tlc + 1 return True -- | Releases a subscriber from the specified thread's ownership. -- -- This must match a previous call to 'acquireSubscriber'.
657
acquireSubscriber sub tid = do d <- readTVar (disposed sub) if d then return False else do -- TODO: Skip all this synchronization for singleton scheduler types. tlc <- readTVar (threadLockCounter sub) lt <- readTVar (lockedThread sub) when (tlc > 0 && lt /= tid) retry writeTVar (lockedThread sub) tid writeTVar (threadLockCounter sub) $ tlc + 1 return True -- | Releases a subscriber from the specified thread's ownership. -- -- This must match a previous call to 'acquireSubscriber'.
597
false
true
0
14
200
161
75
86
null
null
sopvop/cabal
cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs
bsd-3-clause
-- | Package databases for testing @pkg-config@ dependencies. dbPC1 :: ExampleDb dbPC1 = [ Right $ exAv "A" 1 [ExPkg ("pkgA", 1)] , Right $ exAv "B" 1 [ExPkg ("pkgB", 1), ExAny "A"] , Right $ exAv "B" 2 [ExPkg ("pkgB", 2), ExAny "A"] , Right $ exAv "C" 1 [ExAny "B"] ]
280
dbPC1 :: ExampleDb dbPC1 = [ Right $ exAv "A" 1 [ExPkg ("pkgA", 1)] , Right $ exAv "B" 1 [ExPkg ("pkgB", 1), ExAny "A"] , Right $ exAv "B" 2 [ExPkg ("pkgB", 2), ExAny "A"] , Right $ exAv "C" 1 [ExAny "B"] ]
218
dbPC1 = [ Right $ exAv "A" 1 [ExPkg ("pkgA", 1)] , Right $ exAv "B" 1 [ExPkg ("pkgB", 1), ExAny "A"] , Right $ exAv "B" 2 [ExPkg ("pkgB", 2), ExAny "A"] , Right $ exAv "C" 1 [ExAny "B"] ]
199
true
true
0
11
64
129
66
63
null
null
DominikDitoIvosevic/Uni
IRG/src/Irg/Lab1/Geometry/Vector.hs
mit
fromHomogeneus :: Fractional a => Vector a -> Vector a fromHomogeneus vec = (/ V.last vec) <$> V.init vec
105
fromHomogeneus :: Fractional a => Vector a -> Vector a fromHomogeneus vec = (/ V.last vec) <$> V.init vec
105
fromHomogeneus vec = (/ V.last vec) <$> V.init vec
50
false
true
0
8
18
49
23
26
null
null
zhangjiji/real-world-haskell
ch6/JSONClass.hs
mit
whenRight :: (b -> c) -> Either a b -> Either a c whenRight _ (Left a) = Left a
79
whenRight :: (b -> c) -> Either a b -> Either a c whenRight _ (Left a) = Left a
79
whenRight _ (Left a) = Left a
29
false
true
0
7
19
50
24
26
null
null
quyse/flaw
flaw-lmdb/Flaw/Data/Lmdb.hs
mit
-- | Open LMDB environment. lmdbOpen :: T.Text -> Word64 -> IO (Lmdb, IO ()) lmdbOpen fileName mapSize = withSpecialBook $ \bk -> do -- create env envPtr <- alloca $ \envPtrPtr -> do lmdbCheckError $ mdb_env_create envPtrPtr peek envPtrPtr book bk $ return ((), mdb_env_close envPtr) -- set memory map size lmdbCheckError $ mdb_env_set_mapsize envPtr (fromIntegral mapSize) -- open env lmdbCheckError $ B.useAsCString (T.encodeUtf8 fileName) $ \fileNamePtr -> mdb_env_open envPtr fileNamePtr (MDB_NOSUBDIR .|. MDB_WRITEMAP .|. MDB_NOSYNC .|. MDB_NOTLS) 0o644 -- open database dbi <- let acquire = alloca $ \txnPtrPtr -> do lmdbCheckError $ mdb_txn_begin envPtr nullPtr MDB_RDONLY txnPtrPtr peek txnPtrPtr in bracketOnError acquire mdb_txn_abort $ \txnPtr -> do dbi <- alloca $ \dbiPtr -> do lmdbCheckError $ mdb_dbi_open txnPtr nullPtr MDB_CREATE dbiPtr peek dbiPtr lmdbCheckError $ mdb_txn_commit txnPtr return dbi book bk $ return ((), mdb_dbi_close envPtr dbi) -- create flow flow <- book bk newFlowOS return Lmdb { lmdbEnvPtr = envPtr , lmdbDbi = dbi , lmdbFlow = flow } -- | Run read transaction.
1,215
lmdbOpen :: T.Text -> Word64 -> IO (Lmdb, IO ()) lmdbOpen fileName mapSize = withSpecialBook $ \bk -> do -- create env envPtr <- alloca $ \envPtrPtr -> do lmdbCheckError $ mdb_env_create envPtrPtr peek envPtrPtr book bk $ return ((), mdb_env_close envPtr) -- set memory map size lmdbCheckError $ mdb_env_set_mapsize envPtr (fromIntegral mapSize) -- open env lmdbCheckError $ B.useAsCString (T.encodeUtf8 fileName) $ \fileNamePtr -> mdb_env_open envPtr fileNamePtr (MDB_NOSUBDIR .|. MDB_WRITEMAP .|. MDB_NOSYNC .|. MDB_NOTLS) 0o644 -- open database dbi <- let acquire = alloca $ \txnPtrPtr -> do lmdbCheckError $ mdb_txn_begin envPtr nullPtr MDB_RDONLY txnPtrPtr peek txnPtrPtr in bracketOnError acquire mdb_txn_abort $ \txnPtr -> do dbi <- alloca $ \dbiPtr -> do lmdbCheckError $ mdb_dbi_open txnPtr nullPtr MDB_CREATE dbiPtr peek dbiPtr lmdbCheckError $ mdb_txn_commit txnPtr return dbi book bk $ return ((), mdb_dbi_close envPtr dbi) -- create flow flow <- book bk newFlowOS return Lmdb { lmdbEnvPtr = envPtr , lmdbDbi = dbi , lmdbFlow = flow } -- | Run read transaction.
1,187
lmdbOpen fileName mapSize = withSpecialBook $ \bk -> do -- create env envPtr <- alloca $ \envPtrPtr -> do lmdbCheckError $ mdb_env_create envPtrPtr peek envPtrPtr book bk $ return ((), mdb_env_close envPtr) -- set memory map size lmdbCheckError $ mdb_env_set_mapsize envPtr (fromIntegral mapSize) -- open env lmdbCheckError $ B.useAsCString (T.encodeUtf8 fileName) $ \fileNamePtr -> mdb_env_open envPtr fileNamePtr (MDB_NOSUBDIR .|. MDB_WRITEMAP .|. MDB_NOSYNC .|. MDB_NOTLS) 0o644 -- open database dbi <- let acquire = alloca $ \txnPtrPtr -> do lmdbCheckError $ mdb_txn_begin envPtr nullPtr MDB_RDONLY txnPtrPtr peek txnPtrPtr in bracketOnError acquire mdb_txn_abort $ \txnPtr -> do dbi <- alloca $ \dbiPtr -> do lmdbCheckError $ mdb_dbi_open txnPtr nullPtr MDB_CREATE dbiPtr peek dbiPtr lmdbCheckError $ mdb_txn_commit txnPtr return dbi book bk $ return ((), mdb_dbi_close envPtr dbi) -- create flow flow <- book bk newFlowOS return Lmdb { lmdbEnvPtr = envPtr , lmdbDbi = dbi , lmdbFlow = flow } -- | Run read transaction.
1,138
true
true
0
22
281
364
175
189
null
null
edsko/cabal
Cabal/src/Distribution/Simple/Utils.hs
bsd-3-clause
topHandlerWith :: forall a. (Exception.SomeException -> IO a) -> IO a -> IO a topHandlerWith cont prog = Exception.catches prog [ Exception.Handler rethrowAsyncExceptions , Exception.Handler rethrowExitStatus , Exception.Handler handle ] where -- Let async exceptions rise to the top for the default top-handler rethrowAsyncExceptions :: Exception.AsyncException -> IO a rethrowAsyncExceptions = throwIO -- ExitCode gets thrown asynchronously too, and we don't want to print it rethrowExitStatus :: ExitCode -> IO a rethrowExitStatus = throwIO -- Print all other exceptions handle :: Exception.SomeException -> IO a handle se = do hFlush stdout pname <- getProgName hPutStr stderr (message pname se) cont se message :: String -> Exception.SomeException -> String message pname (Exception.SomeException se) = case cast se :: Maybe Exception.IOException of Just ioe -> let file = case ioeGetFileName ioe of Nothing -> "" Just path -> path ++ location ++ ": " location = case ioeGetLocation ioe of l@(n:_) | Char.isDigit n -> ':' : l _ -> "" detail = ioeGetErrorString ioe in wrapText (pname ++ ": " ++ file ++ detail) Nothing -> #if __GLASGOW_HASKELL__ < 710 show se #else Exception.displayException se #endif
1,567
topHandlerWith :: forall a. (Exception.SomeException -> IO a) -> IO a -> IO a topHandlerWith cont prog = Exception.catches prog [ Exception.Handler rethrowAsyncExceptions , Exception.Handler rethrowExitStatus , Exception.Handler handle ] where -- Let async exceptions rise to the top for the default top-handler rethrowAsyncExceptions :: Exception.AsyncException -> IO a rethrowAsyncExceptions = throwIO -- ExitCode gets thrown asynchronously too, and we don't want to print it rethrowExitStatus :: ExitCode -> IO a rethrowExitStatus = throwIO -- Print all other exceptions handle :: Exception.SomeException -> IO a handle se = do hFlush stdout pname <- getProgName hPutStr stderr (message pname se) cont se message :: String -> Exception.SomeException -> String message pname (Exception.SomeException se) = case cast se :: Maybe Exception.IOException of Just ioe -> let file = case ioeGetFileName ioe of Nothing -> "" Just path -> path ++ location ++ ": " location = case ioeGetLocation ioe of l@(n:_) | Char.isDigit n -> ':' : l _ -> "" detail = ioeGetErrorString ioe in wrapText (pname ++ ": " ++ file ++ detail) Nothing -> #if __GLASGOW_HASKELL__ < 710 show se #else Exception.displayException se #endif
1,567
topHandlerWith cont prog = Exception.catches prog [ Exception.Handler rethrowAsyncExceptions , Exception.Handler rethrowExitStatus , Exception.Handler handle ] where -- Let async exceptions rise to the top for the default top-handler rethrowAsyncExceptions :: Exception.AsyncException -> IO a rethrowAsyncExceptions = throwIO -- ExitCode gets thrown asynchronously too, and we don't want to print it rethrowExitStatus :: ExitCode -> IO a rethrowExitStatus = throwIO -- Print all other exceptions handle :: Exception.SomeException -> IO a handle se = do hFlush stdout pname <- getProgName hPutStr stderr (message pname se) cont se message :: String -> Exception.SomeException -> String message pname (Exception.SomeException se) = case cast se :: Maybe Exception.IOException of Just ioe -> let file = case ioeGetFileName ioe of Nothing -> "" Just path -> path ++ location ++ ": " location = case ioeGetLocation ioe of l@(n:_) | Char.isDigit n -> ':' : l _ -> "" detail = ioeGetErrorString ioe in wrapText (pname ++ ": " ++ file ++ detail) Nothing -> #if __GLASGOW_HASKELL__ < 710 show se #else Exception.displayException se #endif
1,489
false
true
32
10
544
352
182
170
null
null
hbrouwer/pdrt-sandbox
src/Data/DRS/Translate.hs
apache-2.0
drsConsToMFOL (c:cs) w = F.And (drsConsToMFOL [c] w) (drsConsToMFOL cs w)
79
drsConsToMFOL (c:cs) w = F.And (drsConsToMFOL [c] w) (drsConsToMFOL cs w)
79
drsConsToMFOL (c:cs) w = F.And (drsConsToMFOL [c] w) (drsConsToMFOL cs w)
79
false
false
0
8
16
44
22
22
null
null
gridaphobe/ghc
compiler/main/HscTypes.hs
bsd-3-clause
tyThingTyCon :: TyThing -> TyCon tyThingTyCon (ATyCon tc) = tc
62
tyThingTyCon :: TyThing -> TyCon tyThingTyCon (ATyCon tc) = tc
62
tyThingTyCon (ATyCon tc) = tc
29
false
true
0
7
9
24
12
12
null
null
olsner/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
callishOp FloatExpOp = Just MO_F32_Exp
41
callishOp FloatExpOp = Just MO_F32_Exp
41
callishOp FloatExpOp = Just MO_F32_Exp
41
false
false
1
5
7
16
5
11
null
null
JacquesCarette/literate-scientific-software
code/drasil-gool/GOOL/Drasil/LanguageRenderer/LanguagePolymorphic.hs
bsd-2-clause
-- Types -- bool :: (RenderSym repr) => VS (repr (Type repr)) bool = toState $ typeFromData Boolean "Boolean" (text "Boolean")
127
bool :: (RenderSym repr) => VS (repr (Type repr)) bool = toState $ typeFromData Boolean "Boolean" (text "Boolean")
114
bool = toState $ typeFromData Boolean "Boolean" (text "Boolean")
64
true
true
2
11
21
59
28
31
null
null
forste/haReFork
refactorer/RefacIntroPattern.hs
bsd-3-clause
inMatch _ [] = False
20
inMatch _ [] = False
20
inMatch _ [] = False
20
false
false
0
6
4
13
6
7
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/HTMLObjectElement.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement.code Mozilla HTMLObjectElement.code documentation> setCode :: (MonadDOM m, ToJSString val) => HTMLObjectElement -> val -> m () setCode self val = liftDOM (self ^. jss "code" (toJSVal val))
270
setCode :: (MonadDOM m, ToJSString val) => HTMLObjectElement -> val -> m () setCode self val = liftDOM (self ^. jss "code" (toJSVal val))
145
setCode self val = liftDOM (self ^. jss "code" (toJSVal val))
61
true
true
0
10
38
66
33
33
null
null
drhodes/jade2hdl
jade-decode/src/Jade/Decode/Util.hs
bsd-3-clause
ok :: a -> Either String a ok x = Right x
41
ok :: a -> Either String a ok x = Right x
41
ok x = Right x
14
false
true
0
7
11
30
13
17
null
null
gaborhermann/marvin
test-suite/Marvin/API/Table/InternalSpec.hs
apache-2.0
differentSizeCol :: NumericColumn Right differentSizeCol = fromList [1,2,3]
75
differentSizeCol :: NumericColumn Right differentSizeCol = fromList [1,2,3]
75
Right differentSizeCol = fromList [1,2,3]
41
false
true
0
6
7
27
14
13
null
null
thalerjonathan/phd
thesis/code/concurrent/sugarscape/SugarScapeSTMTArray/src/Discrete.hs
gpl-3.0
neighbourCells :: Discrete2dCoord -> Bool -> Discrete2d c -> STM [c] neighbourCells coord ic e = do ns <- (neighbours coord ic e) return $ map snd ns ------------------------------------------------------------------------------- -------------------------------------------------------------------------------
363
neighbourCells :: Discrete2dCoord -> Bool -> Discrete2d c -> STM [c] neighbourCells coord ic e = do ns <- (neighbours coord ic e) return $ map snd ns ------------------------------------------------------------------------------- -------------------------------------------------------------------------------
363
neighbourCells coord ic e = do ns <- (neighbours coord ic e) return $ map snd ns ------------------------------------------------------------------------------- -------------------------------------------------------------------------------
246
false
true
0
9
83
70
34
36
null
null
ganeti/ganeti
test/hs/Test/Ganeti/JQueue/Objects.hs
bsd-2-clause
-- | Generates an static, empty job. emptyJob :: (MonadFail m) => m QueuedJob emptyJob = do jid0 <- makeJobId 0 return $ QueuedJob jid0 [] justNoTs justNoTs justNoTs Nothing Nothing -- | Generates a job ID.
211
emptyJob :: (MonadFail m) => m QueuedJob emptyJob = do jid0 <- makeJobId 0 return $ QueuedJob jid0 [] justNoTs justNoTs justNoTs Nothing Nothing -- | Generates a job ID.
174
emptyJob = do jid0 <- makeJobId 0 return $ QueuedJob jid0 [] justNoTs justNoTs justNoTs Nothing Nothing -- | Generates a job ID.
133
true
true
0
10
41
65
30
35
null
null
evancz/cli
src/Develop.hs
bsd-3-clause
getSubExts :: String -> [String] getSubExts fullExtension = if null fullExtension then [] else fullExtension : getSubExts (takeExtensions (drop 1 fullExtension))
174
getSubExts :: String -> [String] getSubExts fullExtension = if null fullExtension then [] else fullExtension : getSubExts (takeExtensions (drop 1 fullExtension))
174
getSubExts fullExtension = if null fullExtension then [] else fullExtension : getSubExts (takeExtensions (drop 1 fullExtension))
141
false
true
2
9
33
61
29
32
null
null
saep/nvim-hs
library/Neovim/Plugin/IPC/Classes.hs
apache-2.0
readSomeMessage :: MonadIO m => TQueue SomeMessage -> m SomeMessage readSomeMessage q = liftIO $ atomically (readTQueue q)
122
readSomeMessage :: MonadIO m => TQueue SomeMessage -> m SomeMessage readSomeMessage q = liftIO $ atomically (readTQueue q)
122
readSomeMessage q = liftIO $ atomically (readTQueue q)
54
false
true
0
8
17
44
20
24
null
null
tolysz/prepare-ghcjs
spec-lts8/cabal/Cabal/Distribution/Simple/BuildTarget.hs
bsd-3-clause
showComponentKind TestKind = "test-suite"
42
showComponentKind TestKind = "test-suite"
42
showComponentKind TestKind = "test-suite"
42
false
false
1
5
4
13
4
9
null
null
tismith/tlisp
src/Primitives.hs
mit
isLispValChar :: LispVal -> Bool isLispValChar (Char _) = True
62
isLispValChar :: LispVal -> Bool isLispValChar (Char _) = True
62
isLispValChar (Char _) = True
29
false
true
0
7
9
24
12
12
null
null
Cahu/krpc-hs
src/KRPCHS/SpaceCenter.hs
gpl-3.0
{- - The current state of the parachute. -} getParachuteState :: KRPCHS.SpaceCenter.Parachute -> RPCContext (KRPCHS.SpaceCenter.ParachuteState) getParachuteState thisArg = do let r = makeRequest "SpaceCenter" "Parachute_get_State" [makeArgument 0 thisArg] res <- sendRequest r processResponse res
310
getParachuteState :: KRPCHS.SpaceCenter.Parachute -> RPCContext (KRPCHS.SpaceCenter.ParachuteState) getParachuteState thisArg = do let r = makeRequest "SpaceCenter" "Parachute_get_State" [makeArgument 0 thisArg] res <- sendRequest r processResponse res
264
getParachuteState thisArg = do let r = makeRequest "SpaceCenter" "Parachute_get_State" [makeArgument 0 thisArg] res <- sendRequest r processResponse res
164
true
true
0
13
47
76
35
41
null
null
DNNX/invariant-functors
src/Data/Functor/Invariant/TH/Internal.hs
bsd-2-clause
-- | Construct a type via curried application. applyTy :: Type -> [Type] -> Type applyTy = foldl' AppT
102
applyTy :: Type -> [Type] -> Type applyTy = foldl' AppT
55
applyTy = foldl' AppT
21
true
true
0
7
18
26
14
12
null
null
jwaldmann/ceta-postproc
CeTA-2.39/generated/Haskell/Data_Bits.hs
lgpl-3.0
(.&.) :: Data.Bits.Bits a => a -> a -> a; (.&.) = (Data.Bits..&.)
65
(.&.) :: Data.Bits.Bits a => a -> a -> a (.&.) = (Data.Bits..&.)
64
(.&.) = (Data.Bits..&.)
23
false
true
1
7
12
46
25
21
null
null
BeautifulDestinations/caret
lib/Caret/BFGS.hs
mit
epsilon :: Double epsilon = 3.0E-8
34
epsilon :: Double epsilon = 3.0E-8
34
epsilon = 3.0E-8
16
false
true
0
4
5
11
6
5
null
null
TomMD/cryptol
cryptol/REPL/Command.hs
bsd-3-clause
nbCommandList :: [CommandDescr] nbCommandList = [ CommandDescr ":type" (ExprArg typeOfCmd) "check the type of an expression" , CommandDescr ":browse" (ExprTypeArg browseCmd) "display the current environment" , CommandDescr ":help" (ExprArg helpCmd) "display a brief description about a built-in operator" , CommandDescr ":set" (OptionArg setOptionCmd) "set an environmental option (:set on its own displays current values)" ]
456
nbCommandList :: [CommandDescr] nbCommandList = [ CommandDescr ":type" (ExprArg typeOfCmd) "check the type of an expression" , CommandDescr ":browse" (ExprTypeArg browseCmd) "display the current environment" , CommandDescr ":help" (ExprArg helpCmd) "display a brief description about a built-in operator" , CommandDescr ":set" (OptionArg setOptionCmd) "set an environmental option (:set on its own displays current values)" ]
456
nbCommandList = [ CommandDescr ":type" (ExprArg typeOfCmd) "check the type of an expression" , CommandDescr ":browse" (ExprTypeArg browseCmd) "display the current environment" , CommandDescr ":help" (ExprArg helpCmd) "display a brief description about a built-in operator" , CommandDescr ":set" (OptionArg setOptionCmd) "set an environmental option (:set on its own displays current values)" ]
424
false
true
0
9
85
85
41
44
null
null
mzero/PlainChanges2
src/PartIII.hs
bsd-3-clause
p3r3 = ringNotes qn [(D, 5), (C, 5), (Bf, 4)]
45
p3r3 = ringNotes qn [(D, 5), (C, 5), (Bf, 4)]
45
p3r3 = ringNotes qn [(D, 5), (C, 5), (Bf, 4)]
45
false
false
1
7
9
41
23
18
null
null
sapek/pandoc
src/Text/Pandoc/Readers/MediaWiki.hs
gpl-2.0
listItem :: Char -> MWParser Blocks listItem c = try $ do extras <- many (try $ char c <* lookAhead listStartChar) if null extras then listItem' c else do skipMany spaceChar first <- concat <$> manyTill listChunk newline rest <- many (try $ string extras *> lookAhead listStartChar *> (concat <$> manyTill listChunk newline)) contents <- parseFromString (many1 $ listItem' c) (unlines (first : rest)) case c of '*' -> return $ B.bulletList contents '#' -> return $ B.orderedList contents ':' -> return $ B.definitionList [(mempty, contents)] _ -> mzero -- The point of this is to handle stuff like -- * {{cite book -- | blah -- | blah -- }} -- * next list item -- which seems to be valid mediawiki.
863
listItem :: Char -> MWParser Blocks listItem c = try $ do extras <- many (try $ char c <* lookAhead listStartChar) if null extras then listItem' c else do skipMany spaceChar first <- concat <$> manyTill listChunk newline rest <- many (try $ string extras *> lookAhead listStartChar *> (concat <$> manyTill listChunk newline)) contents <- parseFromString (many1 $ listItem' c) (unlines (first : rest)) case c of '*' -> return $ B.bulletList contents '#' -> return $ B.orderedList contents ':' -> return $ B.definitionList [(mempty, contents)] _ -> mzero -- The point of this is to handle stuff like -- * {{cite book -- | blah -- | blah -- }} -- * next list item -- which seems to be valid mediawiki.
863
listItem c = try $ do extras <- many (try $ char c <* lookAhead listStartChar) if null extras then listItem' c else do skipMany spaceChar first <- concat <$> manyTill listChunk newline rest <- many (try $ string extras *> lookAhead listStartChar *> (concat <$> manyTill listChunk newline)) contents <- parseFromString (many1 $ listItem' c) (unlines (first : rest)) case c of '*' -> return $ B.bulletList contents '#' -> return $ B.orderedList contents ':' -> return $ B.definitionList [(mempty, contents)] _ -> mzero -- The point of this is to handle stuff like -- * {{cite book -- | blah -- | blah -- }} -- * next list item -- which seems to be valid mediawiki.
827
false
true
2
17
289
250
119
131
null
null
roelvandijk/ftdi
System/FTDI/Utils/Properties.hs
bsd-3-clause
divRndUp2 ∷ Integral α ⇒ α → α → α divRndUp2 x y = let r | mod x y ≡ 0 = 0 | otherwise = 1 in div x y + r
145
divRndUp2 ∷ Integral α ⇒ α → α → α divRndUp2 x y = let r | mod x y ≡ 0 = 0 | otherwise = 1 in div x y + r
145
divRndUp2 x y = let r | mod x y ≡ 0 = 0 | otherwise = 1 in div x y + r
110
false
true
0
13
73
82
35
47
null
null
letsbreelhere/egg
src/Codegen/Util.hs
bsd-3-clause
generateIf :: EType -> AnnExpr -> AnnExpr -> AnnExpr -> Gen Operand generateIf ty p t e = do ifThen <- Gen.addBlock "if.then" ifElse <- Gen.addBlock "if.else" ifExit <- Gen.addBlock "if.exit" predicate <- genOperand p cbr predicate ifThen ifElse activeBlock .= ifThen thenValue <- genOperand t br ifExit ifThen' <- use activeBlock activeBlock .= ifElse elseValue <- genOperand e br ifExit ifElse' <- use activeBlock activeBlock .= ifExit phi (reifyAbstractType ty) [(thenValue, ifThen'), (elseValue, ifElse')]
542
generateIf :: EType -> AnnExpr -> AnnExpr -> AnnExpr -> Gen Operand generateIf ty p t e = do ifThen <- Gen.addBlock "if.then" ifElse <- Gen.addBlock "if.else" ifExit <- Gen.addBlock "if.exit" predicate <- genOperand p cbr predicate ifThen ifElse activeBlock .= ifThen thenValue <- genOperand t br ifExit ifThen' <- use activeBlock activeBlock .= ifElse elseValue <- genOperand e br ifExit ifElse' <- use activeBlock activeBlock .= ifExit phi (reifyAbstractType ty) [(thenValue, ifThen'), (elseValue, ifElse')]
542
generateIf ty p t e = do ifThen <- Gen.addBlock "if.then" ifElse <- Gen.addBlock "if.else" ifExit <- Gen.addBlock "if.exit" predicate <- genOperand p cbr predicate ifThen ifElse activeBlock .= ifThen thenValue <- genOperand t br ifExit ifThen' <- use activeBlock activeBlock .= ifElse elseValue <- genOperand e br ifExit ifElse' <- use activeBlock activeBlock .= ifExit phi (reifyAbstractType ty) [(thenValue, ifThen'), (elseValue, ifElse')]
474
false
true
0
9
107
200
89
111
null
null
HIPERFIT/futhark
src/Futhark/CodeGen/ImpGen/Multicore/Base.hs
isc
decideScheduling :: Imp.Code -> Imp.Scheduling decideScheduling code = if isLoadBalanced code then Imp.Static else Imp.Dynamic
136
decideScheduling :: Imp.Code -> Imp.Scheduling decideScheduling code = if isLoadBalanced code then Imp.Static else Imp.Dynamic
136
decideScheduling code = if isLoadBalanced code then Imp.Static else Imp.Dynamic
89
false
true
0
7
24
41
20
21
null
null
nevrenato/Hets_Fork
CASL/ToSExpr.hs
gpl-2.0
opMapToSExprs :: Sign a e -> OpMap -> [SExpr] opMapToSExprs sign = map (\ (p, t) -> SList [ SSymbol "function" , opIdToSSymbol sign p t , SList $ map sortToSSymbol $ opArgs t , sortToSSymbol $ opRes t ]) . mapSetToList
274
opMapToSExprs :: Sign a e -> OpMap -> [SExpr] opMapToSExprs sign = map (\ (p, t) -> SList [ SSymbol "function" , opIdToSSymbol sign p t , SList $ map sortToSSymbol $ opArgs t , sortToSSymbol $ opRes t ]) . mapSetToList
274
opMapToSExprs sign = map (\ (p, t) -> SList [ SSymbol "function" , opIdToSSymbol sign p t , SList $ map sortToSSymbol $ opArgs t , sortToSSymbol $ opRes t ]) . mapSetToList
228
false
true
0
13
97
97
49
48
null
null
upwawet/vision
src/Utils.hs
gpl-3.0
goodChar ':' = True
19
goodChar ':' = True
19
goodChar ':' = True
19
false
false
0
5
3
9
4
5
null
null
DanielAtSamraksh/h
happy.hs
mit
ppy:: Int -> Bool happy x = isHappy x [] h
42
happy:: Int -> Bool happy x = isHappy x []
42
happy x = isHappy x []
22
false
true
0
7
10
36
14
22
null
null
termite2/tsl
Frontend/Grammar.hs
bsd-3-clause
rule = withPos $ Rule nopos <$> ruleop <*> relexpr
50
rule = withPos $ Rule nopos <$> ruleop <*> relexpr
50
rule = withPos $ Rule nopos <$> ruleop <*> relexpr
50
false
false
0
8
9
21
10
11
null
null
OpenXT/manager
xenmgr-core/Vm/ArgoFirewall.hs
gpl-2.0
ruleToString :: Rule -> String ruleToString (Open f t fp tp) = domain_str f ++ p_str fp ++ " -> " ++ domain_str t ++ p_str tp where domain_str Any = "*" domain_str Dom0 = "0" domain_str (Domid id)= show id domain_str (Vm uuid) = show uuid domain_str Myself = "myself" domain_str MyStubdom = "my-stubdom" domain_str MyselfIfSeamlessTrafficVm = "myself-if-seamless" domain_str SeamlessTrafficVm = "seamless" domain_str (ByType n) = "dom-type=" ++ n domain_str (ByName n) = "dom-name=" ++ n p_str AnyPort = "" p_str (PortNum p) = ':' : (show p) -- -- rule parser --
662
ruleToString :: Rule -> String ruleToString (Open f t fp tp) = domain_str f ++ p_str fp ++ " -> " ++ domain_str t ++ p_str tp where domain_str Any = "*" domain_str Dom0 = "0" domain_str (Domid id)= show id domain_str (Vm uuid) = show uuid domain_str Myself = "myself" domain_str MyStubdom = "my-stubdom" domain_str MyselfIfSeamlessTrafficVm = "myself-if-seamless" domain_str SeamlessTrafficVm = "seamless" domain_str (ByType n) = "dom-type=" ++ n domain_str (ByName n) = "dom-name=" ++ n p_str AnyPort = "" p_str (PortNum p) = ':' : (show p) -- -- rule parser --
662
ruleToString (Open f t fp tp) = domain_str f ++ p_str fp ++ " -> " ++ domain_str t ++ p_str tp where domain_str Any = "*" domain_str Dom0 = "0" domain_str (Domid id)= show id domain_str (Vm uuid) = show uuid domain_str Myself = "myself" domain_str MyStubdom = "my-stubdom" domain_str MyselfIfSeamlessTrafficVm = "myself-if-seamless" domain_str SeamlessTrafficVm = "seamless" domain_str (ByType n) = "dom-type=" ++ n domain_str (ByName n) = "dom-name=" ++ n p_str AnyPort = "" p_str (PortNum p) = ':' : (show p) -- -- rule parser --
631
false
true
11
10
193
214
105
109
null
null
phischu/fragnix
benchmarks/containers/Data.Sequence.hs
bsd-3-clause
addDigits3 :: FingerTree (Node (Node a)) -> Digit (Node a) -> Node a -> Node a -> Node a -> Digit (Node a) -> FingerTree (Node (Node a)) -> FingerTree (Node (Node a)) addDigits3 m1 (One a) b c d (One e) m2 = appendTree2 m1 (node3 a b c) (node2 d e) m2
255
addDigits3 :: FingerTree (Node (Node a)) -> Digit (Node a) -> Node a -> Node a -> Node a -> Digit (Node a) -> FingerTree (Node (Node a)) -> FingerTree (Node (Node a)) addDigits3 m1 (One a) b c d (One e) m2 = appendTree2 m1 (node3 a b c) (node2 d e) m2
255
addDigits3 m1 (One a) b c d (One e) m2 = appendTree2 m1 (node3 a b c) (node2 d e) m2
88
false
true
3
8
57
125
71
54
null
null
brunoczim/PulseLambda
PulseLambda/TokenStream.hs
gpl-3.0
escapeChar :: Char escapeChar = '\\'
36
escapeChar :: Char escapeChar = '\\'
36
escapeChar = '\\'
17
false
true
0
4
5
11
6
5
null
null
acowley/ghc
compiler/nativeGen/Dwarf/Constants.hs
bsd-3-clause
dwarfLineSection = dwarfSection "line"
41
dwarfLineSection = dwarfSection "line"
41
dwarfLineSection = dwarfSection "line"
41
false
false
0
5
6
9
4
5
null
null
scott-fleischman/greek-grammar
haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs
mit
decomposeChar '\x1E92' = "\x005A\x0323"
39
decomposeChar '\x1E92' = "\x005A\x0323"
39
decomposeChar '\x1E92' = "\x005A\x0323"
39
false
false
0
4
3
10
4
6
null
null
comonoidial/ALFIN
Alfin/Analysis.hs
mit
faTerm vs (Case (Eval x) [Apply ys] as) = (MultiRes rs, addUses (zip ys $ repeat OtherArg) $ addUse (Var Ref x) (Applied $ map (vs!) ys) $ mergeUses us) where (rs, us) = unzip $ map (faAlt vs) as
197
faTerm vs (Case (Eval x) [Apply ys] as) = (MultiRes rs, addUses (zip ys $ repeat OtherArg) $ addUse (Var Ref x) (Applied $ map (vs!) ys) $ mergeUses us) where (rs, us) = unzip $ map (faAlt vs) as
197
faTerm vs (Case (Eval x) [Apply ys] as) = (MultiRes rs, addUses (zip ys $ repeat OtherArg) $ addUse (Var Ref x) (Applied $ map (vs!) ys) $ mergeUses us) where (rs, us) = unzip $ map (faAlt vs) as
197
false
false
0
12
41
129
63
66
null
null
chanind/haskell-99-problems
Problem9Spec.hs
mit
main :: IO () main = hspec spec
31
main :: IO () main = hspec spec
31
main = hspec spec
17
false
true
0
7
7
25
10
15
null
null
epost/psc-ide
lib/Purescript/Ide.hs
bsd-3-clause
printModules :: PscIde [Text] printModules = return . M.keys . pscStateModules =<< get
86
printModules :: PscIde [Text] printModules = return . M.keys . pscStateModules =<< get
86
printModules = return . M.keys . pscStateModules =<< get
56
false
true
0
8
12
31
16
15
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_246 x = happyTcHack x happyReduce_358
44
action_246 x = happyTcHack x happyReduce_358
44
action_246 x = happyTcHack x happyReduce_358
44
false
false
0
5
5
14
6
8
null
null
piyush-kurur/yesod
yesod-form/Yesod/Form/Fields.hs
mit
radioFieldList :: (Eq a, RenderMessage master FormMessage, RenderMessage master msg) => [(msg, a)] -> Field sub master a radioFieldList = radioField . optionsPairs
163
radioFieldList :: (Eq a, RenderMessage master FormMessage, RenderMessage master msg) => [(msg, a)] -> Field sub master a radioFieldList = radioField . optionsPairs
163
radioFieldList = radioField . optionsPairs
42
false
true
0
9
22
66
33
33
null
null
ulricha/dsh
src/Database/DSH/Tests/CombinatorTests.hs
bsd-3-clause
prop_list_integer_1 :: (BackendVector b, VectorLang v) => [Integer] -> DSHProperty (v TExpr TExpr) b prop_list_integer_1 = makePropEq id id
139
prop_list_integer_1 :: (BackendVector b, VectorLang v) => [Integer] -> DSHProperty (v TExpr TExpr) b prop_list_integer_1 = makePropEq id id
139
prop_list_integer_1 = makePropEq id id
38
false
true
0
10
18
56
27
29
null
null
beni55/cryptol
src/Cryptol/REPL/Monad.hs
bsd-3-clause
getTSyns :: REPL (Map.Map P.QName T.TySyn) getTSyns = do (decls,_) <- getFocusedEnv return (keepOne "getTSyns" `fmap` M.ifTySyns decls)
140
getTSyns :: REPL (Map.Map P.QName T.TySyn) getTSyns = do (decls,_) <- getFocusedEnv return (keepOne "getTSyns" `fmap` M.ifTySyns decls)
140
getTSyns = do (decls,_) <- getFocusedEnv return (keepOne "getTSyns" `fmap` M.ifTySyns decls)
97
false
true
2
12
22
71
32
39
null
null
facebook/Haxl
Haxl/Core/Monad.hs
bsd-3-clause
-- | Returns a version of the Haxl computation which always uses the -- provided 'Env', ignoring the one specified by 'runHaxl'. withEnv :: Env u w -> GenHaxl u w a -> GenHaxl u w a withEnv newEnv (GenHaxl m) = GenHaxl $ \_env -> do r <- m newEnv case r of Done a -> return (Done a) Throw e -> return (Throw e) Blocked ivar k -> return (Blocked ivar (Cont (withEnv newEnv (toHaxl k))))
407
withEnv :: Env u w -> GenHaxl u w a -> GenHaxl u w a withEnv newEnv (GenHaxl m) = GenHaxl $ \_env -> do r <- m newEnv case r of Done a -> return (Done a) Throw e -> return (Throw e) Blocked ivar k -> return (Blocked ivar (Cont (withEnv newEnv (toHaxl k))))
278
withEnv newEnv (GenHaxl m) = GenHaxl $ \_env -> do r <- m newEnv case r of Done a -> return (Done a) Throw e -> return (Throw e) Blocked ivar k -> return (Blocked ivar (Cont (withEnv newEnv (toHaxl k))))
225
true
true
0
20
99
155
73
82
null
null
roberth/uu-helium
test/correct/EqSyn.hs
gpl-3.0
x :: X x = Just 3
17
x :: X x = Just 3
17
x = Just 3
10
false
true
0
6
6
20
8
12
null
null
tjakway/ghcjvm
compiler/prelude/PrelNames.hs
bsd-3-clause
gHC_FLOAT = mkBaseModule (fsLit "GHC.Float")
50
gHC_FLOAT = mkBaseModule (fsLit "GHC.Float")
50
gHC_FLOAT = mkBaseModule (fsLit "GHC.Float")
50
false
false
0
7
10
15
7
8
null
null
dysinger/amazonka
amazonka-cognito-identity/gen/Network/AWS/CognitoIdentity/GetCredentialsForIdentity.hs
mpl-2.0
-- | 'GetCredentialsForIdentityResponse' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'gcfirCredentials' @::@ 'Maybe' 'Credentials' -- -- * 'gcfirIdentityId' @::@ 'Maybe' 'Text' -- getCredentialsForIdentityResponse :: GetCredentialsForIdentityResponse getCredentialsForIdentityResponse = GetCredentialsForIdentityResponse { _gcfirIdentityId = Nothing , _gcfirCredentials = Nothing }
433
getCredentialsForIdentityResponse :: GetCredentialsForIdentityResponse getCredentialsForIdentityResponse = GetCredentialsForIdentityResponse { _gcfirIdentityId = Nothing , _gcfirCredentials = Nothing }
214
getCredentialsForIdentityResponse = GetCredentialsForIdentityResponse { _gcfirIdentityId = Nothing , _gcfirCredentials = Nothing }
143
true
true
0
7
55
37
24
13
null
null
A1kmm/declarative-fieldml-prototype
src/Data/FieldML/Level1ToLevel2.hs
bsd-3-clause
translateDomainExpressionCrossScope scope _ nsid (L1.L1DomainExpressionLambda ss dh dexpr) = do let processDomainHeadMember (scope, sd, su) (L1.L1DHMScopedDomain name kind) = do sdid <- setScopedDomainName (L1.l1ScopedIdBS name) . L2.l2NextScopedDomainID <$> getL2Model modifyL2Model $ \mod -> mod { L2.l2NextScopedDomainID = (\(L2.L2ScopedDomainID _ v) -> L2.L2ScopedDomainID "!unknown" (v + 1)) sdid } return (scope { siDomainIDMap = M.insert name sdid (siDomainIDMap scope) }, (sdid, kind) : sd, su) processDomainHeadMember (scope, sd, su) (L1.L1DHMScopedUnit name) = do suid <- setScopedUnitName (L1.l1ScopedIdBS name) . L2.l2NextScopedUnitID <$> getL2Model modifyL2Model $ \mod -> mod { L2.l2NextScopedUnitID = (\(L2.L2ScopedUnitID _ v) -> L2.L2ScopedUnitID "!unknown" (v + 1)) suid } return (scope { siUnitIDMap = M.insert name suid (siUnitIDMap scope) }, sd, suid : su) processDomainHeadMember x _ = return x (scope', scopedDomains, scopedUnits) <- foldM processDomainHeadMember (scope, [], []) dh let processDomainHeadMember' (uc, de, dr) (L1.L1DHMUnitConstraint uex1 uex2) = do uex1' <- translateUnitExpression scope' ss nsid uex1 uex2' <- translateUnitExpression scope' ss nsid uex2 return ((uex1', uex2'):uc, de, dr) processDomainHeadMember' (uc, de, dr) (L1.L1DHMEquality dex1 dex2) = do dex1' <- translateDomainExpression scope' ss nsid dex1 dex2' <- translateDomainExpression scope' ss nsid dex2 return (uc, (dex1', dex2'):de, dr) processDomainHeadMember' (uc, de, dr) (L1.L1DHMRelation classex args) = do l2ClassEx <- translateClassExpression scope' ss nsid classex args' <- mapM (translateDomainExpression scope' ss nsid) args return (uc, de, (l2ClassEx, args'):dr) processDomainHeadMember' x _ = return x (uConstrs, dEqs, dRels) <- foldM processDomainHeadMember' ([], [], []) dh dexpr2 <- translateDomainExpression scope' ss nsid dexpr return $ (L2.L2DomainExpressionLambda ss scopedDomains scopedUnits uConstrs dEqs dRels dexpr2, scope') -- | Translates an L1ClassExpression into an L2ClassExpression
2,232
translateDomainExpressionCrossScope scope _ nsid (L1.L1DomainExpressionLambda ss dh dexpr) = do let processDomainHeadMember (scope, sd, su) (L1.L1DHMScopedDomain name kind) = do sdid <- setScopedDomainName (L1.l1ScopedIdBS name) . L2.l2NextScopedDomainID <$> getL2Model modifyL2Model $ \mod -> mod { L2.l2NextScopedDomainID = (\(L2.L2ScopedDomainID _ v) -> L2.L2ScopedDomainID "!unknown" (v + 1)) sdid } return (scope { siDomainIDMap = M.insert name sdid (siDomainIDMap scope) }, (sdid, kind) : sd, su) processDomainHeadMember (scope, sd, su) (L1.L1DHMScopedUnit name) = do suid <- setScopedUnitName (L1.l1ScopedIdBS name) . L2.l2NextScopedUnitID <$> getL2Model modifyL2Model $ \mod -> mod { L2.l2NextScopedUnitID = (\(L2.L2ScopedUnitID _ v) -> L2.L2ScopedUnitID "!unknown" (v + 1)) suid } return (scope { siUnitIDMap = M.insert name suid (siUnitIDMap scope) }, sd, suid : su) processDomainHeadMember x _ = return x (scope', scopedDomains, scopedUnits) <- foldM processDomainHeadMember (scope, [], []) dh let processDomainHeadMember' (uc, de, dr) (L1.L1DHMUnitConstraint uex1 uex2) = do uex1' <- translateUnitExpression scope' ss nsid uex1 uex2' <- translateUnitExpression scope' ss nsid uex2 return ((uex1', uex2'):uc, de, dr) processDomainHeadMember' (uc, de, dr) (L1.L1DHMEquality dex1 dex2) = do dex1' <- translateDomainExpression scope' ss nsid dex1 dex2' <- translateDomainExpression scope' ss nsid dex2 return (uc, (dex1', dex2'):de, dr) processDomainHeadMember' (uc, de, dr) (L1.L1DHMRelation classex args) = do l2ClassEx <- translateClassExpression scope' ss nsid classex args' <- mapM (translateDomainExpression scope' ss nsid) args return (uc, de, (l2ClassEx, args'):dr) processDomainHeadMember' x _ = return x (uConstrs, dEqs, dRels) <- foldM processDomainHeadMember' ([], [], []) dh dexpr2 <- translateDomainExpression scope' ss nsid dexpr return $ (L2.L2DomainExpressionLambda ss scopedDomains scopedUnits uConstrs dEqs dRels dexpr2, scope') -- | Translates an L1ClassExpression into an L2ClassExpression
2,232
translateDomainExpressionCrossScope scope _ nsid (L1.L1DomainExpressionLambda ss dh dexpr) = do let processDomainHeadMember (scope, sd, su) (L1.L1DHMScopedDomain name kind) = do sdid <- setScopedDomainName (L1.l1ScopedIdBS name) . L2.l2NextScopedDomainID <$> getL2Model modifyL2Model $ \mod -> mod { L2.l2NextScopedDomainID = (\(L2.L2ScopedDomainID _ v) -> L2.L2ScopedDomainID "!unknown" (v + 1)) sdid } return (scope { siDomainIDMap = M.insert name sdid (siDomainIDMap scope) }, (sdid, kind) : sd, su) processDomainHeadMember (scope, sd, su) (L1.L1DHMScopedUnit name) = do suid <- setScopedUnitName (L1.l1ScopedIdBS name) . L2.l2NextScopedUnitID <$> getL2Model modifyL2Model $ \mod -> mod { L2.l2NextScopedUnitID = (\(L2.L2ScopedUnitID _ v) -> L2.L2ScopedUnitID "!unknown" (v + 1)) suid } return (scope { siUnitIDMap = M.insert name suid (siUnitIDMap scope) }, sd, suid : su) processDomainHeadMember x _ = return x (scope', scopedDomains, scopedUnits) <- foldM processDomainHeadMember (scope, [], []) dh let processDomainHeadMember' (uc, de, dr) (L1.L1DHMUnitConstraint uex1 uex2) = do uex1' <- translateUnitExpression scope' ss nsid uex1 uex2' <- translateUnitExpression scope' ss nsid uex2 return ((uex1', uex2'):uc, de, dr) processDomainHeadMember' (uc, de, dr) (L1.L1DHMEquality dex1 dex2) = do dex1' <- translateDomainExpression scope' ss nsid dex1 dex2' <- translateDomainExpression scope' ss nsid dex2 return (uc, (dex1', dex2'):de, dr) processDomainHeadMember' (uc, de, dr) (L1.L1DHMRelation classex args) = do l2ClassEx <- translateClassExpression scope' ss nsid classex args' <- mapM (translateDomainExpression scope' ss nsid) args return (uc, de, (l2ClassEx, args'):dr) processDomainHeadMember' x _ = return x (uConstrs, dEqs, dRels) <- foldM processDomainHeadMember' ([], [], []) dh dexpr2 <- translateDomainExpression scope' ss nsid dexpr return $ (L2.L2DomainExpressionLambda ss scopedDomains scopedUnits uConstrs dEqs dRels dexpr2, scope') -- | Translates an L1ClassExpression into an L2ClassExpression
2,232
false
false
0
21
472
762
391
371
null
null
alexander-at-github/eta
libraries/base/GHC/List.hs
bsd-3-clause
minimum xs = foldl1 min xs
40
minimum xs = foldl1 min xs
40
minimum xs = foldl1 min xs
40
false
false
1
5
19
19
6
13
null
null
andrewthad/vinyl-vectors
src/Data/Vector/Vinyl/Default/NonEmpty/Monomorphic.hs
bsd-3-clause
-- Monadic initialisation -- ---------------------- -- | /O(n)/ Execute the monadic action the given number of times and store the -- results in a vector. replicateM :: (Monad m, G.Vector Vector (Rec Identity rs)) => Int -> m (Rec Identity rs) -> m (Vector (Rec Identity rs)) replicateM = G.replicateM
304
replicateM :: (Monad m, G.Vector Vector (Rec Identity rs)) => Int -> m (Rec Identity rs) -> m (Vector (Rec Identity rs)) replicateM = G.replicateM
148
replicateM = G.replicateM
25
true
true
0
13
52
86
43
43
null
null
psandahl/outdoor-terrain
src/TerrainGen.hs
bsd-3-clause
mapColor :: Image PixelRGB8 -> Int -> Int -> V3 GLfloat mapColor img x y = let PixelRGB8 red green blue = pixelAt img x y toColor c = fromIntegral c / 255.0 in V3 (toColor red) (toColor green) (toColor blue)
223
mapColor :: Image PixelRGB8 -> Int -> Int -> V3 GLfloat mapColor img x y = let PixelRGB8 red green blue = pixelAt img x y toColor c = fromIntegral c / 255.0 in V3 (toColor red) (toColor green) (toColor blue)
223
mapColor img x y = let PixelRGB8 red green blue = pixelAt img x y toColor c = fromIntegral c / 255.0 in V3 (toColor red) (toColor green) (toColor blue)
167
false
true
0
10
56
102
47
55
null
null
mightybyte/reflex-dom-stubs
src/GHCJS/DOM/HTMLTextAreaElement.hs
bsd-3-clause
ghcjs_dom_html_text_area_element_get_text_length = undefined
60
ghcjs_dom_html_text_area_element_get_text_length = undefined
60
ghcjs_dom_html_text_area_element_get_text_length = undefined
60
false
false
0
4
2
6
3
3
null
null
ekmett/hmpfr
src/Data/Number/MPFR/Special.hs
bsd-3-clause
eint_ :: RoundMode -> Precision -> MPFR -> (MPFR, Int) eint_ r p d = withMPFR r p d mpfr_eint
99
eint_ :: RoundMode -> Precision -> MPFR -> (MPFR, Int) eint_ r p d = withMPFR r p d mpfr_eint
99
eint_ r p d = withMPFR r p d mpfr_eint
38
false
true
0
8
25
45
23
22
null
null
dmbarbour/awelon
hsrc_util/ShowEnv.hs
bsd-3-clause
showStack n (P v s) = showStack (n-1) s . showChar '|' . summarize v . showChar '\n'
92
showStack n (P v s) = showStack (n-1) s . showChar '|' . summarize v . showChar '\n'
92
showStack n (P v s) = showStack (n-1) s . showChar '|' . summarize v . showChar '\n'
92
false
false
2
6
25
57
24
33
null
null
fmapfmapfmap/amazonka
amazonka-cloudhsm/gen/Network/AWS/CloudHSM/CreateHSM.hs
mpl-2.0
-- | The response status code. chrsResponseStatus :: Lens' CreateHSMResponse Int chrsResponseStatus = lens _chrsResponseStatus (\ s a -> s{_chrsResponseStatus = a})
164
chrsResponseStatus :: Lens' CreateHSMResponse Int chrsResponseStatus = lens _chrsResponseStatus (\ s a -> s{_chrsResponseStatus = a})
133
chrsResponseStatus = lens _chrsResponseStatus (\ s a -> s{_chrsResponseStatus = a})
83
true
true
0
9
21
40
22
18
null
null
kainlite/Paradigmas
Haskell/Definiciones.hs
mit
valAbsoluto n = if n > 0 then n else -n
39
valAbsoluto n = if n > 0 then n else -n
39
valAbsoluto n = if n > 0 then n else -n
39
false
false
0
6
10
23
12
11
null
null
AlexanderPankiv/ghc
compiler/hsSyn/HsBinds.hs
bsd-3-clause
isInlineLSig :: LSig name -> Bool -- Identifies inline pragmas isInlineLSig (L _ (InlineSig {})) = True
103
isInlineLSig :: LSig name -> Bool isInlineLSig (L _ (InlineSig {})) = True
74
isInlineLSig (L _ (InlineSig {})) = True
40
true
true
0
9
16
37
19
18
null
null
ideas-edu/ideas
src/Ideas/Common/Environment.hs
apache-2.0
fromBinding :: Typeable a => Binding -> Maybe (Ref a, a) fromBinding (Binding r a) = liftM2 (,) (gcastFrom r r) (castFrom r a)
127
fromBinding :: Typeable a => Binding -> Maybe (Ref a, a) fromBinding (Binding r a) = liftM2 (,) (gcastFrom r r) (castFrom r a)
126
fromBinding (Binding r a) = liftM2 (,) (gcastFrom r r) (castFrom r a)
69
false
true
0
9
24
75
36
39
null
null
kevinbackhouse/Control-Monad-MultiPass
tests/TestCounter.hs
bsd-3-clause
prop_convertTree :: Int -> TestST2 Bool prop_convertTree n = TestST2 $ PureST2 $ do t <- mkExample n t' <- convertTree t evalStateT (checkResult t t') 0 -- Check that the result is correct. This function uses the StateT -- monad transformer to track the current count.
283
prop_convertTree :: Int -> TestST2 Bool prop_convertTree n = TestST2 $ PureST2 $ do t <- mkExample n t' <- convertTree t evalStateT (checkResult t t') 0 -- Check that the result is correct. This function uses the StateT -- monad transformer to track the current count.
283
prop_convertTree n = TestST2 $ PureST2 $ do t <- mkExample n t' <- convertTree t evalStateT (checkResult t t') 0 -- Check that the result is correct. This function uses the StateT -- monad transformer to track the current count.
243
false
true
4
10
61
74
32
42
null
null
triffon/lcpt-2013-14
nbe.hs
mit
value (Lam m) ξ = Function (\a -> value m (a:ξ))
48
value (Lam m) ξ = Function (\a -> value m (a:ξ))
48
value (Lam m) ξ = Function (\a -> value m (a:ξ))
48
false
false
1
10
10
42
20
22
null
null
syanidar/Sophy
src/Search/Evaluation.hs
bsd-3-clause
knightPenalty40 = 0x4281000000008142
36
knightPenalty40 = 0x4281000000008142
36
knightPenalty40 = 0x4281000000008142
36
false
false
0
4
2
6
3
3
null
null
Fermat/Gottlob
Language/ProofChecking.hs
bsd-3-clause
checkFormula (UG x p) = do f <- checkFormula p e <- lift get if isFree x (assumption e) then pcError "Wrong use of universal generalization." [(disp "generalized variable" <+> disp x, disp "appears in the assumptions")] else do ensureForm (Forall x f) return $ (Forall x f)
305
checkFormula (UG x p) = do f <- checkFormula p e <- lift get if isFree x (assumption e) then pcError "Wrong use of universal generalization." [(disp "generalized variable" <+> disp x, disp "appears in the assumptions")] else do ensureForm (Forall x f) return $ (Forall x f)
305
checkFormula (UG x p) = do f <- checkFormula p e <- lift get if isFree x (assumption e) then pcError "Wrong use of universal generalization." [(disp "generalized variable" <+> disp x, disp "appears in the assumptions")] else do ensureForm (Forall x f) return $ (Forall x f)
305
false
false
0
12
79
115
53
62
null
null
geophf/1HaskellADay
exercises/HAD/RID/Tree.hs
mit
-- readIn _ stream@([(1, _)]:_) = (Map.empty, stream) readIn fn lst = let (cat, rest) = fn lst in first (Map.insert (nameof cat) cat) $ readIn fn rest
157
readIn fn lst = let (cat, rest) = fn lst in first (Map.insert (nameof cat) cat) $ readIn fn rest
103
readIn fn lst = let (cat, rest) = fn lst in first (Map.insert (nameof cat) cat) $ readIn fn rest
103
true
false
0
12
34
61
29
32
null
null
Noeda/Megaman
src/NetHack/Data/MonsterInstance.hs
mit
mdCToTermAttributes MD.Gray = T.newAttributes T.White T.Black False False
82
mdCToTermAttributes MD.Gray = T.newAttributes T.White T.Black False False
82
mdCToTermAttributes MD.Gray = T.newAttributes T.White T.Black False False
82
false
false
0
6
16
26
12
14
null
null
josefs/autosar
ARSim/arsim-examples/Examples/ABS.hs
bsd-3-clause
-- | Set this flag to @False@ to disable all task assignments. main :: IO () main = do rng <- newTFGen simulateUsingExternal True rng simulinkABSgood1 -- simulateUsingExternal True rng simulinkABSbad1 return ()
218
main :: IO () main = do rng <- newTFGen simulateUsingExternal True rng simulinkABSgood1 -- simulateUsingExternal True rng simulinkABSbad1 return ()
155
main = do rng <- newTFGen simulateUsingExternal True rng simulinkABSgood1 -- simulateUsingExternal True rng simulinkABSbad1 return ()
141
true
true
0
8
40
43
20
23
null
null
tekul/cryptonite
Crypto/PubKey/RSA/PKCS15.hs
bsd-3-clause
verify :: HashAlgorithmASN1 hashAlg => Maybe hashAlg -> PublicKey -> ByteString -> ByteString -> Bool verify hashAlg pk m sm = case makeSignature hashAlg (public_size pk) m of Left _ -> False Right s -> s == (ep pk sm) -- | make signature digest, used in 'sign' and 'verify'
331
verify :: HashAlgorithmASN1 hashAlg => Maybe hashAlg -> PublicKey -> ByteString -> ByteString -> Bool verify hashAlg pk m sm = case makeSignature hashAlg (public_size pk) m of Left _ -> False Right s -> s == (ep pk sm) -- | make signature digest, used in 'sign' and 'verify'
331
verify hashAlg pk m sm = case makeSignature hashAlg (public_size pk) m of Left _ -> False Right s -> s == (ep pk sm) -- | make signature digest, used in 'sign' and 'verify'
194
false
true
0
10
106
94
45
49
null
null
karknu/rws
src/IPv4.hs
bsd-3-clause
testIPv4Frame :: Packet -> IPv4 testIPv4Frame (PIPv4 p) = ipv4PktHeader p
73
testIPv4Frame :: Packet -> IPv4 testIPv4Frame (PIPv4 p) = ipv4PktHeader p
73
testIPv4Frame (PIPv4 p) = ipv4PktHeader p
41
false
true
0
9
10
32
14
18
null
null
forsyde/forsyde-atom
src/ForSyDe/Atom/MoC/Stream.hs
bsd-3-clause
headS (x :- _) = x
18
headS (x :- _) = x
18
headS (x :- _) = x
18
false
false
0
6
5
17
8
9
null
null
elieux/ghc
compiler/utils/Platform.hs
bsd-3-clause
sARM ArchARM64 = True
25
isARM ArchARM64 = True
25
isARM ArchARM64 = True
25
false
false
1
4
7
12
4
8
null
null
oldmanmike/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
nullAddrIdKey = mkPreludeMiscIdUnique 39
56
nullAddrIdKey = mkPreludeMiscIdUnique 39
56
nullAddrIdKey = mkPreludeMiscIdUnique 39
56
false
false
0
5
19
9
4
5
null
null
sacundim/free-operational
examples/Example.hs
bsd-3-clause
count :: ProgramAp FileSystemI a -> Int count = length . instructions
69
count :: ProgramAp FileSystemI a -> Int count = length . instructions
69
count = length . instructions
29
false
true
0
6
11
24
12
12
null
null
Bolt64/wyas
src/PrimitiveFunctions.hs
mit
isLispString _ ([_]) = return $ LispBool False
46
isLispString _ ([_]) = return $ LispBool False
46
isLispString _ ([_]) = return $ LispBool False
46
false
false
0
7
7
24
12
12
null
null
gleachkr/Carnap
Carnap/src/Carnap/Languages/SetTheory/Parser.hs
gpl-3.0
separativeSetTheoryParser = parserFromOptions separativeSetTheoryOptions
72
separativeSetTheoryParser = parserFromOptions separativeSetTheoryOptions
72
separativeSetTheoryParser = parserFromOptions separativeSetTheoryOptions
72
false
false
0
5
3
9
4
5
null
null
lenary/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
constDocs (Str s) = "A string of length " ++ show (length s)
85
constDocs (Str s) = "A string of length " ++ show (length s)
85
constDocs (Str s) = "A string of length " ++ show (length s)
85
false
false
0
8
37
28
13
15
null
null
sopvop/cabal
Cabal/Distribution/Simple/GHCJS.hs
bsd-3-clause
buildOrReplLib :: Bool -> Verbosity -> Cabal.Flag (Maybe Int) -> PackageDescription -> LocalBuildInfo -> Library -> ComponentLocalBuildInfo -> IO () buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do let uid = componentUnitId clbi libTargetDir = buildDir lbi whenVanillaLib forceVanilla = when (not forRepl && (forceVanilla || withVanillaLib lbi)) whenProfLib = when (not forRepl && withProfLib lbi) whenSharedLib forceShared = when (not forRepl && (forceShared || withSharedLib lbi)) whenGHCiLib = when (not forRepl && withGHCiLib lbi && withVanillaLib lbi) ifReplLib = when forRepl comp = compiler lbi platform = hostPlatform lbi implInfo = getImplInfo comp nativeToo = ghcjsNativeToo comp (ghcjsProg, _) <- requireProgram verbosity ghcjsProgram (withPrograms lbi) let runGhcjsProg = runGHC verbosity ghcjsProg comp platform libBi = libBuildInfo lib isGhcjsDynamic = isDynamic comp dynamicTooSupported = supportsDynamicToo comp doingTH = EnableExtension TemplateHaskell `elem` allExtensions libBi forceVanillaLib = doingTH && not isGhcjsDynamic forceSharedLib = doingTH && isGhcjsDynamic -- TH always needs default libs, even when building for profiling -- Determine if program coverage should be enabled and if so, what -- '-hpcdir' should be. let isCoverageEnabled = libCoverage lbi pkg_name = display $ PD.package pkg_descr distPref = fromFlag $ configDistPref $ configFlags lbi hpcdir way | isCoverageEnabled = toFlag $ Hpc.mixDir distPref way pkg_name | otherwise = mempty createDirectoryIfMissingVerbose verbosity True libTargetDir -- TODO: do we need to put hs-boot files into place for mutually recursive -- modules? let cObjs = map (`replaceExtension` objExtension) (cSources libBi) jsSrcs = jsSources libBi baseOpts = componentGhcOptions verbosity lbi libBi clbi libTargetDir linkJsLibOpts = mempty { ghcOptExtra = toNubListR $ [ "-link-js-lib" , getHSLibraryName uid , "-js-lib-outputdir", libTargetDir ] ++ concatMap (\x -> ["-js-lib-src",x]) jsSrcs } vanillaOptsNoJsLib = baseOpts `mappend` mempty { ghcOptMode = toFlag GhcModeMake, ghcOptNumJobs = numJobs, ghcOptInputModules = toNubListR $ libModules lib, ghcOptHPCDir = hpcdir Hpc.Vanilla } vanillaOpts = vanillaOptsNoJsLib `mappend` linkJsLibOpts profOpts = adjustExts "p_hi" "p_o" vanillaOpts `mappend` mempty { ghcOptProfilingMode = toFlag True, ghcOptExtra = toNubListR $ ghcjsProfOptions libBi, ghcOptHPCDir = hpcdir Hpc.Prof } sharedOpts = adjustExts "dyn_hi" "dyn_o" vanillaOpts `mappend` mempty { ghcOptDynLinkMode = toFlag GhcDynamicOnly, ghcOptFPic = toFlag True, ghcOptExtra = toNubListR $ ghcjsSharedOptions libBi, ghcOptHPCDir = hpcdir Hpc.Dyn } linkerOpts = mempty { ghcOptLinkOptions = toNubListR $ PD.ldOptions libBi, ghcOptLinkLibs = toNubListR $ extraLibs libBi, ghcOptLinkLibPath = toNubListR $ extraLibDirs libBi, ghcOptLinkFrameworks = toNubListR $ PD.frameworks libBi, ghcOptInputFiles = toNubListR $ [libTargetDir </> x | x <- cObjs] ++ jsSrcs } replOpts = vanillaOptsNoJsLib { ghcOptExtra = overNubListR Internal.filterGhciFlags (ghcOptExtra vanillaOpts), ghcOptNumJobs = mempty } `mappend` linkerOpts `mappend` mempty { ghcOptMode = toFlag GhcModeInteractive, ghcOptOptimisation = toFlag GhcNoOptimisation } vanillaSharedOpts = vanillaOpts `mappend` mempty { ghcOptDynLinkMode = toFlag GhcStaticAndDynamic, ghcOptDynHiSuffix = toFlag "dyn_hi", ghcOptDynObjSuffix = toFlag "dyn_o", ghcOptHPCDir = hpcdir Hpc.Dyn } unless (forRepl || (null (libModules lib) && null jsSrcs && null cObjs)) $ do let vanilla = whenVanillaLib forceVanillaLib (runGhcjsProg vanillaOpts) shared = whenSharedLib forceSharedLib (runGhcjsProg sharedOpts) useDynToo = dynamicTooSupported && (forceVanillaLib || withVanillaLib lbi) && (forceSharedLib || withSharedLib lbi) && null (ghcjsSharedOptions libBi) if useDynToo then do runGhcjsProg vanillaSharedOpts case (hpcdir Hpc.Dyn, hpcdir Hpc.Vanilla) of (Cabal.Flag dynDir, Cabal.Flag vanillaDir) -> do -- When the vanilla and shared library builds are done -- in one pass, only one set of HPC module interfaces -- are generated. This set should suffice for both -- static and dynamically linked executables. We copy -- the modules interfaces so they are available under -- both ways. copyDirectoryRecursive verbosity dynDir vanillaDir _ -> return () else if isGhcjsDynamic then do shared; vanilla else do vanilla; shared whenProfLib (runGhcjsProg profOpts) -- build any C sources unless (null (cSources libBi) || not nativeToo) $ do info verbosity "Building C Sources..." sequence_ [ do let vanillaCcOpts = (Internal.componentCcGhcOptions verbosity implInfo lbi libBi clbi libTargetDir filename) profCcOpts = vanillaCcOpts `mappend` mempty { ghcOptProfilingMode = toFlag True, ghcOptObjSuffix = toFlag "p_o" } sharedCcOpts = vanillaCcOpts `mappend` mempty { ghcOptFPic = toFlag True, ghcOptDynLinkMode = toFlag GhcDynamicOnly, ghcOptObjSuffix = toFlag "dyn_o" } odir = fromFlag (ghcOptObjDir vanillaCcOpts) createDirectoryIfMissingVerbose verbosity True odir runGhcjsProg vanillaCcOpts whenSharedLib forceSharedLib (runGhcjsProg sharedCcOpts) whenProfLib (runGhcjsProg profCcOpts) | filename <- cSources libBi] -- TODO: problem here is we need the .c files built first, so we can load them -- with ghci, but .c files can depend on .h files generated by ghc by ffi -- exports. unless (null (libModules lib)) $ ifReplLib (runGhcjsProg replOpts) -- link: when (nativeToo && not forRepl) $ do info verbosity "Linking..." let cProfObjs = map (`replaceExtension` ("p_" ++ objExtension)) (cSources libBi) cSharedObjs = map (`replaceExtension` ("dyn_" ++ objExtension)) (cSources libBi) compiler_id = compilerId (compiler lbi) vanillaLibFilePath = libTargetDir </> mkLibName uid profileLibFilePath = libTargetDir </> mkProfLibName uid sharedLibFilePath = libTargetDir </> mkSharedLibName compiler_id uid ghciLibFilePath = libTargetDir </> Internal.mkGHCiLibName uid hObjs <- Internal.getHaskellObjects implInfo lib lbi libTargetDir objExtension True hProfObjs <- if (withProfLib lbi) then Internal.getHaskellObjects implInfo lib lbi libTargetDir ("p_" ++ objExtension) True else return [] hSharedObjs <- if (withSharedLib lbi) then Internal.getHaskellObjects implInfo lib lbi libTargetDir ("dyn_" ++ objExtension) False else return [] unless (null hObjs && null cObjs) $ do let staticObjectFiles = hObjs ++ map (libTargetDir </>) cObjs profObjectFiles = hProfObjs ++ map (libTargetDir </>) cProfObjs ghciObjFiles = hObjs ++ map (libTargetDir </>) cObjs dynamicObjectFiles = hSharedObjs ++ map (libTargetDir </>) cSharedObjs -- After the relocation lib is created we invoke ghc -shared -- with the dependencies spelled out as -package arguments -- and ghc invokes the linker with the proper library paths ghcSharedLinkArgs = mempty { ghcOptShared = toFlag True, ghcOptDynLinkMode = toFlag GhcDynamicOnly, ghcOptInputFiles = toNubListR dynamicObjectFiles, ghcOptOutputFile = toFlag sharedLibFilePath, ghcOptExtra = toNubListR $ ghcjsSharedOptions libBi, ghcOptNoAutoLinkPackages = toFlag True, ghcOptPackageDBs = withPackageDB lbi, ghcOptPackages = toNubListR $ Internal.mkGhcOptPackages clbi, ghcOptLinkLibs = toNubListR $ extraLibs libBi, ghcOptLinkLibPath = toNubListR $ extraLibDirs libBi } whenVanillaLib False $ do Ar.createArLibArchive verbosity lbi vanillaLibFilePath staticObjectFiles whenProfLib $ do Ar.createArLibArchive verbosity lbi profileLibFilePath profObjectFiles whenGHCiLib $ do (ldProg, _) <- requireProgram verbosity ldProgram (withPrograms lbi) Ld.combineObjectFiles verbosity ldProg ghciLibFilePath ghciObjFiles whenSharedLib False $ runGhcjsProg ghcSharedLinkArgs -- | Start a REPL without loading any source files.
10,941
buildOrReplLib :: Bool -> Verbosity -> Cabal.Flag (Maybe Int) -> PackageDescription -> LocalBuildInfo -> Library -> ComponentLocalBuildInfo -> IO () buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do let uid = componentUnitId clbi libTargetDir = buildDir lbi whenVanillaLib forceVanilla = when (not forRepl && (forceVanilla || withVanillaLib lbi)) whenProfLib = when (not forRepl && withProfLib lbi) whenSharedLib forceShared = when (not forRepl && (forceShared || withSharedLib lbi)) whenGHCiLib = when (not forRepl && withGHCiLib lbi && withVanillaLib lbi) ifReplLib = when forRepl comp = compiler lbi platform = hostPlatform lbi implInfo = getImplInfo comp nativeToo = ghcjsNativeToo comp (ghcjsProg, _) <- requireProgram verbosity ghcjsProgram (withPrograms lbi) let runGhcjsProg = runGHC verbosity ghcjsProg comp platform libBi = libBuildInfo lib isGhcjsDynamic = isDynamic comp dynamicTooSupported = supportsDynamicToo comp doingTH = EnableExtension TemplateHaskell `elem` allExtensions libBi forceVanillaLib = doingTH && not isGhcjsDynamic forceSharedLib = doingTH && isGhcjsDynamic -- TH always needs default libs, even when building for profiling -- Determine if program coverage should be enabled and if so, what -- '-hpcdir' should be. let isCoverageEnabled = libCoverage lbi pkg_name = display $ PD.package pkg_descr distPref = fromFlag $ configDistPref $ configFlags lbi hpcdir way | isCoverageEnabled = toFlag $ Hpc.mixDir distPref way pkg_name | otherwise = mempty createDirectoryIfMissingVerbose verbosity True libTargetDir -- TODO: do we need to put hs-boot files into place for mutually recursive -- modules? let cObjs = map (`replaceExtension` objExtension) (cSources libBi) jsSrcs = jsSources libBi baseOpts = componentGhcOptions verbosity lbi libBi clbi libTargetDir linkJsLibOpts = mempty { ghcOptExtra = toNubListR $ [ "-link-js-lib" , getHSLibraryName uid , "-js-lib-outputdir", libTargetDir ] ++ concatMap (\x -> ["-js-lib-src",x]) jsSrcs } vanillaOptsNoJsLib = baseOpts `mappend` mempty { ghcOptMode = toFlag GhcModeMake, ghcOptNumJobs = numJobs, ghcOptInputModules = toNubListR $ libModules lib, ghcOptHPCDir = hpcdir Hpc.Vanilla } vanillaOpts = vanillaOptsNoJsLib `mappend` linkJsLibOpts profOpts = adjustExts "p_hi" "p_o" vanillaOpts `mappend` mempty { ghcOptProfilingMode = toFlag True, ghcOptExtra = toNubListR $ ghcjsProfOptions libBi, ghcOptHPCDir = hpcdir Hpc.Prof } sharedOpts = adjustExts "dyn_hi" "dyn_o" vanillaOpts `mappend` mempty { ghcOptDynLinkMode = toFlag GhcDynamicOnly, ghcOptFPic = toFlag True, ghcOptExtra = toNubListR $ ghcjsSharedOptions libBi, ghcOptHPCDir = hpcdir Hpc.Dyn } linkerOpts = mempty { ghcOptLinkOptions = toNubListR $ PD.ldOptions libBi, ghcOptLinkLibs = toNubListR $ extraLibs libBi, ghcOptLinkLibPath = toNubListR $ extraLibDirs libBi, ghcOptLinkFrameworks = toNubListR $ PD.frameworks libBi, ghcOptInputFiles = toNubListR $ [libTargetDir </> x | x <- cObjs] ++ jsSrcs } replOpts = vanillaOptsNoJsLib { ghcOptExtra = overNubListR Internal.filterGhciFlags (ghcOptExtra vanillaOpts), ghcOptNumJobs = mempty } `mappend` linkerOpts `mappend` mempty { ghcOptMode = toFlag GhcModeInteractive, ghcOptOptimisation = toFlag GhcNoOptimisation } vanillaSharedOpts = vanillaOpts `mappend` mempty { ghcOptDynLinkMode = toFlag GhcStaticAndDynamic, ghcOptDynHiSuffix = toFlag "dyn_hi", ghcOptDynObjSuffix = toFlag "dyn_o", ghcOptHPCDir = hpcdir Hpc.Dyn } unless (forRepl || (null (libModules lib) && null jsSrcs && null cObjs)) $ do let vanilla = whenVanillaLib forceVanillaLib (runGhcjsProg vanillaOpts) shared = whenSharedLib forceSharedLib (runGhcjsProg sharedOpts) useDynToo = dynamicTooSupported && (forceVanillaLib || withVanillaLib lbi) && (forceSharedLib || withSharedLib lbi) && null (ghcjsSharedOptions libBi) if useDynToo then do runGhcjsProg vanillaSharedOpts case (hpcdir Hpc.Dyn, hpcdir Hpc.Vanilla) of (Cabal.Flag dynDir, Cabal.Flag vanillaDir) -> do -- When the vanilla and shared library builds are done -- in one pass, only one set of HPC module interfaces -- are generated. This set should suffice for both -- static and dynamically linked executables. We copy -- the modules interfaces so they are available under -- both ways. copyDirectoryRecursive verbosity dynDir vanillaDir _ -> return () else if isGhcjsDynamic then do shared; vanilla else do vanilla; shared whenProfLib (runGhcjsProg profOpts) -- build any C sources unless (null (cSources libBi) || not nativeToo) $ do info verbosity "Building C Sources..." sequence_ [ do let vanillaCcOpts = (Internal.componentCcGhcOptions verbosity implInfo lbi libBi clbi libTargetDir filename) profCcOpts = vanillaCcOpts `mappend` mempty { ghcOptProfilingMode = toFlag True, ghcOptObjSuffix = toFlag "p_o" } sharedCcOpts = vanillaCcOpts `mappend` mempty { ghcOptFPic = toFlag True, ghcOptDynLinkMode = toFlag GhcDynamicOnly, ghcOptObjSuffix = toFlag "dyn_o" } odir = fromFlag (ghcOptObjDir vanillaCcOpts) createDirectoryIfMissingVerbose verbosity True odir runGhcjsProg vanillaCcOpts whenSharedLib forceSharedLib (runGhcjsProg sharedCcOpts) whenProfLib (runGhcjsProg profCcOpts) | filename <- cSources libBi] -- TODO: problem here is we need the .c files built first, so we can load them -- with ghci, but .c files can depend on .h files generated by ghc by ffi -- exports. unless (null (libModules lib)) $ ifReplLib (runGhcjsProg replOpts) -- link: when (nativeToo && not forRepl) $ do info verbosity "Linking..." let cProfObjs = map (`replaceExtension` ("p_" ++ objExtension)) (cSources libBi) cSharedObjs = map (`replaceExtension` ("dyn_" ++ objExtension)) (cSources libBi) compiler_id = compilerId (compiler lbi) vanillaLibFilePath = libTargetDir </> mkLibName uid profileLibFilePath = libTargetDir </> mkProfLibName uid sharedLibFilePath = libTargetDir </> mkSharedLibName compiler_id uid ghciLibFilePath = libTargetDir </> Internal.mkGHCiLibName uid hObjs <- Internal.getHaskellObjects implInfo lib lbi libTargetDir objExtension True hProfObjs <- if (withProfLib lbi) then Internal.getHaskellObjects implInfo lib lbi libTargetDir ("p_" ++ objExtension) True else return [] hSharedObjs <- if (withSharedLib lbi) then Internal.getHaskellObjects implInfo lib lbi libTargetDir ("dyn_" ++ objExtension) False else return [] unless (null hObjs && null cObjs) $ do let staticObjectFiles = hObjs ++ map (libTargetDir </>) cObjs profObjectFiles = hProfObjs ++ map (libTargetDir </>) cProfObjs ghciObjFiles = hObjs ++ map (libTargetDir </>) cObjs dynamicObjectFiles = hSharedObjs ++ map (libTargetDir </>) cSharedObjs -- After the relocation lib is created we invoke ghc -shared -- with the dependencies spelled out as -package arguments -- and ghc invokes the linker with the proper library paths ghcSharedLinkArgs = mempty { ghcOptShared = toFlag True, ghcOptDynLinkMode = toFlag GhcDynamicOnly, ghcOptInputFiles = toNubListR dynamicObjectFiles, ghcOptOutputFile = toFlag sharedLibFilePath, ghcOptExtra = toNubListR $ ghcjsSharedOptions libBi, ghcOptNoAutoLinkPackages = toFlag True, ghcOptPackageDBs = withPackageDB lbi, ghcOptPackages = toNubListR $ Internal.mkGhcOptPackages clbi, ghcOptLinkLibs = toNubListR $ extraLibs libBi, ghcOptLinkLibPath = toNubListR $ extraLibDirs libBi } whenVanillaLib False $ do Ar.createArLibArchive verbosity lbi vanillaLibFilePath staticObjectFiles whenProfLib $ do Ar.createArLibArchive verbosity lbi profileLibFilePath profObjectFiles whenGHCiLib $ do (ldProg, _) <- requireProgram verbosity ldProgram (withPrograms lbi) Ld.combineObjectFiles verbosity ldProg ghciLibFilePath ghciObjFiles whenSharedLib False $ runGhcjsProg ghcSharedLinkArgs -- | Start a REPL without loading any source files.
10,941
buildOrReplLib forRepl verbosity numJobs pkg_descr lbi lib clbi = do let uid = componentUnitId clbi libTargetDir = buildDir lbi whenVanillaLib forceVanilla = when (not forRepl && (forceVanilla || withVanillaLib lbi)) whenProfLib = when (not forRepl && withProfLib lbi) whenSharedLib forceShared = when (not forRepl && (forceShared || withSharedLib lbi)) whenGHCiLib = when (not forRepl && withGHCiLib lbi && withVanillaLib lbi) ifReplLib = when forRepl comp = compiler lbi platform = hostPlatform lbi implInfo = getImplInfo comp nativeToo = ghcjsNativeToo comp (ghcjsProg, _) <- requireProgram verbosity ghcjsProgram (withPrograms lbi) let runGhcjsProg = runGHC verbosity ghcjsProg comp platform libBi = libBuildInfo lib isGhcjsDynamic = isDynamic comp dynamicTooSupported = supportsDynamicToo comp doingTH = EnableExtension TemplateHaskell `elem` allExtensions libBi forceVanillaLib = doingTH && not isGhcjsDynamic forceSharedLib = doingTH && isGhcjsDynamic -- TH always needs default libs, even when building for profiling -- Determine if program coverage should be enabled and if so, what -- '-hpcdir' should be. let isCoverageEnabled = libCoverage lbi pkg_name = display $ PD.package pkg_descr distPref = fromFlag $ configDistPref $ configFlags lbi hpcdir way | isCoverageEnabled = toFlag $ Hpc.mixDir distPref way pkg_name | otherwise = mempty createDirectoryIfMissingVerbose verbosity True libTargetDir -- TODO: do we need to put hs-boot files into place for mutually recursive -- modules? let cObjs = map (`replaceExtension` objExtension) (cSources libBi) jsSrcs = jsSources libBi baseOpts = componentGhcOptions verbosity lbi libBi clbi libTargetDir linkJsLibOpts = mempty { ghcOptExtra = toNubListR $ [ "-link-js-lib" , getHSLibraryName uid , "-js-lib-outputdir", libTargetDir ] ++ concatMap (\x -> ["-js-lib-src",x]) jsSrcs } vanillaOptsNoJsLib = baseOpts `mappend` mempty { ghcOptMode = toFlag GhcModeMake, ghcOptNumJobs = numJobs, ghcOptInputModules = toNubListR $ libModules lib, ghcOptHPCDir = hpcdir Hpc.Vanilla } vanillaOpts = vanillaOptsNoJsLib `mappend` linkJsLibOpts profOpts = adjustExts "p_hi" "p_o" vanillaOpts `mappend` mempty { ghcOptProfilingMode = toFlag True, ghcOptExtra = toNubListR $ ghcjsProfOptions libBi, ghcOptHPCDir = hpcdir Hpc.Prof } sharedOpts = adjustExts "dyn_hi" "dyn_o" vanillaOpts `mappend` mempty { ghcOptDynLinkMode = toFlag GhcDynamicOnly, ghcOptFPic = toFlag True, ghcOptExtra = toNubListR $ ghcjsSharedOptions libBi, ghcOptHPCDir = hpcdir Hpc.Dyn } linkerOpts = mempty { ghcOptLinkOptions = toNubListR $ PD.ldOptions libBi, ghcOptLinkLibs = toNubListR $ extraLibs libBi, ghcOptLinkLibPath = toNubListR $ extraLibDirs libBi, ghcOptLinkFrameworks = toNubListR $ PD.frameworks libBi, ghcOptInputFiles = toNubListR $ [libTargetDir </> x | x <- cObjs] ++ jsSrcs } replOpts = vanillaOptsNoJsLib { ghcOptExtra = overNubListR Internal.filterGhciFlags (ghcOptExtra vanillaOpts), ghcOptNumJobs = mempty } `mappend` linkerOpts `mappend` mempty { ghcOptMode = toFlag GhcModeInteractive, ghcOptOptimisation = toFlag GhcNoOptimisation } vanillaSharedOpts = vanillaOpts `mappend` mempty { ghcOptDynLinkMode = toFlag GhcStaticAndDynamic, ghcOptDynHiSuffix = toFlag "dyn_hi", ghcOptDynObjSuffix = toFlag "dyn_o", ghcOptHPCDir = hpcdir Hpc.Dyn } unless (forRepl || (null (libModules lib) && null jsSrcs && null cObjs)) $ do let vanilla = whenVanillaLib forceVanillaLib (runGhcjsProg vanillaOpts) shared = whenSharedLib forceSharedLib (runGhcjsProg sharedOpts) useDynToo = dynamicTooSupported && (forceVanillaLib || withVanillaLib lbi) && (forceSharedLib || withSharedLib lbi) && null (ghcjsSharedOptions libBi) if useDynToo then do runGhcjsProg vanillaSharedOpts case (hpcdir Hpc.Dyn, hpcdir Hpc.Vanilla) of (Cabal.Flag dynDir, Cabal.Flag vanillaDir) -> do -- When the vanilla and shared library builds are done -- in one pass, only one set of HPC module interfaces -- are generated. This set should suffice for both -- static and dynamically linked executables. We copy -- the modules interfaces so they are available under -- both ways. copyDirectoryRecursive verbosity dynDir vanillaDir _ -> return () else if isGhcjsDynamic then do shared; vanilla else do vanilla; shared whenProfLib (runGhcjsProg profOpts) -- build any C sources unless (null (cSources libBi) || not nativeToo) $ do info verbosity "Building C Sources..." sequence_ [ do let vanillaCcOpts = (Internal.componentCcGhcOptions verbosity implInfo lbi libBi clbi libTargetDir filename) profCcOpts = vanillaCcOpts `mappend` mempty { ghcOptProfilingMode = toFlag True, ghcOptObjSuffix = toFlag "p_o" } sharedCcOpts = vanillaCcOpts `mappend` mempty { ghcOptFPic = toFlag True, ghcOptDynLinkMode = toFlag GhcDynamicOnly, ghcOptObjSuffix = toFlag "dyn_o" } odir = fromFlag (ghcOptObjDir vanillaCcOpts) createDirectoryIfMissingVerbose verbosity True odir runGhcjsProg vanillaCcOpts whenSharedLib forceSharedLib (runGhcjsProg sharedCcOpts) whenProfLib (runGhcjsProg profCcOpts) | filename <- cSources libBi] -- TODO: problem here is we need the .c files built first, so we can load them -- with ghci, but .c files can depend on .h files generated by ghc by ffi -- exports. unless (null (libModules lib)) $ ifReplLib (runGhcjsProg replOpts) -- link: when (nativeToo && not forRepl) $ do info verbosity "Linking..." let cProfObjs = map (`replaceExtension` ("p_" ++ objExtension)) (cSources libBi) cSharedObjs = map (`replaceExtension` ("dyn_" ++ objExtension)) (cSources libBi) compiler_id = compilerId (compiler lbi) vanillaLibFilePath = libTargetDir </> mkLibName uid profileLibFilePath = libTargetDir </> mkProfLibName uid sharedLibFilePath = libTargetDir </> mkSharedLibName compiler_id uid ghciLibFilePath = libTargetDir </> Internal.mkGHCiLibName uid hObjs <- Internal.getHaskellObjects implInfo lib lbi libTargetDir objExtension True hProfObjs <- if (withProfLib lbi) then Internal.getHaskellObjects implInfo lib lbi libTargetDir ("p_" ++ objExtension) True else return [] hSharedObjs <- if (withSharedLib lbi) then Internal.getHaskellObjects implInfo lib lbi libTargetDir ("dyn_" ++ objExtension) False else return [] unless (null hObjs && null cObjs) $ do let staticObjectFiles = hObjs ++ map (libTargetDir </>) cObjs profObjectFiles = hProfObjs ++ map (libTargetDir </>) cProfObjs ghciObjFiles = hObjs ++ map (libTargetDir </>) cObjs dynamicObjectFiles = hSharedObjs ++ map (libTargetDir </>) cSharedObjs -- After the relocation lib is created we invoke ghc -shared -- with the dependencies spelled out as -package arguments -- and ghc invokes the linker with the proper library paths ghcSharedLinkArgs = mempty { ghcOptShared = toFlag True, ghcOptDynLinkMode = toFlag GhcDynamicOnly, ghcOptInputFiles = toNubListR dynamicObjectFiles, ghcOptOutputFile = toFlag sharedLibFilePath, ghcOptExtra = toNubListR $ ghcjsSharedOptions libBi, ghcOptNoAutoLinkPackages = toFlag True, ghcOptPackageDBs = withPackageDB lbi, ghcOptPackages = toNubListR $ Internal.mkGhcOptPackages clbi, ghcOptLinkLibs = toNubListR $ extraLibs libBi, ghcOptLinkLibPath = toNubListR $ extraLibDirs libBi } whenVanillaLib False $ do Ar.createArLibArchive verbosity lbi vanillaLibFilePath staticObjectFiles whenProfLib $ do Ar.createArLibArchive verbosity lbi profileLibFilePath profObjectFiles whenGHCiLib $ do (ldProg, _) <- requireProgram verbosity ldProgram (withPrograms lbi) Ld.combineObjectFiles verbosity ldProg ghciLibFilePath ghciObjFiles whenSharedLib False $ runGhcjsProg ghcSharedLinkArgs -- | Start a REPL without loading any source files.
10,750
false
true
9
21
4,268
2,013
1,034
979
null
null
eigengrau/haskell-ircbot
Network/IRC/Bot/Commands.hs
bsd-3-clause
privMsg :: (Functor m, MonadPlus m, BotMonad m) => m PrivMsg privMsg = do msg <- askMessage maybe mzero return (toPrivMsg msg)
133
privMsg :: (Functor m, MonadPlus m, BotMonad m) => m PrivMsg privMsg = do msg <- askMessage maybe mzero return (toPrivMsg msg)
133
privMsg = do msg <- askMessage maybe mzero return (toPrivMsg msg)
72
false
true
0
10
28
64
29
35
null
null
ardumont/haskell-lab
test/RBTTests.hs
gpl-2.0
testNoRedRed4 :: Test testNoRedRed4 = True ~=? noRedRed t where t = Node B (Node R (Node B Empty 5 Empty) 10 Empty) 20 Empty :: Tree Int
137
testNoRedRed4 :: Test testNoRedRed4 = True ~=? noRedRed t where t = Node B (Node R (Node B Empty 5 Empty) 10 Empty) 20 Empty :: Tree Int
137
testNoRedRed4 = True ~=? noRedRed t where t = Node B (Node R (Node B Empty 5 Empty) 10 Empty) 20 Empty :: Tree Int
115
false
true
0
11
28
64
32
32
null
null
jship/metronome
local_deps/netwire/Control/Wire/Unsafe/Event.hs
bsd-3-clause
-- | Merge two events using the given function when both occur at the -- same time. merge :: (a -> a -> a) -> Event a -> Event a -> Event a merge _ NoEvent NoEvent = NoEvent
178
merge :: (a -> a -> a) -> Event a -> Event a -> Event a merge _ NoEvent NoEvent = NoEvent
93
merge _ NoEvent NoEvent = NoEvent
37
true
true
0
9
43
57
27
30
null
null
pascal-knodel/haskell-craft
_/links/E'3''5.hs
mit
nAnd True False = True
22
nAnd True False = True
22
nAnd True False = True
22
false
false
0
5
4
13
5
8
null
null
frantisekfarka/ghc-dsi
compiler/main/DynFlags.hs
bsd-3-clause
getOpts :: DynFlags -- ^ 'DynFlags' to retrieve the options from -> (DynFlags -> [a]) -- ^ Relevant record accessor: one of the @opt_*@ accessors -> [a] -- ^ Correctly ordered extracted options getOpts dflags opts = reverse (opts dflags)
285
getOpts :: DynFlags -- ^ 'DynFlags' to retrieve the options from -> (DynFlags -> [a]) -- ^ Relevant record accessor: one of the @opt_*@ accessors -> [a] getOpts dflags opts = reverse (opts dflags)
227
getOpts dflags opts = reverse (opts dflags)
43
true
true
0
10
87
54
28
26
null
null
expipiplus1/vulkan
generate-new/src/Spec/Parse.hs
bsd-3-clause
parseConstantAliases :: [Content] -> P (Vector Alias) parseConstantAliases es = fmap V.fromList . sequenceV $ [ do aName <- nameAttr "enum alias" ee aTarget <- decodeName alias pure Alias { .. } | Element e <- es , "enums" == name e , Just "API Constants" <- pure $ getAttr "name" e , Element ee <- contents e , "enum" == name ee , Just alias <- pure $ getAttr "alias" ee , aType <- [TypeAlias, PatternAlias] ]
521
parseConstantAliases :: [Content] -> P (Vector Alias) parseConstantAliases es = fmap V.fromList . sequenceV $ [ do aName <- nameAttr "enum alias" ee aTarget <- decodeName alias pure Alias { .. } | Element e <- es , "enums" == name e , Just "API Constants" <- pure $ getAttr "name" e , Element ee <- contents e , "enum" == name ee , Just alias <- pure $ getAttr "alias" ee , aType <- [TypeAlias, PatternAlias] ]
521
parseConstantAliases es = fmap V.fromList . sequenceV $ [ do aName <- nameAttr "enum alias" ee aTarget <- decodeName alias pure Alias { .. } | Element e <- es , "enums" == name e , Just "API Constants" <- pure $ getAttr "name" e , Element ee <- contents e , "enum" == name ee , Just alias <- pure $ getAttr "alias" ee , aType <- [TypeAlias, PatternAlias] ]
467
false
true
3
10
188
183
84
99
null
null
thoughtpolice/salt
src/Crypto/NaCl/Encrypt/SecretKey.hs
mit
-- | Increment a nonce by one. incNonce :: SKNonce -> SKNonce incNonce x = I.incNonce x
87
incNonce :: SKNonce -> SKNonce incNonce x = I.incNonce x
56
incNonce x = I.incNonce x
25
true
true
0
6
16
24
12
12
null
null
brodyberg/Notes
ProjectRosalind.hsproj/LearnHaskell/lib/HaskellBook/Chapter10Exercises.hs
mit
-- myMaximumBy (\_ _ -> GT) [1..10] -- 1 -- myMaximumBy (\_ _ -> LT) [1..10] -- 10 -- myMaximumBy compare [1..10] -- 10 -- 11. myMinimumBy takes a comparison function -- and a list, and returns the smallest element -- of the list based on the last value that the -- comparison returned LT for myMinimumBy :: (a -> a -> Ordering) -> [a] -> a myMinimumBy f (x:xs) = foldl (\x y -> if f x y == LT then x else y) x xs
451
myMinimumBy :: (a -> a -> Ordering) -> [a] -> a myMinimumBy f (x:xs) = foldl (\x y -> if f x y == LT then x else y) x xs
144
myMinimumBy f (x:xs) = foldl (\x y -> if f x y == LT then x else y) x xs
72
true
true
0
10
124
89
52
37
null
null