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
jystic/ssa-anf
src/ANF/Scope.hs
bsd-3-clause
fvOfExpr (If i th el) = fvOfAtom i `Set.union` fvOfExpr th `Set.union` fvOfExpr el
84
fvOfExpr (If i th el) = fvOfAtom i `Set.union` fvOfExpr th `Set.union` fvOfExpr el
84
fvOfExpr (If i th el) = fvOfAtom i `Set.union` fvOfExpr th `Set.union` fvOfExpr el
84
false
false
0
7
15
44
22
22
null
null
portnov/yaledger
YaLedger/Main.hs
bsd-3-clause
lookupInit :: String -> [(String, a)] -> [a] lookupInit key list = [v | (k,v) <- list, key `isPrefixOf` k]
106
lookupInit :: String -> [(String, a)] -> [a] lookupInit key list = [v | (k,v) <- list, key `isPrefixOf` k]
106
lookupInit key list = [v | (k,v) <- list, key `isPrefixOf` k]
61
false
true
0
9
19
69
37
32
null
null
ghc-android/ghc
compiler/simplCore/SetLevels.hs
bsd-3-clause
lvlLamBndrs :: LevelEnv -> Level -> [OutVar] -> (LevelEnv, [LevelledBndr]) -- Compute the levels for the binders of a lambda group lvlLamBndrs env lvl bndrs = lvlBndrs env new_lvl bndrs where new_lvl | any is_major bndrs = incMajorLvl lvl | otherwise = incMinorLvl lvl is_major bndr = isId bndr && not (isProbablyOneShotLambda bndr) -- The "probably" part says "don't float things out of a -- probable one-shot lambda" -- See Note [Computing one-shot info] in Demand.hs
524
lvlLamBndrs :: LevelEnv -> Level -> [OutVar] -> (LevelEnv, [LevelledBndr]) lvlLamBndrs env lvl bndrs = lvlBndrs env new_lvl bndrs where new_lvl | any is_major bndrs = incMajorLvl lvl | otherwise = incMinorLvl lvl is_major bndr = isId bndr && not (isProbablyOneShotLambda bndr) -- The "probably" part says "don't float things out of a -- probable one-shot lambda" -- See Note [Computing one-shot info] in Demand.hs
468
lvlLamBndrs env lvl bndrs = lvlBndrs env new_lvl bndrs where new_lvl | any is_major bndrs = incMajorLvl lvl | otherwise = incMinorLvl lvl is_major bndr = isId bndr && not (isProbablyOneShotLambda bndr) -- The "probably" part says "don't float things out of a -- probable one-shot lambda" -- See Note [Computing one-shot info] in Demand.hs
393
true
true
1
9
130
110
55
55
null
null
yiannist/ganeti
src/Ganeti/HTools/Program/Hail.hs
bsd-2-clause
-- | Options list and functions. options :: IO [OptType] options = return [ oPrintNodes , oSaveCluster , oDataFile , oNodeSim , oVerbose , oIgnoreDyn , oIgnoreSoftErrors , oNoCapacityChecks , oRestrictToNodes , oMonD , oMonDXen , oStaticKvmNodeMemory ]
306
options :: IO [OptType] options = return [ oPrintNodes , oSaveCluster , oDataFile , oNodeSim , oVerbose , oIgnoreDyn , oIgnoreSoftErrors , oNoCapacityChecks , oRestrictToNodes , oMonD , oMonDXen , oStaticKvmNodeMemory ]
273
options = return [ oPrintNodes , oSaveCluster , oDataFile , oNodeSim , oVerbose , oIgnoreDyn , oIgnoreSoftErrors , oNoCapacityChecks , oRestrictToNodes , oMonD , oMonDXen , oStaticKvmNodeMemory ]
249
true
true
0
6
91
57
35
22
null
null
gibiansky/IHaskell
src/IHaskell/Convert/LhsToIpynb.hs
mit
classifyLines _ [] = []
23
classifyLines _ [] = []
23
classifyLines _ [] = []
23
false
false
0
6
4
15
7
8
null
null
GaloisInc/pure-zlib
test/Test.hs
bsd-3-clause
-- ----------------------------------------------------------------------------- rfcSimpleTestLengths :: [(Int, Int)] rfcSimpleTestLengths = [ (ord 'A', 3) , (ord 'B', 3) , (ord 'C', 3) , (ord 'D', 3) , (ord 'E', 3) , (ord 'F', 2) , (ord 'G', 4) , (ord 'H', 4) ]
281
rfcSimpleTestLengths :: [(Int, Int)] rfcSimpleTestLengths = [ (ord 'A', 3) , (ord 'B', 3) , (ord 'C', 3) , (ord 'D', 3) , (ord 'E', 3) , (ord 'F', 2) , (ord 'G', 4) , (ord 'H', 4) ]
199
rfcSimpleTestLengths = [ (ord 'A', 3) , (ord 'B', 3) , (ord 'C', 3) , (ord 'D', 3) , (ord 'E', 3) , (ord 'F', 2) , (ord 'G', 4) , (ord 'H', 4) ]
162
true
true
0
7
59
117
69
48
null
null
simonmichael/hledger
hledger-lib/Hledger/Query.hs
gpl-3.0
-- | What is the earliest of these dates, where Nothing is earliest ? earliestMaybeDate :: [Maybe Day] -> Maybe Day earliestMaybeDate = fromMaybe Nothing . minimumMay
166
earliestMaybeDate :: [Maybe Day] -> Maybe Day earliestMaybeDate = fromMaybe Nothing . minimumMay
96
earliestMaybeDate = fromMaybe Nothing . minimumMay
50
true
true
0
8
26
37
17
20
null
null
Raveline/1HAD
src/Main.hs
mit
readDateCommand :: (Int -> Int -> Int -> Command) -> [String] -> Maybe Command readDateCommand cmd [xs,ys,zs] = do y <- readInt xs m <- readInt ys d <- readInt zs return $ cmd y m d
197
readDateCommand :: (Int -> Int -> Int -> Command) -> [String] -> Maybe Command readDateCommand cmd [xs,ys,zs] = do y <- readInt xs m <- readInt ys d <- readInt zs return $ cmd y m d
197
readDateCommand cmd [xs,ys,zs] = do y <- readInt xs m <- readInt ys d <- readInt zs return $ cmd y m d
118
false
true
0
9
52
98
47
51
null
null
fmapfmapfmap/amazonka
amazonka-sqs/gen/Network/AWS/SQS/ReceiveMessage.hs
mpl-2.0
-- | The duration (in seconds) for which the call will wait for a message to -- arrive in the queue before returning. If a message is available, the -- call will return sooner than WaitTimeSeconds. rmWaitTimeSeconds :: Lens' ReceiveMessage (Maybe Int) rmWaitTimeSeconds = lens _rmWaitTimeSeconds (\ s a -> s{_rmWaitTimeSeconds = a})
332
rmWaitTimeSeconds :: Lens' ReceiveMessage (Maybe Int) rmWaitTimeSeconds = lens _rmWaitTimeSeconds (\ s a -> s{_rmWaitTimeSeconds = a})
134
rmWaitTimeSeconds = lens _rmWaitTimeSeconds (\ s a -> s{_rmWaitTimeSeconds = a})
80
true
true
1
9
52
53
27
26
null
null
HaskellForCats/HaskellForCats
30MinHaskell/z_notes/3_b_quickCheckt.hs
mit
prop_sqr xs = squares' xs == squares xs
41
prop_sqr xs = squares' xs == squares xs
41
prop_sqr xs = squares' xs == squares xs
41
false
false
0
6
9
19
8
11
null
null
ihc/futhark
src/Futhark/Util.hs
isc
-- | @takeLast n l@ takes the last @n@ elements of @l@. takeLast :: Int -> [a] -> [a] takeLast n = reverse . take n . reverse
125
takeLast :: Int -> [a] -> [a] takeLast n = reverse . take n . reverse
69
takeLast n = reverse . take n . reverse
39
true
true
1
9
27
47
22
25
null
null
CulpaBS/wbBach
src/Futhark/Pass/KernelBabysitting.hs
bsd-3-clause
transformBinding :: ExpMap -> Binding -> BabysitM ExpMap transformBinding expmap (Let pat () (DoLoop ctx val form body)) = do body' <- localScope (scopeOfFParams $ map fst $ ctx ++ val) $ localScope (scopeOfLoopForm form) $ transformBody body addBinding $ Let pat () $ DoLoop ctx val form body' return expmap
337
transformBinding :: ExpMap -> Binding -> BabysitM ExpMap transformBinding expmap (Let pat () (DoLoop ctx val form body)) = do body' <- localScope (scopeOfFParams $ map fst $ ctx ++ val) $ localScope (scopeOfLoopForm form) $ transformBody body addBinding $ Let pat () $ DoLoop ctx val form body' return expmap
336
transformBinding expmap (Let pat () (DoLoop ctx val form body)) = do body' <- localScope (scopeOfFParams $ map fst $ ctx ++ val) $ localScope (scopeOfLoopForm form) $ transformBody body addBinding $ Let pat () $ DoLoop ctx val form body' return expmap
279
false
true
0
16
79
137
62
75
null
null
ulricha/dsh
src/Database/DSH/FKL/Typing.hs
bsd-3-clause
listTy :: Type -> Typing () listTy (ListT _) = pure ()
54
listTy :: Type -> Typing () listTy (ListT _) = pure ()
54
listTy (ListT _) = pure ()
26
false
true
0
7
11
34
16
18
null
null
QuickChick/Luck
luck/src/Outer/AST.hs
mit
tc_int_tycon, tc_bool_tycon, tc_unit_tycon :: CT.TcType TyConId v tc_int_tycon = CT.TcCon "Int" 0 []
102
tc_int_tycon, tc_bool_tycon, tc_unit_tycon :: CT.TcType TyConId v tc_int_tycon = CT.TcCon "Int" 0 []
102
tc_int_tycon = CT.TcCon "Int" 0 []
36
false
true
0
6
14
33
18
15
null
null
sdiehl/ghc
compiler/simplCore/SimplUtils.hs
bsd-3-clause
-- See Note [DupFlag invariants] contIsDupable (Select { sc_dup = OkToDup }) = True
87
contIsDupable (Select { sc_dup = OkToDup }) = True
54
contIsDupable (Select { sc_dup = OkToDup }) = True
54
true
false
0
8
17
23
12
11
null
null
uuhan/Idris-dev
src/Idris/Error.hs
bsd-3-clause
getErrSpan :: Err -> FC getErrSpan (At fc _) = fc
49
getErrSpan :: Err -> FC getErrSpan (At fc _) = fc
49
getErrSpan (At fc _) = fc
25
false
true
0
7
10
26
13
13
null
null
nevrenato/Hets_Fork
HolLight/HolLight2DG.hs
gpl-2.0
prettifyTypeVarsTm t m = (t, m)
31
prettifyTypeVarsTm t m = (t, m)
31
prettifyTypeVarsTm t m = (t, m)
31
false
false
0
5
5
17
9
8
null
null
vincenthz/socksmaster
Src/Main.hs
bsd-3-clause
displaySpeed :: Int -> Int -> IO () displaySpeed written recv = do setTitle ("sent: " ++ toHU written ++ " recv: " ++ toHU recv) when (written /= 0 || recv /= 0) $ withTerminalLock $ do hSetSGR stdout [SetColor Foreground Vivid Yellow] hPutStr stdout "## sent = " hSetSGR stdout [SetColor Foreground Vivid Magenta] hPutStr stdout (toHU written) hSetSGR stdout [SetColor Foreground Vivid Yellow] hPutStr stdout " recv = " hSetSGR stdout [SetColor Foreground Vivid Magenta] hPutStr stdout (toHU recv) hSetSGR stdout [] hPutStrLn stdout ""
626
displaySpeed :: Int -> Int -> IO () displaySpeed written recv = do setTitle ("sent: " ++ toHU written ++ " recv: " ++ toHU recv) when (written /= 0 || recv /= 0) $ withTerminalLock $ do hSetSGR stdout [SetColor Foreground Vivid Yellow] hPutStr stdout "## sent = " hSetSGR stdout [SetColor Foreground Vivid Magenta] hPutStr stdout (toHU written) hSetSGR stdout [SetColor Foreground Vivid Yellow] hPutStr stdout " recv = " hSetSGR stdout [SetColor Foreground Vivid Magenta] hPutStr stdout (toHU recv) hSetSGR stdout [] hPutStrLn stdout ""
626
displaySpeed written recv = do setTitle ("sent: " ++ toHU written ++ " recv: " ++ toHU recv) when (written /= 0 || recv /= 0) $ withTerminalLock $ do hSetSGR stdout [SetColor Foreground Vivid Yellow] hPutStr stdout "## sent = " hSetSGR stdout [SetColor Foreground Vivid Magenta] hPutStr stdout (toHU written) hSetSGR stdout [SetColor Foreground Vivid Yellow] hPutStr stdout " recv = " hSetSGR stdout [SetColor Foreground Vivid Magenta] hPutStr stdout (toHU recv) hSetSGR stdout [] hPutStrLn stdout ""
590
false
true
0
13
177
219
97
122
null
null
mlitchard/IX
src/IX/Universe/HyperSpace.hs
mit
evalHyp :: M.Map AID Location -> M.Map AID Agent -> HCommand -> (AID,Result) evalHyp l_map a_map (HCommand (VAC (PlayerCommand comm aid))) = let hyp_data = fromJustNote locFail (M.lookup aid l_map) ship' = ship (fromJustNote agtFail (M.lookup aid a_map)) res = case comm of Move pName -> CError (CantMoveTo $ pName) Zap aid' -> CError (CantZap aid') Look -> Looked (Right hyp_data) ship' Repair -> ChangeShip Repairing SetSpeed _ -> CError SpeedIsSet Buy _ _ -> CError NoBusinessInHyperSpace Sell _ _ -> CError NoBusinessInHyperSpace Market -> CError NoBusinessInHyperSpace in (aid,res) where locFail = "evalHyp did not find " ++ show aid ++ "in LocationMap" agtFail = "evalHyp did not find " ++ show aid ++ "in AgentMap"
1,031
evalHyp :: M.Map AID Location -> M.Map AID Agent -> HCommand -> (AID,Result) evalHyp l_map a_map (HCommand (VAC (PlayerCommand comm aid))) = let hyp_data = fromJustNote locFail (M.lookup aid l_map) ship' = ship (fromJustNote agtFail (M.lookup aid a_map)) res = case comm of Move pName -> CError (CantMoveTo $ pName) Zap aid' -> CError (CantZap aid') Look -> Looked (Right hyp_data) ship' Repair -> ChangeShip Repairing SetSpeed _ -> CError SpeedIsSet Buy _ _ -> CError NoBusinessInHyperSpace Sell _ _ -> CError NoBusinessInHyperSpace Market -> CError NoBusinessInHyperSpace in (aid,res) where locFail = "evalHyp did not find " ++ show aid ++ "in LocationMap" agtFail = "evalHyp did not find " ++ show aid ++ "in AgentMap"
1,031
evalHyp l_map a_map (HCommand (VAC (PlayerCommand comm aid))) = let hyp_data = fromJustNote locFail (M.lookup aid l_map) ship' = ship (fromJustNote agtFail (M.lookup aid a_map)) res = case comm of Move pName -> CError (CantMoveTo $ pName) Zap aid' -> CError (CantZap aid') Look -> Looked (Right hyp_data) ship' Repair -> ChangeShip Repairing SetSpeed _ -> CError SpeedIsSet Buy _ _ -> CError NoBusinessInHyperSpace Sell _ _ -> CError NoBusinessInHyperSpace Market -> CError NoBusinessInHyperSpace in (aid,res) where locFail = "evalHyp did not find " ++ show aid ++ "in LocationMap" agtFail = "evalHyp did not find " ++ show aid ++ "in AgentMap"
954
false
true
2
15
425
296
137
159
null
null
mrakgr/futhark
src/Language/Futhark/Attributes.hs
bsd-3-clause
setTupleArrayElemUniqueness (TupleArrayElem ts) u = TupleArrayElem $ map (`setTupleArrayElemUniqueness` u) ts
111
setTupleArrayElemUniqueness (TupleArrayElem ts) u = TupleArrayElem $ map (`setTupleArrayElemUniqueness` u) ts
111
setTupleArrayElemUniqueness (TupleArrayElem ts) u = TupleArrayElem $ map (`setTupleArrayElemUniqueness` u) ts
111
false
false
0
7
12
32
17
15
null
null
artuuge/IHaskell
src/IHaskell/Display.hs
mit
-- | Write to the display channel. The contents will be displayed in the notebook once the current -- execution call ends. printDisplay :: IHaskellDisplay a => a -> IO () printDisplay disp = display disp >>= atomically . writeTChan displayChan
243
printDisplay :: IHaskellDisplay a => a -> IO () printDisplay disp = display disp >>= atomically . writeTChan displayChan
120
printDisplay disp = display disp >>= atomically . writeTChan displayChan
72
true
true
0
9
40
50
23
27
null
null
nuttycom/haskoin
Network/Haskoin/Script/Evaluator.hs
unlicense
isPayToScriptHash :: [ ScriptOp ] -> [ Flag ] -> Bool isPayToScriptHash [OP_HASH160, OP_PUSHDATA bytes OPCODE, OP_EQUAL] flgs = ( P2SH `elem` flgs ) && ( BS.length bytes == 20 )
198
isPayToScriptHash :: [ ScriptOp ] -> [ Flag ] -> Bool isPayToScriptHash [OP_HASH160, OP_PUSHDATA bytes OPCODE, OP_EQUAL] flgs = ( P2SH `elem` flgs ) && ( BS.length bytes == 20 )
198
isPayToScriptHash [OP_HASH160, OP_PUSHDATA bytes OPCODE, OP_EQUAL] flgs = ( P2SH `elem` flgs ) && ( BS.length bytes == 20 )
143
false
true
0
10
51
75
39
36
null
null
dysinger/amazonka
amazonka-ec2/gen/Network/AWS/EC2/Types.hs
mpl-2.0
-- | The reason for the status. rimStatusMessage :: Lens' ReservedInstancesModification (Maybe Text) rimStatusMessage = lens _rimStatusMessage (\s a -> s { _rimStatusMessage = a })
180
rimStatusMessage :: Lens' ReservedInstancesModification (Maybe Text) rimStatusMessage = lens _rimStatusMessage (\s a -> s { _rimStatusMessage = a })
148
rimStatusMessage = lens _rimStatusMessage (\s a -> s { _rimStatusMessage = a })
79
true
true
0
9
25
46
25
21
null
null
thalerjonathan/phd
coding/libraries/chimera/examples/ABS/Wildfire/Renderer.hs
gpl-3.0
renderWildfireFrame :: WildfireRenderFrame renderWildfireFrame = renderFrameDisc2d (defaultAgentRendererDisc2d wildfireAgentColor wfCoord) voidEnvRendererDisc2d
209
renderWildfireFrame :: WildfireRenderFrame renderWildfireFrame = renderFrameDisc2d (defaultAgentRendererDisc2d wildfireAgentColor wfCoord) voidEnvRendererDisc2d
209
renderWildfireFrame = renderFrameDisc2d (defaultAgentRendererDisc2d wildfireAgentColor wfCoord) voidEnvRendererDisc2d
166
false
true
0
7
58
24
12
12
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_BLEND_OVERLAP_NV :: GLenum gl_BLEND_OVERLAP_NV = 0x9281
58
gl_BLEND_OVERLAP_NV :: GLenum gl_BLEND_OVERLAP_NV = 0x9281
58
gl_BLEND_OVERLAP_NV = 0x9281
28
false
true
0
4
5
11
6
5
null
null
krakrjak/ImplicitCAD
Graphics/Implicit/ExtOpenScad/Eval/Expr.hs
agpl-3.0
patMatch (ListP pats) (OList vals) = do matches <- zipWithM patMatch pats vals return $ concat matches
110
patMatch (ListP pats) (OList vals) = do matches <- zipWithM patMatch pats vals return $ concat matches
110
patMatch (ListP pats) (OList vals) = do matches <- zipWithM patMatch pats vals return $ concat matches
110
false
false
0
8
24
47
21
26
null
null
dorchard/camfort
src/Camfort/Specification/Units/Analysis.hs
apache-2.0
-- | Get info about intrinsics by source name 'sname', taking into -- account the special case of those with arbitrary number of -- arguments. intrinsicLookup :: F.Name -> Maybe (UnitInfo, [UnitInfo]) intrinsicLookup sname = do (retU, argUs) <- M.lookup sname intrinsicUnits return (retU, if sname `S.member` specialCaseArbitraryArgs then cycle argUs else argUs) -- | Generate a unique identifier for a literal encountered in the code.
440
intrinsicLookup :: F.Name -> Maybe (UnitInfo, [UnitInfo]) intrinsicLookup sname = do (retU, argUs) <- M.lookup sname intrinsicUnits return (retU, if sname `S.member` specialCaseArbitraryArgs then cycle argUs else argUs) -- | Generate a unique identifier for a literal encountered in the code.
297
intrinsicLookup sname = do (retU, argUs) <- M.lookup sname intrinsicUnits return (retU, if sname `S.member` specialCaseArbitraryArgs then cycle argUs else argUs) -- | Generate a unique identifier for a literal encountered in the code.
239
true
true
0
10
70
87
48
39
null
null
d-day/relation
include/pointfree-style/pointfree-1.0.4.3/Plugin/Pl/Optimize.hs
bsd-3-clause
rew (CRR r) e = toMonadPlus $ r e
33
rew (CRR r) e = toMonadPlus $ r e
33
rew (CRR r) e = toMonadPlus $ r e
33
false
false
1
8
8
27
11
16
null
null
rahulmutt/ghcvm
compiler/Eta/TypeCheck/TcType.hs
bsd-3-clause
orphNamesOfCo (UnivCo _ _ ty1 ty2) = orphNamesOfType ty1 `unionNameSet` orphNamesOfType ty2
92
orphNamesOfCo (UnivCo _ _ ty1 ty2) = orphNamesOfType ty1 `unionNameSet` orphNamesOfType ty2
92
orphNamesOfCo (UnivCo _ _ ty1 ty2) = orphNamesOfType ty1 `unionNameSet` orphNamesOfType ty2
92
false
false
0
6
12
34
16
18
null
null
JPMoresmau/HJVM
src/Language/Java/JVM/JavapParser.hs
bsd-3-clause
classList0 :: ParsecT String u Identity [ClassName] classList0=sepBy className comma
84
classList0 :: ParsecT String u Identity [ClassName] classList0=sepBy className comma
84
classList0=sepBy className comma
32
false
true
0
6
9
28
14
14
null
null
mcschroeder/ghc
compiler/stranal/WorkWrap.hs
bsd-3-clause
wwExpr dflags fam_envs (Case expr binder ty alts) = do new_expr <- wwExpr dflags fam_envs expr new_alts <- mapM ww_alt alts return (Case new_expr binder ty new_alts) where ww_alt (con, binders, rhs) = do new_rhs <- wwExpr dflags fam_envs rhs return (con, binders, new_rhs) {- ************************************************************************ * * \subsection[tryWW]{@tryWW@: attempt a worker/wrapper pair} * * ************************************************************************ @tryWW@ just accumulates arguments, converts strictness info from the front-end into the proper form, then calls @mkWwBodies@ to do the business. The only reason this is monadised is for the unique supply. Note [Don't w/w INLINE things] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It's very important to refrain from w/w-ing an INLINE function (ie one with a stable unfolding) because the wrapper will then overwrite the old stable unfolding with the wrapper code. Furthermore, if the programmer has marked something as INLINE, we may lose by w/w'ing it. If the strictness analyser is run twice, this test also prevents wrappers (which are INLINEd) from being re-done. (You can end up with several liked-named Ids bouncing around at the same time---absolute mischief.) Notice that we refrain from w/w'ing an INLINE function even if it is in a recursive group. It might not be the loop breaker. (We could test for loop-breaker-hood, but I'm not sure that ever matters.) Note [Worker-wrapper for INLINABLE functions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If we have {-# INLINABLE f #-} f :: Ord a => [a] -> Int -> a f x y = ....f.... where f is strict in y, we might get a more efficient loop by w/w'ing f. But that would make a new unfolding which would overwrite the old one! So the function would no longer be ININABLE, and in particular will not be specialised at call sites in other modules. This comes in practice (Trac #6056). Solution: do the w/w for strictness analysis, but transfer the Stable unfolding to the *worker*. So we will get something like this: {-# INLINE[0] f #-} f :: Ord a => [a] -> Int -> a f d x y = case y of I# y' -> fw d x y' {-# INLINABLE[0] fw #-} fw :: Ord a => [a] -> Int# -> a fw d x y' = let y = I# y' in ...f... How do we "transfer the unfolding"? Easy: by using the old one, wrapped in work_fn! See CoreUnfold.mkWorkerUnfolding. Note [Activation for INLINABLE worker] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Follows on from Note [Worker-wrapper for INLINABLE functions] It is *vital* that if the worker gets an INLINABLE pragma (from the original function), then the worker has the same phase activation as the wrapper (or later). That is necessary to allow the wrapper to inline into the worker's unfolding: see SimplUtils Note [Simplifying inside stable unfoldings]. Notihng is lost by giving the worker the same activation as the worker, because the worker won't have any chance of inlining until the wrapper does; there's no point in giving it an earlier activation. Note [Don't w/w inline small non-loop-breaker things] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In general, we refrain from w/w-ing *small* functions, which are not loop breakers, because they'll inline anyway. But we must take care: it may look small now, but get to be big later after other inlining has happened. So we take the precaution of adding an INLINE pragma to any such functions. I made this change when I observed a big function at the end of compilation with a useful strictness signature but no w-w. (It was small during demand analysis, we refrained from w/w, and then got big when something was inlined in its rhs.) When I measured it on nofib, it didn't make much difference; just a few percent improved allocation on one benchmark (bspt/Euclid.space). But nothing got worse. There is an infelicity though. We may get something like f = g val ==> g x = case gw x of r -> I# r f {- InlineStable, Template = g val -} f = case gw x of r -> I# r The code for f duplicates that for g, without any real benefit. It won't really be executed, because calls to f will go via the inlining. Note [Wrapper activation] ~~~~~~~~~~~~~~~~~~~~~~~~~ When should the wrapper inlining be active? It must not be active earlier than the current Activation of the Id (eg it might have a NOINLINE pragma). But in fact strictness analysis happens fairly late in the pipeline, and we want to prioritise specialisations over strictness. Eg if we have module Foo where f :: Num a => a -> Int -> a f n 0 = n -- Strict in the Int, hence wrapper f n x = f (n+n) (x-1) g :: Int -> Int g x = f x x -- Provokes a specialisation for f module Bar where import Foo h :: Int -> Int h x = f 3 x Then we want the specialisation for 'f' to kick in before the wrapper does. Now in fact the 'gentle' simplification pass encourages this, by having rules on, but inlinings off. But that's kind of lucky. It seems more robust to give the wrapper an Activation of (ActiveAfter 0), so that it becomes active in an importing module at the same time that it appears in the first place in the defining module. At one stage I tried making the wrapper inlining always-active, and that had a very bad effect on nofib/imaginary/x2n1; a wrapper was inlined before the specialisation fired. -}
5,573
wwExpr dflags fam_envs (Case expr binder ty alts) = do new_expr <- wwExpr dflags fam_envs expr new_alts <- mapM ww_alt alts return (Case new_expr binder ty new_alts) where ww_alt (con, binders, rhs) = do new_rhs <- wwExpr dflags fam_envs rhs return (con, binders, new_rhs) {- ************************************************************************ * * \subsection[tryWW]{@tryWW@: attempt a worker/wrapper pair} * * ************************************************************************ @tryWW@ just accumulates arguments, converts strictness info from the front-end into the proper form, then calls @mkWwBodies@ to do the business. The only reason this is monadised is for the unique supply. Note [Don't w/w INLINE things] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It's very important to refrain from w/w-ing an INLINE function (ie one with a stable unfolding) because the wrapper will then overwrite the old stable unfolding with the wrapper code. Furthermore, if the programmer has marked something as INLINE, we may lose by w/w'ing it. If the strictness analyser is run twice, this test also prevents wrappers (which are INLINEd) from being re-done. (You can end up with several liked-named Ids bouncing around at the same time---absolute mischief.) Notice that we refrain from w/w'ing an INLINE function even if it is in a recursive group. It might not be the loop breaker. (We could test for loop-breaker-hood, but I'm not sure that ever matters.) Note [Worker-wrapper for INLINABLE functions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If we have {-# INLINABLE f #-} f :: Ord a => [a] -> Int -> a f x y = ....f.... where f is strict in y, we might get a more efficient loop by w/w'ing f. But that would make a new unfolding which would overwrite the old one! So the function would no longer be ININABLE, and in particular will not be specialised at call sites in other modules. This comes in practice (Trac #6056). Solution: do the w/w for strictness analysis, but transfer the Stable unfolding to the *worker*. So we will get something like this: {-# INLINE[0] f #-} f :: Ord a => [a] -> Int -> a f d x y = case y of I# y' -> fw d x y' {-# INLINABLE[0] fw #-} fw :: Ord a => [a] -> Int# -> a fw d x y' = let y = I# y' in ...f... How do we "transfer the unfolding"? Easy: by using the old one, wrapped in work_fn! See CoreUnfold.mkWorkerUnfolding. Note [Activation for INLINABLE worker] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Follows on from Note [Worker-wrapper for INLINABLE functions] It is *vital* that if the worker gets an INLINABLE pragma (from the original function), then the worker has the same phase activation as the wrapper (or later). That is necessary to allow the wrapper to inline into the worker's unfolding: see SimplUtils Note [Simplifying inside stable unfoldings]. Notihng is lost by giving the worker the same activation as the worker, because the worker won't have any chance of inlining until the wrapper does; there's no point in giving it an earlier activation. Note [Don't w/w inline small non-loop-breaker things] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In general, we refrain from w/w-ing *small* functions, which are not loop breakers, because they'll inline anyway. But we must take care: it may look small now, but get to be big later after other inlining has happened. So we take the precaution of adding an INLINE pragma to any such functions. I made this change when I observed a big function at the end of compilation with a useful strictness signature but no w-w. (It was small during demand analysis, we refrained from w/w, and then got big when something was inlined in its rhs.) When I measured it on nofib, it didn't make much difference; just a few percent improved allocation on one benchmark (bspt/Euclid.space). But nothing got worse. There is an infelicity though. We may get something like f = g val ==> g x = case gw x of r -> I# r f {- InlineStable, Template = g val -} f = case gw x of r -> I# r The code for f duplicates that for g, without any real benefit. It won't really be executed, because calls to f will go via the inlining. Note [Wrapper activation] ~~~~~~~~~~~~~~~~~~~~~~~~~ When should the wrapper inlining be active? It must not be active earlier than the current Activation of the Id (eg it might have a NOINLINE pragma). But in fact strictness analysis happens fairly late in the pipeline, and we want to prioritise specialisations over strictness. Eg if we have module Foo where f :: Num a => a -> Int -> a f n 0 = n -- Strict in the Int, hence wrapper f n x = f (n+n) (x-1) g :: Int -> Int g x = f x x -- Provokes a specialisation for f module Bar where import Foo h :: Int -> Int h x = f 3 x Then we want the specialisation for 'f' to kick in before the wrapper does. Now in fact the 'gentle' simplification pass encourages this, by having rules on, but inlinings off. But that's kind of lucky. It seems more robust to give the wrapper an Activation of (ActiveAfter 0), so that it becomes active in an importing module at the same time that it appears in the first place in the defining module. At one stage I tried making the wrapper inlining always-active, and that had a very bad effect on nofib/imaginary/x2n1; a wrapper was inlined before the specialisation fired. -}
5,573
wwExpr dflags fam_envs (Case expr binder ty alts) = do new_expr <- wwExpr dflags fam_envs expr new_alts <- mapM ww_alt alts return (Case new_expr binder ty new_alts) where ww_alt (con, binders, rhs) = do new_rhs <- wwExpr dflags fam_envs rhs return (con, binders, new_rhs) {- ************************************************************************ * * \subsection[tryWW]{@tryWW@: attempt a worker/wrapper pair} * * ************************************************************************ @tryWW@ just accumulates arguments, converts strictness info from the front-end into the proper form, then calls @mkWwBodies@ to do the business. The only reason this is monadised is for the unique supply. Note [Don't w/w INLINE things] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It's very important to refrain from w/w-ing an INLINE function (ie one with a stable unfolding) because the wrapper will then overwrite the old stable unfolding with the wrapper code. Furthermore, if the programmer has marked something as INLINE, we may lose by w/w'ing it. If the strictness analyser is run twice, this test also prevents wrappers (which are INLINEd) from being re-done. (You can end up with several liked-named Ids bouncing around at the same time---absolute mischief.) Notice that we refrain from w/w'ing an INLINE function even if it is in a recursive group. It might not be the loop breaker. (We could test for loop-breaker-hood, but I'm not sure that ever matters.) Note [Worker-wrapper for INLINABLE functions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If we have {-# INLINABLE f #-} f :: Ord a => [a] -> Int -> a f x y = ....f.... where f is strict in y, we might get a more efficient loop by w/w'ing f. But that would make a new unfolding which would overwrite the old one! So the function would no longer be ININABLE, and in particular will not be specialised at call sites in other modules. This comes in practice (Trac #6056). Solution: do the w/w for strictness analysis, but transfer the Stable unfolding to the *worker*. So we will get something like this: {-# INLINE[0] f #-} f :: Ord a => [a] -> Int -> a f d x y = case y of I# y' -> fw d x y' {-# INLINABLE[0] fw #-} fw :: Ord a => [a] -> Int# -> a fw d x y' = let y = I# y' in ...f... How do we "transfer the unfolding"? Easy: by using the old one, wrapped in work_fn! See CoreUnfold.mkWorkerUnfolding. Note [Activation for INLINABLE worker] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Follows on from Note [Worker-wrapper for INLINABLE functions] It is *vital* that if the worker gets an INLINABLE pragma (from the original function), then the worker has the same phase activation as the wrapper (or later). That is necessary to allow the wrapper to inline into the worker's unfolding: see SimplUtils Note [Simplifying inside stable unfoldings]. Notihng is lost by giving the worker the same activation as the worker, because the worker won't have any chance of inlining until the wrapper does; there's no point in giving it an earlier activation. Note [Don't w/w inline small non-loop-breaker things] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In general, we refrain from w/w-ing *small* functions, which are not loop breakers, because they'll inline anyway. But we must take care: it may look small now, but get to be big later after other inlining has happened. So we take the precaution of adding an INLINE pragma to any such functions. I made this change when I observed a big function at the end of compilation with a useful strictness signature but no w-w. (It was small during demand analysis, we refrained from w/w, and then got big when something was inlined in its rhs.) When I measured it on nofib, it didn't make much difference; just a few percent improved allocation on one benchmark (bspt/Euclid.space). But nothing got worse. There is an infelicity though. We may get something like f = g val ==> g x = case gw x of r -> I# r f {- InlineStable, Template = g val -} f = case gw x of r -> I# r The code for f duplicates that for g, without any real benefit. It won't really be executed, because calls to f will go via the inlining. Note [Wrapper activation] ~~~~~~~~~~~~~~~~~~~~~~~~~ When should the wrapper inlining be active? It must not be active earlier than the current Activation of the Id (eg it might have a NOINLINE pragma). But in fact strictness analysis happens fairly late in the pipeline, and we want to prioritise specialisations over strictness. Eg if we have module Foo where f :: Num a => a -> Int -> a f n 0 = n -- Strict in the Int, hence wrapper f n x = f (n+n) (x-1) g :: Int -> Int g x = f x x -- Provokes a specialisation for f module Bar where import Foo h :: Int -> Int h x = f 3 x Then we want the specialisation for 'f' to kick in before the wrapper does. Now in fact the 'gentle' simplification pass encourages this, by having rules on, but inlinings off. But that's kind of lucky. It seems more robust to give the wrapper an Activation of (ActiveAfter 0), so that it becomes active in an importing module at the same time that it appears in the first place in the defining module. At one stage I tried making the wrapper inlining always-active, and that had a very bad effect on nofib/imaginary/x2n1; a wrapper was inlined before the specialisation fired. -}
5,573
false
false
0
9
1,217
118
57
61
null
null
lemol/HaskellNet
src/Network/HaskellNet/IMAP.hs
bsd-3-clause
listFull :: IMAPConnection -> String -> String -> IO [([Attribute], String, MailboxName)] listFull conn ref pat = sendCommand conn (unwords ["LIST", ref, pat]) pList
174
listFull :: IMAPConnection -> String -> String -> IO [([Attribute], String, MailboxName)] listFull conn ref pat = sendCommand conn (unwords ["LIST", ref, pat]) pList
174
listFull conn ref pat = sendCommand conn (unwords ["LIST", ref, pat]) pList
75
false
true
0
11
32
70
38
32
null
null
joachifm/dagbladet
src/App/Gen.hs
mit
------------------------------------------------------------------------ gen :: RandomGen g => GenOpts -> [T.Text] -> g -> [T.Text] gen opts xs g = take (number opts) . nub . noBoring . map T.unwords . (\xs' -> runMulti (context opts) xs' 0 g) $ map T.words xs where noBoring = filter (\y -> not $ any (T.isPrefixOf y) xs)
371
gen :: RandomGen g => GenOpts -> [T.Text] -> g -> [T.Text] gen opts xs g = take (number opts) . nub . noBoring . map T.unwords . (\xs' -> runMulti (context opts) xs' 0 g) $ map T.words xs where noBoring = filter (\y -> not $ any (T.isPrefixOf y) xs)
297
gen opts xs g = take (number opts) . nub . noBoring . map T.unwords . (\xs' -> runMulti (context opts) xs' 0 g) $ map T.words xs where noBoring = filter (\y -> not $ any (T.isPrefixOf y) xs)
238
true
true
0
12
101
152
75
77
null
null
NorfairKing/eden
src/Solutions.hs
gpl-2.0
ioFilePaths :: Problem -> Eden c [(Maybe FilePath, FilePath)] ioFilePaths p = do dir <- problemDir p cts <- liftIO $ getDirectoryContents dir let os = filter (isPrefixOf outputName) $ cts let is = map ((inputName ++) . drop (length outputName)) os let ifs = map (dir </>) is let ofs = map (dir </>) os tts <- mapM testCase $ zip ifs ofs return $ reverse . sortBy (comparing $ length . snd) $ tts
428
ioFilePaths :: Problem -> Eden c [(Maybe FilePath, FilePath)] ioFilePaths p = do dir <- problemDir p cts <- liftIO $ getDirectoryContents dir let os = filter (isPrefixOf outputName) $ cts let is = map ((inputName ++) . drop (length outputName)) os let ifs = map (dir </>) is let ofs = map (dir </>) os tts <- mapM testCase $ zip ifs ofs return $ reverse . sortBy (comparing $ length . snd) $ tts
428
ioFilePaths p = do dir <- problemDir p cts <- liftIO $ getDirectoryContents dir let os = filter (isPrefixOf outputName) $ cts let is = map ((inputName ++) . drop (length outputName)) os let ifs = map (dir </>) is let ofs = map (dir </>) os tts <- mapM testCase $ zip ifs ofs return $ reverse . sortBy (comparing $ length . snd) $ tts
366
false
true
0
15
108
204
96
108
null
null
nikolaspapirniywork/99_problems
haskell/src/P4.hs
apache-2.0
myLength (_:xs) = 1 + myLength xs
33
myLength (_:xs) = 1 + myLength xs
33
myLength (_:xs) = 1 + myLength xs
33
false
false
2
6
6
25
11
14
null
null
lukexi/ghc-7.8-arm64
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
generateJumpTableForInstr :: DynFlags -> Instr -> Maybe (NatCmmDecl (Alignment, CmmStatics) Instr) generateJumpTableForInstr dflags (JMP_TBL _ ids section lbl) = Just (createJumpTable dflags ids section lbl)
211
generateJumpTableForInstr :: DynFlags -> Instr -> Maybe (NatCmmDecl (Alignment, CmmStatics) Instr) generateJumpTableForInstr dflags (JMP_TBL _ ids section lbl) = Just (createJumpTable dflags ids section lbl)
211
generateJumpTableForInstr dflags (JMP_TBL _ ids section lbl) = Just (createJumpTable dflags ids section lbl)
112
false
true
0
10
28
68
34
34
null
null
gnn/Hets
Common/IRI.hs
gpl-2.0
-- RFC3987, section 2.2 uiquery :: IRIParser st String uiquery = char '?' <:> flat (many iqueryPart)
101
uiquery :: IRIParser st String uiquery = char '?' <:> flat (many iqueryPart)
76
uiquery = char '?' <:> flat (many iqueryPart)
45
true
true
0
8
17
33
16
17
null
null
ckaestne/CIDE
other/CaseStudies/fgl/CIDEfgl/Data/Graph/Inductive/Graph.hs
gpl-3.0
context :: (Graph gr) => gr a b -> Node -> Context a b; context g v = case match v g of { (Nothing, _) -> error ("Match Exception, Node: " ++ show v); (Just c, _) -> c}
196
context :: (Graph gr) => gr a b -> Node -> Context a b context g v = case match v g of { (Nothing, _) -> error ("Match Exception, Node: " ++ show v); (Just c, _) -> c}
193
context g v = case match v g of { (Nothing, _) -> error ("Match Exception, Node: " ++ show v); (Just c, _) -> c}
138
false
true
1
11
67
103
51
52
null
null
mfine/ghc
compiler/main/DynFlags.hs
bsd-3-clause
-- | Define a new flag for GHCi with an effect. flagGhciSpec' :: String -> flag -> (TurnOnFlag -> DynP ()) -> FlagSpec flag flagGhciSpec' name flag act = FlagSpec name flag act OnlyGhci
185
flagGhciSpec' :: String -> flag -> (TurnOnFlag -> DynP ()) -> FlagSpec flag flagGhciSpec' name flag act = FlagSpec name flag act OnlyGhci
137
flagGhciSpec' name flag act = FlagSpec name flag act OnlyGhci
61
true
true
0
11
33
55
27
28
null
null
emc2/static-dict
test/Tests/Data/Dict/FKS.hs
bsd-3-clause
maketest :: (String, Int -> Int) -> Int -> Int -> Test maketest (genname, gen) size num = let testname = "dict_" ++ genname ++ "_" ++ show size ++ "_" ++ show num pairs = map (\n -> (gen n, n)) [0..size - 1] inc (k, e) = (k, e + 1) in testname ~: do d <- dict pairs checkdict pairs d checkdict (fmap inc pairs) (fmap (+1) d) d' <- mapM (return . (+1)) d checkdict (fmap inc pairs) d'
434
maketest :: (String, Int -> Int) -> Int -> Int -> Test maketest (genname, gen) size num = let testname = "dict_" ++ genname ++ "_" ++ show size ++ "_" ++ show num pairs = map (\n -> (gen n, n)) [0..size - 1] inc (k, e) = (k, e + 1) in testname ~: do d <- dict pairs checkdict pairs d checkdict (fmap inc pairs) (fmap (+1) d) d' <- mapM (return . (+1)) d checkdict (fmap inc pairs) d'
434
maketest (genname, gen) size num = let testname = "dict_" ++ genname ++ "_" ++ show size ++ "_" ++ show num pairs = map (\n -> (gen n, n)) [0..size - 1] inc (k, e) = (k, e + 1) in testname ~: do d <- dict pairs checkdict pairs d checkdict (fmap inc pairs) (fmap (+1) d) d' <- mapM (return . (+1)) d checkdict (fmap inc pairs) d'
379
false
true
0
14
133
232
118
114
null
null
beni55/haste-compiler
libraries/ghc-7.10/base/GHC/Arr.hs
bsd-3-clause
negRange :: Int -- Uninformative, but Ix does not provide Show negRange = error "Negative range size"
103
negRange :: Int negRange = error "Negative range size"
54
negRange = error "Negative range size"
38
true
true
0
5
18
15
8
7
null
null
jwiegley/ghc-release
libraries/Cabal/cabal-install/Distribution/Client/Init.hs
gpl-3.0
importsToDeps :: InitFlags -> [ModuleName] -> PackageIndex -> IO [P.Dependency] importsToDeps flags mods pkgIx = do let modMap :: M.Map ModuleName [InstalledPackageInfo] modMap = M.map (filter exposed) $ moduleNameIndex pkgIx modDeps :: [(ModuleName, Maybe [InstalledPackageInfo])] modDeps = map (id &&& flip M.lookup modMap) mods message flags "\nGuessing dependencies..." nub . catMaybes <$> mapM (chooseDep flags) modDeps -- Given a module and a list of installed packages providing it, -- choose a dependency (i.e. package + version range) to use for that -- module.
599
importsToDeps :: InitFlags -> [ModuleName] -> PackageIndex -> IO [P.Dependency] importsToDeps flags mods pkgIx = do let modMap :: M.Map ModuleName [InstalledPackageInfo] modMap = M.map (filter exposed) $ moduleNameIndex pkgIx modDeps :: [(ModuleName, Maybe [InstalledPackageInfo])] modDeps = map (id &&& flip M.lookup modMap) mods message flags "\nGuessing dependencies..." nub . catMaybes <$> mapM (chooseDep flags) modDeps -- Given a module and a list of installed packages providing it, -- choose a dependency (i.e. package + version range) to use for that -- module.
599
importsToDeps flags mods pkgIx = do let modMap :: M.Map ModuleName [InstalledPackageInfo] modMap = M.map (filter exposed) $ moduleNameIndex pkgIx modDeps :: [(ModuleName, Maybe [InstalledPackageInfo])] modDeps = map (id &&& flip M.lookup modMap) mods message flags "\nGuessing dependencies..." nub . catMaybes <$> mapM (chooseDep flags) modDeps -- Given a module and a list of installed packages providing it, -- choose a dependency (i.e. package + version range) to use for that -- module.
519
false
true
0
14
111
160
81
79
null
null
seckcoder/vector
Data/Vector/Generic.hs
bsd-3-clause
unzip3 xs = (map (\(a, _, _) -> a) xs, map (\(_, b, _) -> b) xs, map (\(_, _, c) -> c) xs)
116
unzip3 xs = (map (\(a, _, _) -> a) xs, map (\(_, b, _) -> b) xs, map (\(_, _, c) -> c) xs)
116
unzip3 xs = (map (\(a, _, _) -> a) xs, map (\(_, b, _) -> b) xs, map (\(_, _, c) -> c) xs)
116
false
false
1
10
49
88
49
39
null
null
alexander-at-github/eta
compiler/ETA/Specialise/Rules.hs
bsd-3-clause
-- The rules are are unordered; -- we sort out any overlaps on lookup emptyRuleBase :: RuleBase emptyRuleBase = emptyNameEnv
133
emptyRuleBase :: RuleBase emptyRuleBase = emptyNameEnv
54
emptyRuleBase = emptyNameEnv
28
true
true
0
6
28
20
9
11
null
null
b1g3ar5/CsvDatabase
src/CsvDatabase.hs
gpl-3.0
dselect (CellIndex n) tdb | n > 0 && n <= length tdb = Just (snd (tdb !! (n - 1))) | otherwise = Nothing
148
dselect (CellIndex n) tdb | n > 0 && n <= length tdb = Just (snd (tdb !! (n - 1))) | otherwise = Nothing
148
dselect (CellIndex n) tdb | n > 0 && n <= length tdb = Just (snd (tdb !! (n - 1))) | otherwise = Nothing
148
false
false
0
12
68
70
33
37
null
null
emilaxelsson/ag-graph
src/AG/Internal.hs
bsd-3-clause
-- | Combines the semantic functions for two synthesised attributes to -- form a semantic function for the compound attribute consisting of -- the two original attributes. (|*|) :: (p :< c, q :< c) => Syn f c p -> Syn f c q -> Syn f c (p,q) (|*|) = prodSyn
270
(|*|) :: (p :< c, q :< c) => Syn f c p -> Syn f c q -> Syn f c (p,q) (|*|) = prodSyn
97
(|*|) = prodSyn
15
true
true
0
10
66
78
41
37
null
null
ganeti/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
-- * SPICE video stream detection htKvmSpiceVideoStreamDetectionAll :: String htKvmSpiceVideoStreamDetectionAll = "all"
120
htKvmSpiceVideoStreamDetectionAll :: String htKvmSpiceVideoStreamDetectionAll = "all"
85
htKvmSpiceVideoStreamDetectionAll = "all"
41
true
true
0
4
12
12
7
5
null
null
rleshchinskiy/vector
Data/Vector/Fusion/Bundle/Size.hs
bsd-3-clause
-- | Compute the minimum size from a size hint lowerBound :: Size -> Int lowerBound (Exact n) = n
97
lowerBound :: Size -> Int lowerBound (Exact n) = n
50
lowerBound (Exact n) = n
24
true
true
0
7
19
25
13
12
null
null
gnn/Hets
Driver/Options.hs
gpl-2.0
fullSignS :: String fullSignS = "full-signatures"
49
fullSignS :: String fullSignS = "full-signatures"
49
fullSignS = "full-signatures"
29
false
true
0
4
5
11
6
5
null
null
CovenantEyes/libget-hs
src/Main.hs
mit
removeDirSafely :: FilePath -> IO () removeDirSafely dir = whenM (doesDirectoryExist dir) $ removeDirectoryRecursive dir
124
removeDirSafely :: FilePath -> IO () removeDirSafely dir = whenM (doesDirectoryExist dir) $ removeDirectoryRecursive dir
123
removeDirSafely dir = whenM (doesDirectoryExist dir) $ removeDirectoryRecursive dir
86
false
true
0
8
18
39
18
21
null
null
steffenomak/file-indexer
src/Database/FileCache.hs
gpl-3.0
insertFile :: MonadIO m => F.File -- ^ File to add -> SqlPersistT m F.File -- ^ File returned with the id set. insertFile file = let f = File (pack $! takeFileName $ L.view F.path file) (pack $! dropFileName $ L.view F.path file) (L.view F.size file) (L.view F.accessTime file) (L.view F.modTime file) (permissionToWord $ L.view F.user file) (permissionToWord $ L.view F.group file) (permissionToWord $ L.view F.other file) in maybe (insert f >>= \k -> return $! L.set F.id (Just (fromSqlKey k)) file) (\i -> insertKey (toSqlKey i) f >> return file) (L.view F.id file)
819
insertFile :: MonadIO m => F.File -- ^ File to add -> SqlPersistT m F.File insertFile file = let f = File (pack $! takeFileName $ L.view F.path file) (pack $! dropFileName $ L.view F.path file) (L.view F.size file) (L.view F.accessTime file) (L.view F.modTime file) (permissionToWord $ L.view F.user file) (permissionToWord $ L.view F.group file) (permissionToWord $ L.view F.other file) in maybe (insert f >>= \k -> return $! L.set F.id (Just (fromSqlKey k)) file) (\i -> insertKey (toSqlKey i) f >> return file) (L.view F.id file)
783
insertFile file = let f = File (pack $! takeFileName $ L.view F.path file) (pack $! dropFileName $ L.view F.path file) (L.view F.size file) (L.view F.accessTime file) (L.view F.modTime file) (permissionToWord $ L.view F.user file) (permissionToWord $ L.view F.group file) (permissionToWord $ L.view F.other file) in maybe (insert f >>= \k -> return $! L.set F.id (Just (fromSqlKey k)) file) (\i -> insertKey (toSqlKey i) f >> return file) (L.view F.id file)
665
true
true
0
16
345
275
136
139
null
null
alokpndy/haskell-learn
src/dataScience/Graph.hs
mit
hex = hexHexGrid 4
18
hex = hexHexGrid 4
18
hex = hexHexGrid 4
18
false
false
0
5
3
9
4
5
null
null
BeerAndProgramming/BeerAndProgrammingSite
GeneralFunctions.hs
bsd-2-clause
adminLayout :: GWidget App App () -> GHandler App App RepHtml adminLayout widget = do master <- getYesod mmsg <- getMessage (title', parents) <- breadcrumbs userEmail <- fmap usersEmail maybeAuth emailHash <- fmap lowerEmailHash maybeAuth pc <- widgetToPageContent $ do $(widgetFile "normalize") addStylesheet $ StaticR css_bootstrap_css addStylesheetRemote "/static/css/fonts.css" addScriptRemote "/static/js/jquery.js" addScriptRemote "/static/js/bootstrap.min.js" addScriptRemote "/static/js/textAreaExpander.js" addScriptRemote "/static/js/showdown.js" addScriptRemote "/static/js/extensions/github.js" $(widgetFile "admin/admin-layout") hamletToRepHtml $(hamletFile "templates/admin/admin-layout-wrapper.hamlet")
822
adminLayout :: GWidget App App () -> GHandler App App RepHtml adminLayout widget = do master <- getYesod mmsg <- getMessage (title', parents) <- breadcrumbs userEmail <- fmap usersEmail maybeAuth emailHash <- fmap lowerEmailHash maybeAuth pc <- widgetToPageContent $ do $(widgetFile "normalize") addStylesheet $ StaticR css_bootstrap_css addStylesheetRemote "/static/css/fonts.css" addScriptRemote "/static/js/jquery.js" addScriptRemote "/static/js/bootstrap.min.js" addScriptRemote "/static/js/textAreaExpander.js" addScriptRemote "/static/js/showdown.js" addScriptRemote "/static/js/extensions/github.js" $(widgetFile "admin/admin-layout") hamletToRepHtml $(hamletFile "templates/admin/admin-layout-wrapper.hamlet")
822
adminLayout widget = do master <- getYesod mmsg <- getMessage (title', parents) <- breadcrumbs userEmail <- fmap usersEmail maybeAuth emailHash <- fmap lowerEmailHash maybeAuth pc <- widgetToPageContent $ do $(widgetFile "normalize") addStylesheet $ StaticR css_bootstrap_css addStylesheetRemote "/static/css/fonts.css" addScriptRemote "/static/js/jquery.js" addScriptRemote "/static/js/bootstrap.min.js" addScriptRemote "/static/js/textAreaExpander.js" addScriptRemote "/static/js/showdown.js" addScriptRemote "/static/js/extensions/github.js" $(widgetFile "admin/admin-layout") hamletToRepHtml $(hamletFile "templates/admin/admin-layout-wrapper.hamlet")
760
false
true
0
13
167
175
73
102
null
null
alexander-at-github/eta
compiler/ETA/Prelude/PrelNames.hs
bsd-3-clause
gHC_EXTS = mkBaseModule (fsLit "GHC.Exts")
49
gHC_EXTS = mkBaseModule (fsLit "GHC.Exts")
49
gHC_EXTS = mkBaseModule (fsLit "GHC.Exts")
49
false
false
1
7
11
18
7
11
null
null
DavidAlphaFox/ghc
utils/haddock/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs
bsd-3-clause
-- | This function is how we read keys. -- -- all fields in the header are optional and have the form -- -- [spaces1][field name][spaces] ":" -- [text]"\n" ([spaces2][space][text]"\n" | [spaces]"\n")* -- where each [spaces2] should have [spaces1] as a prefix. -- -- Thus for the key "Description", -- -- > Description : this is a -- > rather long -- > -- > description -- > -- > The module comment starts here -- -- the value will be "this is a .. description" and the rest will begin -- at "The module comment". parseKey :: String -> String -> Maybe (String,String) parseKey key toParse0 = do let (spaces0,toParse1) = extractLeadingSpaces toParse0 indentation = spaces0 afterKey0 <- extractPrefix key toParse1 let afterKey1 = extractLeadingSpaces afterKey0 afterColon0 <- case snd afterKey1 of ':':afterColon -> return afterColon _ -> Nothing let (_,afterColon1) = extractLeadingSpaces afterColon0 return (scanKey True indentation afterColon1) where scanKey :: Bool -> String -> String -> (String,String) scanKey _ _ [] = ([],[]) scanKey isFirst indentation str = let (nextLine,rest1) = extractNextLine str accept = isFirst || sufficientIndentation || allSpaces sufficientIndentation = case extractPrefix indentation nextLine of Just (c:_) | isSpace c -> True _ -> False allSpaces = case extractLeadingSpaces nextLine of (_,[]) -> True _ -> False in if accept then let (scanned1,rest2) = scanKey False indentation rest1 scanned2 = case scanned1 of "" -> if allSpaces then "" else nextLine _ -> nextLine ++ "\n" ++ scanned1 in (scanned2,rest2) else ([],str) extractLeadingSpaces :: String -> (String,String) extractLeadingSpaces [] = ([],[]) extractLeadingSpaces (s@(c:cs)) | isSpace c = let (spaces1,cs1) = extractLeadingSpaces cs in (c:spaces1,cs1) | otherwise = ([],s) extractNextLine :: String -> (String,String) extractNextLine [] = ([],[]) extractNextLine (c:cs) | c == '\n' = ([],cs) | otherwise = let (line,rest) = extractNextLine cs in (c:line,rest) -- comparison is case-insensitive. extractPrefix :: String -> String -> Maybe String extractPrefix [] s = Just s extractPrefix _ [] = Nothing extractPrefix (c1:cs1) (c2:cs2) | toUpper c1 == toUpper c2 = extractPrefix cs1 cs2 | otherwise = Nothing
2,926
parseKey :: String -> String -> Maybe (String,String) parseKey key toParse0 = do let (spaces0,toParse1) = extractLeadingSpaces toParse0 indentation = spaces0 afterKey0 <- extractPrefix key toParse1 let afterKey1 = extractLeadingSpaces afterKey0 afterColon0 <- case snd afterKey1 of ':':afterColon -> return afterColon _ -> Nothing let (_,afterColon1) = extractLeadingSpaces afterColon0 return (scanKey True indentation afterColon1) where scanKey :: Bool -> String -> String -> (String,String) scanKey _ _ [] = ([],[]) scanKey isFirst indentation str = let (nextLine,rest1) = extractNextLine str accept = isFirst || sufficientIndentation || allSpaces sufficientIndentation = case extractPrefix indentation nextLine of Just (c:_) | isSpace c -> True _ -> False allSpaces = case extractLeadingSpaces nextLine of (_,[]) -> True _ -> False in if accept then let (scanned1,rest2) = scanKey False indentation rest1 scanned2 = case scanned1 of "" -> if allSpaces then "" else nextLine _ -> nextLine ++ "\n" ++ scanned1 in (scanned2,rest2) else ([],str) extractLeadingSpaces :: String -> (String,String) extractLeadingSpaces [] = ([],[]) extractLeadingSpaces (s@(c:cs)) | isSpace c = let (spaces1,cs1) = extractLeadingSpaces cs in (c:spaces1,cs1) | otherwise = ([],s) extractNextLine :: String -> (String,String) extractNextLine [] = ([],[]) extractNextLine (c:cs) | c == '\n' = ([],cs) | otherwise = let (line,rest) = extractNextLine cs in (c:line,rest) -- comparison is case-insensitive. extractPrefix :: String -> String -> Maybe String extractPrefix [] s = Just s extractPrefix _ [] = Nothing extractPrefix (c1:cs1) (c2:cs2) | toUpper c1 == toUpper c2 = extractPrefix cs1 cs2 | otherwise = Nothing
2,404
parseKey key toParse0 = do let (spaces0,toParse1) = extractLeadingSpaces toParse0 indentation = spaces0 afterKey0 <- extractPrefix key toParse1 let afterKey1 = extractLeadingSpaces afterKey0 afterColon0 <- case snd afterKey1 of ':':afterColon -> return afterColon _ -> Nothing let (_,afterColon1) = extractLeadingSpaces afterColon0 return (scanKey True indentation afterColon1) where scanKey :: Bool -> String -> String -> (String,String) scanKey _ _ [] = ([],[]) scanKey isFirst indentation str = let (nextLine,rest1) = extractNextLine str accept = isFirst || sufficientIndentation || allSpaces sufficientIndentation = case extractPrefix indentation nextLine of Just (c:_) | isSpace c -> True _ -> False allSpaces = case extractLeadingSpaces nextLine of (_,[]) -> True _ -> False in if accept then let (scanned1,rest2) = scanKey False indentation rest1 scanned2 = case scanned1 of "" -> if allSpaces then "" else nextLine _ -> nextLine ++ "\n" ++ scanned1 in (scanned2,rest2) else ([],str) extractLeadingSpaces :: String -> (String,String) extractLeadingSpaces [] = ([],[]) extractLeadingSpaces (s@(c:cs)) | isSpace c = let (spaces1,cs1) = extractLeadingSpaces cs in (c:spaces1,cs1) | otherwise = ([],s) extractNextLine :: String -> (String,String) extractNextLine [] = ([],[]) extractNextLine (c:cs) | c == '\n' = ([],cs) | otherwise = let (line,rest) = extractNextLine cs in (c:line,rest) -- comparison is case-insensitive. extractPrefix :: String -> String -> Maybe String extractPrefix [] s = Just s extractPrefix _ [] = Nothing extractPrefix (c1:cs1) (c2:cs2) | toUpper c1 == toUpper c2 = extractPrefix cs1 cs2 | otherwise = Nothing
2,350
true
true
0
16
1,060
744
387
357
null
null
nightscape/platform
shared/src/Unison/Typechecker/Context.hs
mit
freshenVar :: Var v => v -> M v v freshenVar v = M (\(Env id ctx) -> Right (Var.freshenId id v, Env (id+1) ctx))
112
freshenVar :: Var v => v -> M v v freshenVar v = M (\(Env id ctx) -> Right (Var.freshenId id v, Env (id+1) ctx))
112
freshenVar v = M (\(Env id ctx) -> Right (Var.freshenId id v, Env (id+1) ctx))
78
false
true
0
12
24
82
39
43
null
null
yiannist/ganeti
src/Ganeti/Utils.hs
bsd-2-clause
watchFileBy :: FilePath -> Int -> (a -> Bool) -> IO a -> IO a watchFileBy fpath timeout check read_fn = do current <- getCurrentTimeUSec let endtime = current + fromIntegral timeout * 1000000 fstat <- getFStatSafe fpath ref <- newIORef fstat bracket initINotify killINotify $ \inotify -> do let do_watch e = do logDebug $ "Notified of change in " ++ fpath ++ "; event: " ++ show e when (e == Ignored) (addWatch inotify [Modify, Delete] fpath do_watch >> return ()) fstat' <- getFStatSafe fpath writeIORef ref fstat' _ <- addWatch inotify [Modify, Delete] fpath do_watch newval <- read_fn if check newval then do logDebug $ "File " ++ fpath ++ " changed during setup of inotify" return newval else watchFileEx endtime fstat ref check read_fn -- | Within the given timeout (in seconds), wait for for the output -- of the given method to change and return the new value; make use of -- the promise that the method will only change its value, if -- the given file changes on disk. If the file does not exist on disk, return -- immediately.
1,271
watchFileBy :: FilePath -> Int -> (a -> Bool) -> IO a -> IO a watchFileBy fpath timeout check read_fn = do current <- getCurrentTimeUSec let endtime = current + fromIntegral timeout * 1000000 fstat <- getFStatSafe fpath ref <- newIORef fstat bracket initINotify killINotify $ \inotify -> do let do_watch e = do logDebug $ "Notified of change in " ++ fpath ++ "; event: " ++ show e when (e == Ignored) (addWatch inotify [Modify, Delete] fpath do_watch >> return ()) fstat' <- getFStatSafe fpath writeIORef ref fstat' _ <- addWatch inotify [Modify, Delete] fpath do_watch newval <- read_fn if check newval then do logDebug $ "File " ++ fpath ++ " changed during setup of inotify" return newval else watchFileEx endtime fstat ref check read_fn -- | Within the given timeout (in seconds), wait for for the output -- of the given method to change and return the new value; make use of -- the promise that the method will only change its value, if -- the given file changes on disk. If the file does not exist on disk, return -- immediately.
1,271
watchFileBy fpath timeout check read_fn = do current <- getCurrentTimeUSec let endtime = current + fromIntegral timeout * 1000000 fstat <- getFStatSafe fpath ref <- newIORef fstat bracket initINotify killINotify $ \inotify -> do let do_watch e = do logDebug $ "Notified of change in " ++ fpath ++ "; event: " ++ show e when (e == Ignored) (addWatch inotify [Modify, Delete] fpath do_watch >> return ()) fstat' <- getFStatSafe fpath writeIORef ref fstat' _ <- addWatch inotify [Modify, Delete] fpath do_watch newval <- read_fn if check newval then do logDebug $ "File " ++ fpath ++ " changed during setup of inotify" return newval else watchFileEx endtime fstat ref check read_fn -- | Within the given timeout (in seconds), wait for for the output -- of the given method to change and return the new value; make use of -- the promise that the method will only change its value, if -- the given file changes on disk. If the file does not exist on disk, return -- immediately.
1,209
false
true
0
20
421
287
135
152
null
null
5outh/Bang
src/Bang/Music/Transform.hs
mit
normalizeC1 (x : xs) = cconcat $ map (withDuration (musicDuration x)) (x : xs)
78
normalizeC1 (x : xs) = cconcat $ map (withDuration (musicDuration x)) (x : xs)
78
normalizeC1 (x : xs) = cconcat $ map (withDuration (musicDuration x)) (x : xs)
78
false
false
0
10
13
44
22
22
null
null
rueshyna/gogol
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
mpl-2.0
-- | Creates a value of 'DatafeedStatusExample' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'dseLineNumber' -- -- * 'dseItemId' -- -- * 'dseValue' datafeedStatusExample :: DatafeedStatusExample datafeedStatusExample = DatafeedStatusExample' { _dseLineNumber = Nothing , _dseItemId = Nothing , _dseValue = Nothing }
427
datafeedStatusExample :: DatafeedStatusExample datafeedStatusExample = DatafeedStatusExample' { _dseLineNumber = Nothing , _dseItemId = Nothing , _dseValue = Nothing }
191
datafeedStatusExample = DatafeedStatusExample' { _dseLineNumber = Nothing , _dseItemId = Nothing , _dseValue = Nothing }
140
true
true
1
7
84
47
29
18
null
null
ComputationWithBoundedResources/tct-trs
src/Tct/Trs/Data/Precedence.hs
bsd-3-clause
empty :: Signature f -> Precedence f empty sig = precedence sig []
66
empty :: Signature f -> Precedence f empty sig = precedence sig []
66
empty sig = precedence sig []
29
false
true
0
6
12
31
14
17
null
null
snoyberg/ghc
compiler/utils/Pretty.hs
bsd-3-clause
-- Specfication: aboveNest p g k q = p $g$ (nest k q) aboveNest :: RDoc -> Bool -> Int -> RDoc -> RDoc aboveNest _ _ k _ | k `seq` False = undefined
166
aboveNest :: RDoc -> Bool -> Int -> RDoc -> RDoc aboveNest _ _ k _ | k `seq` False = undefined
112
aboveNest _ _ k _ | k `seq` False = undefined
63
true
true
0
8
52
49
25
24
null
null
SebastianCallh/liu-courses
src/LiuCourses.hs
mit
runApp :: Config -> IO () runApp config = do environment <- getEnvironment options <- getOptions environment let reader m = runReaderT (runConfig m) config scottyOptsT options reader $ app config
203
runApp :: Config -> IO () runApp config = do environment <- getEnvironment options <- getOptions environment let reader m = runReaderT (runConfig m) config scottyOptsT options reader $ app config
203
runApp config = do environment <- getEnvironment options <- getOptions environment let reader m = runReaderT (runConfig m) config scottyOptsT options reader $ app config
177
false
true
0
12
38
78
34
44
null
null
edsko/cabal
cabal-install/Distribution/Client/Dependency/Modular/Preference.hs
bsd-3-clause
enforceManualFlags :: Tree QGoalReasonChain -> Tree QGoalReasonChain enforceManualFlags = trav go where go (FChoiceF qfn gr tr True ts) = FChoiceF qfn gr tr True $ let c = toConflictSet (Goal (F qfn) gr) in case span isDisabled (P.toList ts) of ([], y : ys) -> P.fromList (y : L.map (\ (b, _) -> (b, Fail c ManualFlag)) ys) _ -> ts -- something has been manually selected, leave things alone where isDisabled (_, Fail _ (GlobalConstraintFlag _)) = True isDisabled _ = False go x = x -- | Require installed packages.
681
enforceManualFlags :: Tree QGoalReasonChain -> Tree QGoalReasonChain enforceManualFlags = trav go where go (FChoiceF qfn gr tr True ts) = FChoiceF qfn gr tr True $ let c = toConflictSet (Goal (F qfn) gr) in case span isDisabled (P.toList ts) of ([], y : ys) -> P.fromList (y : L.map (\ (b, _) -> (b, Fail c ManualFlag)) ys) _ -> ts -- something has been manually selected, leave things alone where isDisabled (_, Fail _ (GlobalConstraintFlag _)) = True isDisabled _ = False go x = x -- | Require installed packages.
681
enforceManualFlags = trav go where go (FChoiceF qfn gr tr True ts) = FChoiceF qfn gr tr True $ let c = toConflictSet (Goal (F qfn) gr) in case span isDisabled (P.toList ts) of ([], y : ys) -> P.fromList (y : L.map (\ (b, _) -> (b, Fail c ManualFlag)) ys) _ -> ts -- something has been manually selected, leave things alone where isDisabled (_, Fail _ (GlobalConstraintFlag _)) = True isDisabled _ = False go x = x -- | Require installed packages.
612
false
true
0
18
258
222
111
111
null
null
dsorokin/aivika-experiment-cairo
Simulation/Aivika/Experiment/Chart/Backend/Cairo.hs
bsd-3-clause
-- | The default layout. defaultLayout :: Layout Double Double -> Layout Double Double defaultLayout layout = layout_title_style .~ defaultTitleFontStyle $ layout_all_font_styles .~ defaultFontStyle $ layout
213
defaultLayout :: Layout Double Double -> Layout Double Double defaultLayout layout = layout_title_style .~ defaultTitleFontStyle $ layout_all_font_styles .~ defaultFontStyle $ layout
188
defaultLayout layout = layout_title_style .~ defaultTitleFontStyle $ layout_all_font_styles .~ defaultFontStyle $ layout
126
true
true
4
7
31
53
25
28
null
null
brendanhay/gogol
gogol-dialogflow/gen/Network/Google/Resource/DialogFlow/Projects/Locations/Agents/Flows/Pages/Create.hs
mpl-2.0
-- | JSONP plafpcCallback :: Lens' ProjectsLocationsAgentsFlowsPagesCreate (Maybe Text) plafpcCallback = lens _plafpcCallback (\ s a -> s{_plafpcCallback = a})
167
plafpcCallback :: Lens' ProjectsLocationsAgentsFlowsPagesCreate (Maybe Text) plafpcCallback = lens _plafpcCallback (\ s a -> s{_plafpcCallback = a})
156
plafpcCallback = lens _plafpcCallback (\ s a -> s{_plafpcCallback = a})
79
true
true
0
9
27
48
25
23
null
null
acowley/ghc
testsuite/tests/typecheck/should_fail/T6018failclosed10.hs
bsd-3-clause
bar :: Bar a -> Bar a bar x = x
31
bar :: Bar a -> Bar a bar x = x
31
bar x = x
9
false
true
0
6
10
24
11
13
null
null
Persi/shellcheck
ShellCheck/Parser.hs
gpl-3.0
prop_readBackTicked5 = isOk readSimpleCommand "echo `foo`bar"
61
prop_readBackTicked5 = isOk readSimpleCommand "echo `foo`bar"
61
prop_readBackTicked5 = isOk readSimpleCommand "echo `foo`bar"
61
false
false
0
5
5
11
5
6
null
null
tfausak/exercism-solutions
haskell/word-count/WordCount.hs
mit
isAllowed :: Char -> Bool isAllowed c = isAlphaNum c || isSpace c
65
isAllowed :: Char -> Bool isAllowed c = isAlphaNum c || isSpace c
65
isAllowed c = isAlphaNum c || isSpace c
39
false
true
1
7
12
34
14
20
null
null
ctford/Idris-Elba-dev
src/Util/System.hs
bsd-3-clause
tempfile :: IO (FilePath, Handle) tempfile = do dir <- getTemporaryDirectory openTempFile (normalise dir) "idris"
127
tempfile :: IO (FilePath, Handle) tempfile = do dir <- getTemporaryDirectory openTempFile (normalise dir) "idris"
127
tempfile = do dir <- getTemporaryDirectory openTempFile (normalise dir) "idris"
93
false
true
0
10
28
47
21
26
null
null
rueshyna/gogol
gogol-compute/gen/Network/Google/Compute/Types/Product.hs
mpl-2.0
-- | [Output Only] Status of the zone, either UP or DOWN. zStatus :: Lens' Zone (Maybe ZoneStatus) zStatus = lens _zStatus (\ s a -> s{_zStatus = a})
149
zStatus :: Lens' Zone (Maybe ZoneStatus) zStatus = lens _zStatus (\ s a -> s{_zStatus = a})
91
zStatus = lens _zStatus (\ s a -> s{_zStatus = a})
50
true
true
2
9
28
55
25
30
null
null
hausdorff/pyli
src/Lexer.hs
mit
escbs (s:xs) = s:(escbs xs)
36
escbs (s:xs) = s:(escbs xs)
36
escbs (s:xs) = s:(escbs xs)
36
false
false
0
7
13
27
13
14
null
null
M42/mikrokosmos
source/Main.hs
gpl-3.0
readAllModuleDeps :: [Modulename] -> IO (Maybe [Modulename]) readAllModuleDeps modulenames = do files <- mapM findFilename modulenames deps <- mapM (mapM readFileDependencies) files return (concat <$> sequence deps) -- | Read module dependencies recursively. -- Returns an error if a dependency cannot be found
319
readAllModuleDeps :: [Modulename] -> IO (Maybe [Modulename]) readAllModuleDeps modulenames = do files <- mapM findFilename modulenames deps <- mapM (mapM readFileDependencies) files return (concat <$> sequence deps) -- | Read module dependencies recursively. -- Returns an error if a dependency cannot be found
319
readAllModuleDeps modulenames = do files <- mapM findFilename modulenames deps <- mapM (mapM readFileDependencies) files return (concat <$> sequence deps) -- | Read module dependencies recursively. -- Returns an error if a dependency cannot be found
258
false
true
0
10
51
81
39
42
null
null
AlexanderPankiv/ghc
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprAddr (AddrRegImm r1 imm) = hcat [ pprImm imm, char '(', pprReg r1, char ')' ]
80
pprAddr (AddrRegImm r1 imm) = hcat [ pprImm imm, char '(', pprReg r1, char ')' ]
80
pprAddr (AddrRegImm r1 imm) = hcat [ pprImm imm, char '(', pprReg r1, char ')' ]
80
false
false
0
7
15
45
21
24
null
null
ekmett/generic-deriving
src/Generics/Deriving/TH.hs
bsd-3-clause
lrP m i p = conP 'R1 [lrP (m-1) (i-1) p]
40
lrP m i p = conP 'R1 [lrP (m-1) (i-1) p]
40
lrP m i p = conP 'R1 [lrP (m-1) (i-1) p]
40
false
false
0
9
10
44
22
22
null
null
christiaanb/clash-compiler
tests/shouldwork/Fixed/SFixedTest.hs
bsd-2-clause
expectedOutput :: Signal SF -> Signal Bool expectedOutput = outputVerifier $ $(v ([3.07199, 4.607991, 8.96] :: [SFixed 4 18]))
126
expectedOutput :: Signal SF -> Signal Bool expectedOutput = outputVerifier $ $(v ([3.07199, 4.607991, 8.96] :: [SFixed 4 18]))
126
expectedOutput = outputVerifier $ $(v ([3.07199, 4.607991, 8.96] :: [SFixed 4 18]))
83
false
true
0
12
18
61
30
31
null
null
naoto-ogawa/h-xproto-mysql
src/DataBase/MySQLX/Model.hs
mit
mkOperatorGt = mkOperator ">"
34
mkOperatorGt = mkOperator ">"
34
mkOperatorGt = mkOperator ">"
34
false
false
1
5
8
12
4
8
null
null
damianfral/clay
src/Clay/Elements.hs
bsd-3-clause
pre = "pre"
11
pre = "pre"
11
pre = "pre"
11
false
false
1
5
2
10
3
7
null
null
aurapm/aura
aura/lib/Aura/Languages.hs
gpl-3.0
reportPkgsToInstall_1 :: Language -> Doc AnsiStyle reportPkgsToInstall_1 = \case Japanese -> "Pacmanの従属パッケージ:" Polish -> "Zależności z repozytoriów:" Croatian -> "Zavisnosti iz repozitorija:" Swedish -> "Beroenden ifrån lager:" German -> "Abhängigkeiten in den Paketquellen:" Spanish -> "Dependencias del repositorio:" Portuguese -> "Dependências no repositório:" French -> "Dépendances du dépôt :" Russian -> "Зависимости из репозитория:" Italian -> "Dipendenze del repository:" Serbian -> "Зависности из ризница:" Norwegian -> "Avhengigheter fra depotet:" Indonesia -> "Dependensi dari repositori:" Chinese -> "仓库依赖:" Esperanto -> "Dependecoj de deponejo:" Dutch -> "Repository afhankelijkheden:" _ -> "Repository dependencies:" -- NEEDS AN UPDATE
869
reportPkgsToInstall_1 :: Language -> Doc AnsiStyle reportPkgsToInstall_1 = \case Japanese -> "Pacmanの従属パッケージ:" Polish -> "Zależności z repozytoriów:" Croatian -> "Zavisnosti iz repozitorija:" Swedish -> "Beroenden ifrån lager:" German -> "Abhängigkeiten in den Paketquellen:" Spanish -> "Dependencias del repositorio:" Portuguese -> "Dependências no repositório:" French -> "Dépendances du dépôt :" Russian -> "Зависимости из репозитория:" Italian -> "Dipendenze del repository:" Serbian -> "Зависности из ризница:" Norwegian -> "Avhengigheter fra depotet:" Indonesia -> "Dependensi dari repositori:" Chinese -> "仓库依赖:" Esperanto -> "Dependecoj de deponejo:" Dutch -> "Repository afhankelijkheden:" _ -> "Repository dependencies:" -- NEEDS AN UPDATE
869
reportPkgsToInstall_1 = \case Japanese -> "Pacmanの従属パッケージ:" Polish -> "Zależności z repozytoriów:" Croatian -> "Zavisnosti iz repozitorija:" Swedish -> "Beroenden ifrån lager:" German -> "Abhängigkeiten in den Paketquellen:" Spanish -> "Dependencias del repositorio:" Portuguese -> "Dependências no repositório:" French -> "Dépendances du dépôt :" Russian -> "Зависимости из репозитория:" Italian -> "Dipendenze del repository:" Serbian -> "Зависности из ризница:" Norwegian -> "Avhengigheter fra depotet:" Indonesia -> "Dependensi dari repositori:" Chinese -> "仓库依赖:" Esperanto -> "Dependecoj de deponejo:" Dutch -> "Repository afhankelijkheden:" _ -> "Repository dependencies:" -- NEEDS AN UPDATE
818
false
true
17
6
213
156
62
94
null
null
JPMoresmau/leksah
src/IDE/Find.hs
gpl-2.0
black = Color 0 0 0
19
black = Color 0 0 0
19
black = Color 0 0 0
19
false
false
1
5
5
19
6
13
null
null
damoxc/ganeti
src/Ganeti/HTools/Node.hs
gpl-2.0
-- | Sets the unnaccounted memory. setXmem :: Node -> Int -> Node setXmem t val = t { xMem = val }
98
setXmem :: Node -> Int -> Node setXmem t val = t { xMem = val }
63
setXmem t val = t { xMem = val }
32
true
true
0
8
22
39
19
20
null
null
mgsloan/compconfig
env/src/Process.hs
mit
-- | returns Just pid or Nothing if process has already exited -- -- (copy+modified from https://stackoverflow.com/a/27388709) getPid :: P.ProcessHandle -> IO (Maybe ProcessID) getPid ph = P.withProcessHandle ph go where go ph_ = case ph_ of P.OpenHandle x -> return $ Just x P.OpenExtHandle x _ _ -> return $ Just x P.ClosedHandle _ -> return Nothing
375
getPid :: P.ProcessHandle -> IO (Maybe ProcessID) getPid ph = P.withProcessHandle ph go where go ph_ = case ph_ of P.OpenHandle x -> return $ Just x P.OpenExtHandle x _ _ -> return $ Just x P.ClosedHandle _ -> return Nothing
248
getPid ph = P.withProcessHandle ph go where go ph_ = case ph_ of P.OpenHandle x -> return $ Just x P.OpenExtHandle x _ _ -> return $ Just x P.ClosedHandle _ -> return Nothing
198
true
true
1
9
81
115
52
63
null
null
wildlyinaccurate/lishp
src/Lishp/Primitives.hs
mit
unpackIntegral (List [n]) = unpackIntegral n
44
unpackIntegral (List [n]) = unpackIntegral n
44
unpackIntegral (List [n]) = unpackIntegral n
44
false
false
0
8
5
21
10
11
null
null
snowleopard/alga
src/Algebra/Graph/NonEmpty.hs
mit
-- See the Note [The implementation of hasEdge] in "Algebra.Graph". -- | Check if a graph contains a given edge. -- Complexity: /O(s)/ time. -- -- @ -- hasEdge x y ('vertex' z) == False -- hasEdge x y ('edge' x y) == True -- hasEdge x y . 'removeEdge' x y == 'const' False -- hasEdge x y == 'elem' (x,y) . 'edgeList' -- @ hasEdge :: Eq a => a -> a -> Graph a -> Bool hasEdge s t g = foldg1 v o c g 0 == 2 where v x 0 = if x == s then 1 else 0 v x _ = if x == t then 2 else 1 o x y a = case x a of 0 -> y a 1 -> if y a == 2 then 2 else 1 _ -> 2 :: Int c x y a = case x a of { 2 -> 2; res -> y res }
673
hasEdge :: Eq a => a -> a -> Graph a -> Bool hasEdge s t g = foldg1 v o c g 0 == 2 where v x 0 = if x == s then 1 else 0 v x _ = if x == t then 2 else 1 o x y a = case x a of 0 -> y a 1 -> if y a == 2 then 2 else 1 _ -> 2 :: Int c x y a = case x a of { 2 -> 2; res -> y res }
322
hasEdge s t g = foldg1 v o c g 0 == 2 where v x 0 = if x == s then 1 else 0 v x _ = if x == t then 2 else 1 o x y a = case x a of 0 -> y a 1 -> if y a == 2 then 2 else 1 _ -> 2 :: Int c x y a = case x a of { 2 -> 2; res -> y res }
277
true
true
0
10
239
207
109
98
null
null
jrahm/DuckTest
src/DuckTest/Internal/State.hs
bsd-2-clause
stateToType :: InternalState e -> DuckTest e PyType stateToType st@(InternalState m _ _) = do let lst = Map.toList m newlst <- mapM (\(k, v) -> (,) k <$> runDeferred st v) lst return $ Scalar Nothing (Map.fromList newlst)
233
stateToType :: InternalState e -> DuckTest e PyType stateToType st@(InternalState m _ _) = do let lst = Map.toList m newlst <- mapM (\(k, v) -> (,) k <$> runDeferred st v) lst return $ Scalar Nothing (Map.fromList newlst)
233
stateToType st@(InternalState m _ _) = do let lst = Map.toList m newlst <- mapM (\(k, v) -> (,) k <$> runDeferred st v) lst return $ Scalar Nothing (Map.fromList newlst)
181
false
true
9
10
50
108
55
53
null
null
rodrigogribeiro/mptc
src/Tc/Kc/KcDriver.hs
bsd-3-clause
insKind :: Decl -> Kind -> Kc () insKind d@(ClassDecl _ _ _ _ _ _) k = addClassKind (name d) k
94
insKind :: Decl -> Kind -> Kc () insKind d@(ClassDecl _ _ _ _ _ _) k = addClassKind (name d) k
94
insKind d@(ClassDecl _ _ _ _ _ _) k = addClassKind (name d) k
61
false
true
0
8
21
59
29
30
null
null
michalkonecny/aern2
aern2-mfun/src/AERN2/BoxFunMinMax/Expressions/Parsers/Smt.hs
bsd-3-clause
findVariablesInExpressions (Var v) = [v]
40
findVariablesInExpressions (Var v) = [v]
40
findVariablesInExpressions (Var v) = [v]
40
false
false
0
6
4
19
9
10
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_419 (44#) = happyGoto action_273
39
action_419 (44#) = happyGoto action_273
39
action_419 (44#) = happyGoto action_273
39
false
false
0
6
4
15
7
8
null
null
faylang/snaplet-fay
src/Snap/Snaplet/Fay/Internal.hs
bsd-3-clause
-- | Print log messages when the verbose flag is set verbosePut :: Fay -> String -> IO () verbosePut config = when (verbose config) . putStrLn . ("snaplet-fay: " ++ )
166
verbosePut :: Fay -> String -> IO () verbosePut config = when (verbose config) . putStrLn . ("snaplet-fay: " ++ )
113
verbosePut config = when (verbose config) . putStrLn . ("snaplet-fay: " ++ )
76
true
true
0
9
31
49
25
24
null
null
MicheleCastrovilli/Euphs
Bots/MusicBot/YoutubeAPI.hs
bsd-3-clause
-- | Parsing a request from a link parseRequest :: String -> Maybe YoutubeRequest parseRequest request = do uri <- parseURI request A.<|> (parseURIReference $ "//" ++ request) uriAuth <- uriAuthority uri parseGoogle uri uriAuth A.<|> parseYoutube uri uriAuth -- | Parsing a google referral link
307
parseRequest :: String -> Maybe YoutubeRequest parseRequest request = do uri <- parseURI request A.<|> (parseURIReference $ "//" ++ request) uriAuth <- uriAuthority uri parseGoogle uri uriAuth A.<|> parseYoutube uri uriAuth -- | Parsing a google referral link
272
parseRequest request = do uri <- parseURI request A.<|> (parseURIReference $ "//" ++ request) uriAuth <- uriAuthority uri parseGoogle uri uriAuth A.<|> parseYoutube uri uriAuth -- | Parsing a google referral link
225
true
true
0
11
58
79
37
42
null
null
brooksbp/pic
src/Data/IntelHex.hs
bsd-3-clause
parse :: B8.ByteString -> Either String [Record] parse = P8.parseOnly (parseRecords <* P8.endOfInput) where parseRecords = P8.many1' recordParser -- | Parse file.
169
parse :: B8.ByteString -> Either String [Record] parse = P8.parseOnly (parseRecords <* P8.endOfInput) where parseRecords = P8.many1' recordParser -- | Parse file.
169
parse = P8.parseOnly (parseRecords <* P8.endOfInput) where parseRecords = P8.many1' recordParser -- | Parse file.
120
false
true
0
8
28
53
27
26
null
null
the-real-blackh/sodium-2d-game-engine
FRP/Sodium/GameEngine2D/CommonGL.hs
bsd-3-clause
white :: Color4 GLfloat white = Color4 1 1 1 1
46
white :: Color4 GLfloat white = Color4 1 1 1 1
46
white = Color4 1 1 1 1
22
false
true
0
6
10
32
12
20
null
null
kfish/const-math-ghc-plugin
ConstMath/Pass.hs
bsd-3-clause
subExpr opts tab (Cast e co) = do traceMsg opts (tab ++ "Cast") e' <- subExpr opts (tab ++ " ") e return (Cast e' co)
130
subExpr opts tab (Cast e co) = do traceMsg opts (tab ++ "Cast") e' <- subExpr opts (tab ++ " ") e return (Cast e' co)
130
subExpr opts tab (Cast e co) = do traceMsg opts (tab ++ "Cast") e' <- subExpr opts (tab ++ " ") e return (Cast e' co)
130
false
false
0
10
38
71
33
38
null
null
abakst/symmetry
checker/src/cloud-haskell-tests/Reslock.hs
mit
cell_write :: ProcessId -> PeanoN -> Process () cell_write c x = res_do c (Write x)
86
cell_write :: ProcessId -> PeanoN -> Process () cell_write c x = res_do c (Write x)
86
cell_write c x = res_do c (Write x)
35
false
true
0
8
18
40
19
21
null
null
cje/hilbert
test/THilbert.hs
bsd-3-clause
-- Line where i = 1 test_WRef2 :: Assertion test_WRef2 = let input = mkPrecisionNum (2::Integer) (2::Integer) out = mkPrecisionNum (3::Integer) (2::Integer) in out @=? liftA grayCodeInverse input
249
test_WRef2 :: Assertion test_WRef2 = let input = mkPrecisionNum (2::Integer) (2::Integer) out = mkPrecisionNum (3::Integer) (2::Integer) in out @=? liftA grayCodeInverse input
227
test_WRef2 = let input = mkPrecisionNum (2::Integer) (2::Integer) out = mkPrecisionNum (3::Integer) (2::Integer) in out @=? liftA grayCodeInverse input
203
true
true
0
10
81
77
40
37
null
null
avieth/diplomacy
Diplomacy/SVGMap.hs
bsd-3-clause
provinceElement (Normal Syria) = S.polygon ! A.points "530,509 536,494 545,486 555,484 563,479 584,478 609,493 609,559 528,559 532,535 526,530 525,518"
151
provinceElement (Normal Syria) = S.polygon ! A.points "530,509 536,494 545,486 555,484 563,479 584,478 609,493 609,559 528,559 532,535 526,530 525,518"
151
provinceElement (Normal Syria) = S.polygon ! A.points "530,509 536,494 545,486 555,484 563,479 584,478 609,493 609,559 528,559 532,535 526,530 525,518"
151
false
false
0
7
18
27
12
15
null
null
linusyang/barrelfish
tools/mackerel/CAbsSyntax.hs
mit
pp_stmt (VarDecl sc cs ts s Nothing) = [ printf "%s%s%s;" (pp_scopespec sc) (pp_constspec cs) (pp_typespec ts s)]
118
pp_stmt (VarDecl sc cs ts s Nothing) = [ printf "%s%s%s;" (pp_scopespec sc) (pp_constspec cs) (pp_typespec ts s)]
118
pp_stmt (VarDecl sc cs ts s Nothing) = [ printf "%s%s%s;" (pp_scopespec sc) (pp_constspec cs) (pp_typespec ts s)]
118
false
false
0
8
22
55
27
28
null
null
amccausl/Swish
Swish/HaskellRDF/VarBindingTest.hs
lgpl-2.1
testVarModify33 = testEq "testVarModify33" vb5m $ (vb16m3!!2)
61
testVarModify33 = testEq "testVarModify33" vb5m $ (vb16m3!!2)
61
testVarModify33 = testEq "testVarModify33" vb5m $ (vb16m3!!2)
61
false
false
0
7
6
22
11
11
null
null
pminten/xhaskell
beer-song/example.hs
mit
capitalize [] = []
18
capitalize [] = []
18
capitalize [] = []
18
false
false
1
6
3
17
6
11
null
null
darnuria/Yasc
Unpacker.hs
mit
unpackString notString = throwError (TypeMismatch "string" notString)
69
unpackString notString = throwError (TypeMismatch "string" notString)
69
unpackString notString = throwError (TypeMismatch "string" notString)
69
false
false
1
7
6
23
9
14
null
null
klpn/secanc
secanc.hs
bsd-3-clause
main :: IO () main = getArgs >>= parse
38
main :: IO () main = getArgs >>= parse
38
main = getArgs >>= parse
24
false
true
0
6
8
20
10
10
null
null