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
ewestern/geos
src/Data/Geometry/Geos/Raw/Geometry.hs
mit
getNumCoordinates :: Geometry a => a -> Geos Int getNumCoordinates = getNum_ I.geos_GetNumCoordinates
101
getNumCoordinates :: Geometry a => a -> Geos Int getNumCoordinates = getNum_ I.geos_GetNumCoordinates
101
getNumCoordinates = getNum_ I.geos_GetNumCoordinates
52
false
true
0
7
12
30
14
16
null
null
badp/ganeti
src/Ganeti/Constants.hs
gpl-2.0
luxiReqSubmitManyJobs :: String luxiReqSubmitManyJobs = "SubmitManyJobs"
72
luxiReqSubmitManyJobs :: String luxiReqSubmitManyJobs = "SubmitManyJobs"
72
luxiReqSubmitManyJobs = "SubmitManyJobs"
40
false
true
0
4
5
11
6
5
null
null
TomMD/cryptol
src/Cryptol/TypeCheck/Solver/CrySAT.hs
bsd-3-clause
ff :: F ff = mzero
18
ff :: F ff = mzero
18
ff = mzero
10
false
true
0
6
5
18
7
11
null
null
adunning/pandoc-citeproc
src/Text/CSL/Style.hs
bsd-3-clause
startWithCapital' :: Inline -> Bool startWithCapital' (Str (c:_)) = isUpper c && isLetter c
91
startWithCapital' :: Inline -> Bool startWithCapital' (Str (c:_)) = isUpper c && isLetter c
91
startWithCapital' (Str (c:_)) = isUpper c && isLetter c
55
false
true
2
11
13
47
21
26
null
null
nazrhom/vcs-clojure
src/Language/Clojure/Lang.hs
bsd-3-clause
view (UTerm term) = viewTerm term
33
view (UTerm term) = viewTerm term
33
view (UTerm term) = viewTerm term
33
false
false
0
7
5
18
8
10
null
null
mpickering/slack-api
src/Web/Slack.hs
mit
sendPing :: SlackHandle -> IO () sendPing h@SlackHandle{..} = do uid <- nextMessageId h now <- round <$> getPOSIXTime let payload = PingPayload uid "ping" now WS.sendTextData _shConnection (encode payload) -- | Post a complex message using the web API. There's a lot more -- functionality than is exposed here - see -- <https://api.slack.com/methods/chat.postMessage>. -- -- Note that, since this function uses the slack web API (not the RTD api) -- under the hood, it behaves a bit differently to @sendMessage@. In -- particular: rich messages sent by your bot will appear as events. You -- will probably want to explicitly ignore these.
655
sendPing :: SlackHandle -> IO () sendPing h@SlackHandle{..} = do uid <- nextMessageId h now <- round <$> getPOSIXTime let payload = PingPayload uid "ping" now WS.sendTextData _shConnection (encode payload) -- | Post a complex message using the web API. There's a lot more -- functionality than is exposed here - see -- <https://api.slack.com/methods/chat.postMessage>. -- -- Note that, since this function uses the slack web API (not the RTD api) -- under the hood, it behaves a bit differently to @sendMessage@. In -- particular: rich messages sent by your bot will appear as events. You -- will probably want to explicitly ignore these.
655
sendPing h@SlackHandle{..} = do uid <- nextMessageId h now <- round <$> getPOSIXTime let payload = PingPayload uid "ping" now WS.sendTextData _shConnection (encode payload) -- | Post a complex message using the web API. There's a lot more -- functionality than is exposed here - see -- <https://api.slack.com/methods/chat.postMessage>. -- -- Note that, since this function uses the slack web API (not the RTD api) -- under the hood, it behaves a bit differently to @sendMessage@. In -- particular: rich messages sent by your bot will appear as events. You -- will probably want to explicitly ignore these.
622
false
true
0
10
119
93
47
46
null
null
SwiftsNamesake/3DWaves
src/Graphics/WaveFront/Parse/Common.hs
mit
clamped :: Integral i => i -> i -> Atto.Parser i clamped lower upper = Atto.decimal >>= clamp lower upper
105
clamped :: Integral i => i -> i -> Atto.Parser i clamped lower upper = Atto.decimal >>= clamp lower upper
105
clamped lower upper = Atto.decimal >>= clamp lower upper
56
false
true
0
9
19
47
22
25
null
null
disnet/jscheck
src/HJS/Interpreter/InterpM.hs
bsd-3-clause
throwContinue s = throwError (ThrowContinue s)
46
throwContinue s = throwError (ThrowContinue s)
46
throwContinue s = throwError (ThrowContinue s)
46
false
false
1
7
5
21
8
13
null
null
FranklinChen/musicxml2
src/Data/Music/MusicXml/Simple.hs
bsd-3-clause
tenuto = addNotation (Articulations [Tenuto])
54
tenuto = addNotation (Articulations [Tenuto])
54
tenuto = addNotation (Articulations [Tenuto])
54
false
false
0
8
13
18
9
9
null
null
cbrghostrider/Hacking
HackerRank/FunctionalProgramming/MemoizationAndDP/nchoosek.hs
mit
main :: IO () main = do ip <- getContents let nsstr = tail . lines $ ip let nks = map ((\[n, k]->(n, k)) . map read . words) nsstr mapM_ (putStrLn . show) $ map (\(n, k) -> (nchoosek n k) `mod` (10^8 + 7)) nks
221
main :: IO () main = do ip <- getContents let nsstr = tail . lines $ ip let nks = map ((\[n, k]->(n, k)) . map read . words) nsstr mapM_ (putStrLn . show) $ map (\(n, k) -> (nchoosek n k) `mod` (10^8 + 7)) nks
221
main = do ip <- getContents let nsstr = tail . lines $ ip let nks = map ((\[n, k]->(n, k)) . map read . words) nsstr mapM_ (putStrLn . show) $ map (\(n, k) -> (nchoosek n k) `mod` (10^8 + 7)) nks
207
false
true
0
17
59
155
79
76
null
null
Daniel-Diaz/processing
Graphics/Web/Processing/Core/Monad.hs
bsd-3-clause
- ProcM monad definition On the inside, ProcM is a monad which stores both a counter and some processing code. The purpose of the counter is to give each variable an unique name. Using an inner writer monad, using 'tell', we append processing code. Each time we append the creation of a new var, we generate the name of that variable depending on the state of the counter. For example, if the counter is in 2, the variable will be named "v_2" (see 'intVarNumber'). The context of the ProcCode stored in the inner writer monad is propagated to the ProcM monad. -} -- | Generate Processing code using the 'ProcM' monad. -- The code output is reduced. runProcM :: ProcM c a -> (a,ProcCode c) runProcM = runProcMWith 0
721
runProcM :: ProcM c a -> (a,ProcCode c) runProcM = runProcMWith 0
65
runProcM = runProcMWith 0
25
true
true
20
8
135
255
132
123
null
null
TravisWhitaker/rdf
src/Data/RDF/Internal.hs
mit
-- | 'Subject' parser. parseSubject :: A.Parser Subject parseSubject = do c <- A.anyChar case c of '<' -> IRISubject <$> (parseIRI <* A.char '>') '_' -> BlankSubject <$> (A.char ':' *> parseBlankNodeLabel) _ -> fail "parseSubject: must be blank node or IRI." -- | 'Predicate' parser.
322
parseSubject :: A.Parser Subject parseSubject = do c <- A.anyChar case c of '<' -> IRISubject <$> (parseIRI <* A.char '>') '_' -> BlankSubject <$> (A.char ':' *> parseBlankNodeLabel) _ -> fail "parseSubject: must be blank node or IRI." -- | 'Predicate' parser.
299
parseSubject = do c <- A.anyChar case c of '<' -> IRISubject <$> (parseIRI <* A.char '>') '_' -> BlankSubject <$> (A.char ':' *> parseBlankNodeLabel) _ -> fail "parseSubject: must be blank node or IRI." -- | 'Predicate' parser.
266
true
true
0
14
85
87
43
44
null
null
23Skidoo/aeson
tests/DataFamilies/Encoders.hs
bsd-3-clause
thNullaryToJSONObjectWithSingleField :: Nullary Int -> Value thNullaryToJSONObjectWithSingleField = $(mkToJSON optsObjectWithSingleField 'C1)
143
thNullaryToJSONObjectWithSingleField :: Nullary Int -> Value thNullaryToJSONObjectWithSingleField = $(mkToJSON optsObjectWithSingleField 'C1)
143
thNullaryToJSONObjectWithSingleField = $(mkToJSON optsObjectWithSingleField 'C1)
82
false
true
0
7
12
28
14
14
null
null
tylerkahn/dcpu16-haskell
DCPU16/Emulator.hs
mit
pulse :: State DCPUState DCPUState pulse = do (op, arg1, arg2) <- gets $ decodeWord . currentWord instructionAction op arg1 arg2 skip >> get
152
pulse :: State DCPUState DCPUState pulse = do (op, arg1, arg2) <- gets $ decodeWord . currentWord instructionAction op arg1 arg2 skip >> get
152
pulse = do (op, arg1, arg2) <- gets $ decodeWord . currentWord instructionAction op arg1 arg2 skip >> get
117
false
true
1
9
35
62
28
34
null
null
kim/amazonka
amazonka-lambda/gen/Network/AWS/Lambda/Types.hs
mpl-2.0
-- | A base64-encoded .zip file containing your packaged source code. For more -- information about creating a .zip file, go to <http://http://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role.html Execution Permissions> in the /AWS Lambda Developer Guide/. fcZipFile :: Lens' FunctionCode (Maybe Base64) fcZipFile = lens _fcZipFile (\s a -> s { _fcZipFile = a })
406
fcZipFile :: Lens' FunctionCode (Maybe Base64) fcZipFile = lens _fcZipFile (\s a -> s { _fcZipFile = a })
105
fcZipFile = lens _fcZipFile (\s a -> s { _fcZipFile = a })
58
true
true
0
9
49
47
26
21
null
null
philopon/apiary
src/Control/Monad/Apiary/Action/Internal.hs
mit
-- | set content-type header. -- -- if content-type header already exists, replace it. since 0.1.0.0. contentType :: Monad m => ContentType -> ActionT exts prms m () contentType c = modifyState (\s -> s { actionContentType = c } )
230
contentType :: Monad m => ContentType -> ActionT exts prms m () contentType c = modifyState (\s -> s { actionContentType = c } )
128
contentType c = modifyState (\s -> s { actionContentType = c } )
64
true
true
0
9
40
63
32
31
null
null
GallagherCommaJack/scheming-machine
ParserEvaluator.hs
gpl-3.0
getVar :: Env -> String -> IOThrowsError LispVal getVar envRef var = do env <- liftIO $ readIORef envRef maybe (throwError $ UnboundVar "Getting an unbound variable" var) (liftIO . readIORef) (lookup var env)
241
getVar :: Env -> String -> IOThrowsError LispVal getVar envRef var = do env <- liftIO $ readIORef envRef maybe (throwError $ UnboundVar "Getting an unbound variable" var) (liftIO . readIORef) (lookup var env)
241
getVar envRef var = do env <- liftIO $ readIORef envRef maybe (throwError $ UnboundVar "Getting an unbound variable" var) (liftIO . readIORef) (lookup var env)
192
false
true
0
11
66
83
38
45
null
null
mettekou/ghc
compiler/vectorise/Vectorise/Generic/PData.hs
bsd-3-clause
uildPDatasTyCon :: TyCon -> TyCon -> SumRepr -> VM FamInst buildPDatasTyCon orig_tc vect_tc repr = fixV $ \fam_inst -> do let repr_tc = dataFamInstRepTyCon fam_inst name' <- mkLocalisedName mkPDatasTyConOcc orig_name rhs <- buildPDatasTyConRhs orig_name vect_tc repr_tc repr pdatas <- builtin pdatasTyCon buildDataFamInst name' pdatas vect_tc rhs where orig_name = tyConName orig_tc
434
buildPDatasTyCon :: TyCon -> TyCon -> SumRepr -> VM FamInst buildPDatasTyCon orig_tc vect_tc repr = fixV $ \fam_inst -> do let repr_tc = dataFamInstRepTyCon fam_inst name' <- mkLocalisedName mkPDatasTyConOcc orig_name rhs <- buildPDatasTyConRhs orig_name vect_tc repr_tc repr pdatas <- builtin pdatasTyCon buildDataFamInst name' pdatas vect_tc rhs where orig_name = tyConName orig_tc
434
buildPDatasTyCon orig_tc vect_tc repr = fixV $ \fam_inst -> do let repr_tc = dataFamInstRepTyCon fam_inst name' <- mkLocalisedName mkPDatasTyConOcc orig_name rhs <- buildPDatasTyConRhs orig_name vect_tc repr_tc repr pdatas <- builtin pdatasTyCon buildDataFamInst name' pdatas vect_tc rhs where orig_name = tyConName orig_tc
374
false
true
0
12
102
115
52
63
null
null
ntc2/cryptol
src/Cryptol/TypeCheck/Solver/Numeric/Simplify1.hs
bsd-3-clause
pIf :: (Eq a, HasVars a) => I Bool -> I a -> I a -> I a pIf c t e = case c of Impossible -> Impossible Return True -> t Return False -> e If p t1 e1 | t2 == e2 -> t2 | otherwise -> mkIf p t2 e2 where t2 = pIf t1 t e e2 = pIf e1 t e -- | Atoms to propositions.
315
pIf :: (Eq a, HasVars a) => I Bool -> I a -> I a -> I a pIf c t e = case c of Impossible -> Impossible Return True -> t Return False -> e If p t1 e1 | t2 == e2 -> t2 | otherwise -> mkIf p t2 e2 where t2 = pIf t1 t e e2 = pIf e1 t e -- | Atoms to propositions.
315
pIf c t e = case c of Impossible -> Impossible Return True -> t Return False -> e If p t1 e1 | t2 == e2 -> t2 | otherwise -> mkIf p t2 e2 where t2 = pIf t1 t e e2 = pIf e1 t e -- | Atoms to propositions.
259
false
true
0
11
127
155
72
83
null
null
TomMD/cryptol
sbv/Data/SBV/Bridge/CVC4.hs
bsd-3-clause
sat :: Provable a => a -- ^ Property to check -> IO SatResult -- ^ Response of the SMT Solver, containing the model if found sat = satWith sbvCurrentSolver
182
sat :: Provable a => a -- ^ Property to check -> IO SatResult sat = satWith sbvCurrentSolver
115
sat = satWith sbvCurrentSolver
30
true
true
0
7
56
30
15
15
null
null
pparkkin/eta
compiler/ETA/StgSyn/StgSyn.hs
bsd-3-clause
stgUnsatOcc = NoStgBinderInfo
30
stgUnsatOcc = NoStgBinderInfo
30
stgUnsatOcc = NoStgBinderInfo
30
false
false
0
4
3
6
3
3
null
null
dysinger/amazonka
amazonka-ec2/gen/Network/AWS/EC2/DescribeImageAttribute.hs
mpl-2.0
-- | The RAM disk ID. diarRamdiskId :: Lens' DescribeImageAttributeResponse (Maybe AttributeValue) diarRamdiskId = lens _diarRamdiskId (\s a -> s { _diarRamdiskId = a })
169
diarRamdiskId :: Lens' DescribeImageAttributeResponse (Maybe AttributeValue) diarRamdiskId = lens _diarRamdiskId (\s a -> s { _diarRamdiskId = a })
147
diarRamdiskId = lens _diarRamdiskId (\s a -> s { _diarRamdiskId = a })
70
true
true
1
9
24
51
25
26
null
null
DaMSL/K3
src/Language/K3/Analysis/SEffects/Inference.hs
apache-2.0
chaseProvenance :: K3 Provenance -> Except Text (K3 Provenance) chaseProvenance (tnc -> (PApply _, [_,_,r])) = chaseProvenance r
128
chaseProvenance :: K3 Provenance -> Except Text (K3 Provenance) chaseProvenance (tnc -> (PApply _, [_,_,r])) = chaseProvenance r
128
chaseProvenance (tnc -> (PApply _, [_,_,r])) = chaseProvenance r
64
false
true
0
11
17
64
32
32
null
null
mariefarrell/Hets
Common/Doc.hs
gpl-2.0
empty :: Doc -- ^ An empty document empty = Empty
65
empty :: Doc empty = Empty
26
empty = Empty
13
true
true
0
6
26
19
8
11
null
null
JohnLato/iteratee
tests/testIteratee.hs
bsd-3-clause
prop_eq str = str == str where types = str :: ST
50
prop_eq str = str == str where types = str :: ST
50
prop_eq str = str == str where types = str :: ST
50
false
false
0
5
13
24
12
12
null
null
chjp2046/fbthrift
thrift/lib/hs/Thrift/Protocol/SimpleJSON.hs
apache-2.0
buildJSONValue (TMap _ _ entries) = "{" <> buildJSONMap entries <> "}"
70
buildJSONValue (TMap _ _ entries) = "{" <> buildJSONMap entries <> "}"
70
buildJSONValue (TMap _ _ entries) = "{" <> buildJSONMap entries <> "}"
70
false
false
0
7
11
30
14
16
null
null
sdiehl/ghc
compiler/coreSyn/CoreUnfold.hs
bsd-3-clause
mkUnfolding :: DynFlags -> UnfoldingSource -> Bool -- Is top-level -> Bool -- Definitely a bottoming binding -- (only relevant for top-level bindings) -> CoreExpr -> Unfolding -- Calculates unfolding guidance -- Occurrence-analyses the expression before capturing it mkUnfolding dflags src is_top_lvl is_bottoming expr = CoreUnfolding { uf_tmpl = occurAnalyseExpr_NoBinderSwap expr, -- See Note [Occurrence analysis of unfoldings] uf_src = src, uf_is_top = is_top_lvl, uf_is_value = exprIsHNF expr, uf_is_conlike = exprIsConLike expr, uf_expandable = exprIsExpandable expr, uf_is_work_free = exprIsWorkFree expr, uf_guidance = guidance } where is_top_bottoming = is_top_lvl && is_bottoming guidance = calcUnfoldingGuidance dflags is_top_bottoming expr -- NB: *not* (calcUnfoldingGuidance (occurAnalyseExpr_NoBinderSwap expr))! -- See Note [Calculate unfolding guidance on the non-occ-anal'd expression] {- Note [Occurrence analysis of unfoldings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We do occurrence-analysis of unfoldings once and for all, when the unfolding is built, rather than each time we inline them. But given this decision it's vital that we do *always* do it. Consider this unfolding \x -> letrec { f = ...g...; g* = f } in body where g* is (for some strange reason) the loop breaker. If we don't occ-anal it when reading it in, we won't mark g as a loop breaker, and we may inline g entirely in body, dropping its binding, and leaving the occurrence in f out of scope. This happened in #8892, where the unfolding in question was a DFun unfolding. But more generally, the simplifier is designed on the basis that it is looking at occurrence-analysed expressions, so better ensure that they actually are. We use occurAnalyseExpr_NoBinderSwap instead of occurAnalyseExpr; see Note [No binder swap in unfoldings]. Note [No binder swap in unfoldings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The binder swap can temporarily violate Core Lint, by assigning a LocalId binding to a GlobalId. For example, if A.foo{r872} is a GlobalId with unique r872, then case A.foo{r872} of bar { K x -> ...(A.foo{r872})... } gets transformed to case A.foo{r872} of bar { K x -> let foo{r872} = bar in ...(A.foo{r872})... This is usually not a problem, because the simplifier will transform this to: case A.foo{r872} of bar { K x -> ...(bar)... However, after occurrence analysis but before simplification, this extra 'let' violates the Core Lint invariant that we do not have local 'let' bindings for GlobalIds. That seems (just) tolerable for the occurrence analysis that happens just before the Simplifier, but not for unfoldings, which are Linted independently. As a quick workaround, we disable binder swap in this module. See #16288 and #16296 for further plans. Note [Calculate unfolding guidance on the non-occ-anal'd expression] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Notice that we give the non-occur-analysed expression to calcUnfoldingGuidance. In some ways it'd be better to occur-analyse first; for example, sometimes during simplification, there's a large let-bound thing which has been substituted, and so is now dead; so 'expr' contains two copies of the thing while the occurrence-analysed expression doesn't. Nevertheless, we *don't* and *must not* occ-analyse before computing the size because a) The size computation bales out after a while, whereas occurrence analysis does not. b) Residency increases sharply if you occ-anal first. I'm not 100% sure why, but it's a large effect. Compiling Cabal went from residency of 534M to over 800M with this one change. This can occasionally mean that the guidance is very pessimistic; it gets fixed up next round. And it should be rare, because large let-bound things that are dead are usually caught by preInlineUnconditionally ************************************************************************ * * \subsection{The UnfoldingGuidance type} * * ************************************************************************ -}
4,542
mkUnfolding :: DynFlags -> UnfoldingSource -> Bool -- Is top-level -> Bool -- Definitely a bottoming binding -- (only relevant for top-level bindings) -> CoreExpr -> Unfolding mkUnfolding dflags src is_top_lvl is_bottoming expr = CoreUnfolding { uf_tmpl = occurAnalyseExpr_NoBinderSwap expr, -- See Note [Occurrence analysis of unfoldings] uf_src = src, uf_is_top = is_top_lvl, uf_is_value = exprIsHNF expr, uf_is_conlike = exprIsConLike expr, uf_expandable = exprIsExpandable expr, uf_is_work_free = exprIsWorkFree expr, uf_guidance = guidance } where is_top_bottoming = is_top_lvl && is_bottoming guidance = calcUnfoldingGuidance dflags is_top_bottoming expr -- NB: *not* (calcUnfoldingGuidance (occurAnalyseExpr_NoBinderSwap expr))! -- See Note [Calculate unfolding guidance on the non-occ-anal'd expression] {- Note [Occurrence analysis of unfoldings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We do occurrence-analysis of unfoldings once and for all, when the unfolding is built, rather than each time we inline them. But given this decision it's vital that we do *always* do it. Consider this unfolding \x -> letrec { f = ...g...; g* = f } in body where g* is (for some strange reason) the loop breaker. If we don't occ-anal it when reading it in, we won't mark g as a loop breaker, and we may inline g entirely in body, dropping its binding, and leaving the occurrence in f out of scope. This happened in #8892, where the unfolding in question was a DFun unfolding. But more generally, the simplifier is designed on the basis that it is looking at occurrence-analysed expressions, so better ensure that they actually are. We use occurAnalyseExpr_NoBinderSwap instead of occurAnalyseExpr; see Note [No binder swap in unfoldings]. Note [No binder swap in unfoldings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The binder swap can temporarily violate Core Lint, by assigning a LocalId binding to a GlobalId. For example, if A.foo{r872} is a GlobalId with unique r872, then case A.foo{r872} of bar { K x -> ...(A.foo{r872})... } gets transformed to case A.foo{r872} of bar { K x -> let foo{r872} = bar in ...(A.foo{r872})... This is usually not a problem, because the simplifier will transform this to: case A.foo{r872} of bar { K x -> ...(bar)... However, after occurrence analysis but before simplification, this extra 'let' violates the Core Lint invariant that we do not have local 'let' bindings for GlobalIds. That seems (just) tolerable for the occurrence analysis that happens just before the Simplifier, but not for unfoldings, which are Linted independently. As a quick workaround, we disable binder swap in this module. See #16288 and #16296 for further plans. Note [Calculate unfolding guidance on the non-occ-anal'd expression] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Notice that we give the non-occur-analysed expression to calcUnfoldingGuidance. In some ways it'd be better to occur-analyse first; for example, sometimes during simplification, there's a large let-bound thing which has been substituted, and so is now dead; so 'expr' contains two copies of the thing while the occurrence-analysed expression doesn't. Nevertheless, we *don't* and *must not* occ-analyse before computing the size because a) The size computation bales out after a while, whereas occurrence analysis does not. b) Residency increases sharply if you occ-anal first. I'm not 100% sure why, but it's a large effect. Compiling Cabal went from residency of 534M to over 800M with this one change. This can occasionally mean that the guidance is very pessimistic; it gets fixed up next round. And it should be rare, because large let-bound things that are dead are usually caught by preInlineUnconditionally ************************************************************************ * * \subsection{The UnfoldingGuidance type} * * ************************************************************************ -}
4,451
mkUnfolding dflags src is_top_lvl is_bottoming expr = CoreUnfolding { uf_tmpl = occurAnalyseExpr_NoBinderSwap expr, -- See Note [Occurrence analysis of unfoldings] uf_src = src, uf_is_top = is_top_lvl, uf_is_value = exprIsHNF expr, uf_is_conlike = exprIsConLike expr, uf_expandable = exprIsExpandable expr, uf_is_work_free = exprIsWorkFree expr, uf_guidance = guidance } where is_top_bottoming = is_top_lvl && is_bottoming guidance = calcUnfoldingGuidance dflags is_top_bottoming expr -- NB: *not* (calcUnfoldingGuidance (occurAnalyseExpr_NoBinderSwap expr))! -- See Note [Calculate unfolding guidance on the non-occ-anal'd expression] {- Note [Occurrence analysis of unfoldings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We do occurrence-analysis of unfoldings once and for all, when the unfolding is built, rather than each time we inline them. But given this decision it's vital that we do *always* do it. Consider this unfolding \x -> letrec { f = ...g...; g* = f } in body where g* is (for some strange reason) the loop breaker. If we don't occ-anal it when reading it in, we won't mark g as a loop breaker, and we may inline g entirely in body, dropping its binding, and leaving the occurrence in f out of scope. This happened in #8892, where the unfolding in question was a DFun unfolding. But more generally, the simplifier is designed on the basis that it is looking at occurrence-analysed expressions, so better ensure that they actually are. We use occurAnalyseExpr_NoBinderSwap instead of occurAnalyseExpr; see Note [No binder swap in unfoldings]. Note [No binder swap in unfoldings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The binder swap can temporarily violate Core Lint, by assigning a LocalId binding to a GlobalId. For example, if A.foo{r872} is a GlobalId with unique r872, then case A.foo{r872} of bar { K x -> ...(A.foo{r872})... } gets transformed to case A.foo{r872} of bar { K x -> let foo{r872} = bar in ...(A.foo{r872})... This is usually not a problem, because the simplifier will transform this to: case A.foo{r872} of bar { K x -> ...(bar)... However, after occurrence analysis but before simplification, this extra 'let' violates the Core Lint invariant that we do not have local 'let' bindings for GlobalIds. That seems (just) tolerable for the occurrence analysis that happens just before the Simplifier, but not for unfoldings, which are Linted independently. As a quick workaround, we disable binder swap in this module. See #16288 and #16296 for further plans. Note [Calculate unfolding guidance on the non-occ-anal'd expression] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Notice that we give the non-occur-analysed expression to calcUnfoldingGuidance. In some ways it'd be better to occur-analyse first; for example, sometimes during simplification, there's a large let-bound thing which has been substituted, and so is now dead; so 'expr' contains two copies of the thing while the occurrence-analysed expression doesn't. Nevertheless, we *don't* and *must not* occ-analyse before computing the size because a) The size computation bales out after a while, whereas occurrence analysis does not. b) Residency increases sharply if you occ-anal first. I'm not 100% sure why, but it's a large effect. Compiling Cabal went from residency of 534M to over 800M with this one change. This can occasionally mean that the guidance is very pessimistic; it gets fixed up next round. And it should be rare, because large let-bound things that are dead are usually caught by preInlineUnconditionally ************************************************************************ * * \subsection{The UnfoldingGuidance type} * * ************************************************************************ -}
4,189
true
true
2
11
1,107
154
82
72
null
null
haskell-compat/base-compat
check/test/TypeCheck.hs
mit
typeCheck :: FilePath -> String -> Spec typeCheck pwd module_ = describe module_ . it "should have the expected type signatures" . withTempFile pwd "Temp.types" $ \fp h -> do types <- typeDump module_ hPutStr h types hFlush h (exitCode, stdOut, stdErr) <- readProcessWithExitCode "typediff" ["types/" ++ module_ ++ ".types", fp] "" case exitCode of ExitFailure i -> assertFailure $ unlines [ "typediff failed with code: " ++ show i , stdErr ] ExitSuccess -> unless (null stdOut) $ assertFailure stdOut
643
typeCheck :: FilePath -> String -> Spec typeCheck pwd module_ = describe module_ . it "should have the expected type signatures" . withTempFile pwd "Temp.types" $ \fp h -> do types <- typeDump module_ hPutStr h types hFlush h (exitCode, stdOut, stdErr) <- readProcessWithExitCode "typediff" ["types/" ++ module_ ++ ".types", fp] "" case exitCode of ExitFailure i -> assertFailure $ unlines [ "typediff failed with code: " ++ show i , stdErr ] ExitSuccess -> unless (null stdOut) $ assertFailure stdOut
643
typeCheck pwd module_ = describe module_ . it "should have the expected type signatures" . withTempFile pwd "Temp.types" $ \fp h -> do types <- typeDump module_ hPutStr h types hFlush h (exitCode, stdOut, stdErr) <- readProcessWithExitCode "typediff" ["types/" ++ module_ ++ ".types", fp] "" case exitCode of ExitFailure i -> assertFailure $ unlines [ "typediff failed with code: " ++ show i , stdErr ] ExitSuccess -> unless (null stdOut) $ assertFailure stdOut
603
false
true
4
16
222
183
83
100
null
null
joranvar/GCJ
src/gcj-lib/Y2017/R1A/D.hs
gpl-3.0
{-> parse . drop 1 . lines $ example [] -} solve' P = S
57
solve' P = S
12
solve' P = S
12
true
false
0
4
16
11
5
6
null
null
NorfairKing/super-user-spark
test/SuperUserSpark/Parser/Gen.hs
mit
generateQuotedIdentifier :: Gen (String, String) generateQuotedIdentifier = do w <- generateWord return ("\"" ++ w ++ "\"", w)
134
generateQuotedIdentifier :: Gen (String, String) generateQuotedIdentifier = do w <- generateWord return ("\"" ++ w ++ "\"", w)
134
generateQuotedIdentifier = do w <- generateWord return ("\"" ++ w ++ "\"", w)
85
false
true
0
10
25
47
24
23
null
null
r24y/hydrant
Main.hs
bsd-3-clause
withCommand opts cmd = opts { commandToRun = cmd }
50
withCommand opts cmd = opts { commandToRun = cmd }
50
withCommand opts cmd = opts { commandToRun = cmd }
50
false
false
0
6
9
19
10
9
null
null
yanatan16/doczen-generator
src/Language/Doczen/Parser.hs
mit
regularChar = RC <$> (noneOf "`\n")
35
regularChar = RC <$> (noneOf "`\n")
35
regularChar = RC <$> (noneOf "`\n")
35
false
false
0
7
5
16
8
8
null
null
clarissalittler/pi-calculus
Exp.hs
mit
ppExp (EBool True) = text "true"
32
ppExp (EBool True) = text "true"
32
ppExp (EBool True) = text "true"
32
false
false
0
6
5
19
8
11
null
null
sjpet/quark
src/Quark/History.hs
mit
undoEdit' (IndentLine r n c ix sel) s = doEdit (IndentLine r (-n) c ix sel) s
77
undoEdit' (IndentLine r n c ix sel) s = doEdit (IndentLine r (-n) c ix sel) s
77
undoEdit' (IndentLine r n c ix sel) s = doEdit (IndentLine r (-n) c ix sel) s
77
false
false
0
9
16
49
24
25
null
null
brendanhay/gogol
gogol-binaryauthorization/gen/Network/Google/BinaryAuthorization/Types/Product.hs
mpl-2.0
-- | Output only. The resource name, in the format \`projects\/*\/policy\`. -- There is at most one policy per project. pName :: Lens' Policy (Maybe Text) pName = lens _pName (\ s a -> s{_pName = a})
199
pName :: Lens' Policy (Maybe Text) pName = lens _pName (\ s a -> s{_pName = a})
79
pName = lens _pName (\ s a -> s{_pName = a})
44
true
true
0
9
36
47
26
21
null
null
CloudI/CloudI
src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Lazy.hs
mit
unfoldr :: (a -> Maybe (Word8, a)) -> a -> ByteString unfoldr f z = unfoldChunk 32 z where unfoldChunk n x = case S.unfoldrN n f x of (c, Nothing) | S.null c -> Empty | otherwise -> Chunk c Empty (c, Just x') -> Chunk c (unfoldChunk (n*2) x') -- --------------------------------------------------------------------- -- Substrings -- | /O(n\/c)/ 'take' @n@, applied to a ByteString @xs@, returns the prefix -- of @xs@ of length @n@, or @xs@ itself if @n > 'length' xs@.
536
unfoldr :: (a -> Maybe (Word8, a)) -> a -> ByteString unfoldr f z = unfoldChunk 32 z where unfoldChunk n x = case S.unfoldrN n f x of (c, Nothing) | S.null c -> Empty | otherwise -> Chunk c Empty (c, Just x') -> Chunk c (unfoldChunk (n*2) x') -- --------------------------------------------------------------------- -- Substrings -- | /O(n\/c)/ 'take' @n@, applied to a ByteString @xs@, returns the prefix -- of @xs@ of length @n@, or @xs@ itself if @n > 'length' xs@.
536
unfoldr f z = unfoldChunk 32 z where unfoldChunk n x = case S.unfoldrN n f x of (c, Nothing) | S.null c -> Empty | otherwise -> Chunk c Empty (c, Just x') -> Chunk c (unfoldChunk (n*2) x') -- --------------------------------------------------------------------- -- Substrings -- | /O(n\/c)/ 'take' @n@, applied to a ByteString @xs@, returns the prefix -- of @xs@ of length @n@, or @xs@ itself if @n > 'length' xs@.
482
false
true
0
12
149
146
74
72
null
null
rahulmutt/ghcvm
compiler/Eta/Prelude/PrimOp.hs
bsd-3-clause
primOpInfo SizeofSmallArrayOp = mkGenPrimOp (fsLit "sizeofSmallArray#") [alphaTyVar] [mkSmallArrayPrimTy alphaTy] (intPrimTy)
126
primOpInfo SizeofSmallArrayOp = mkGenPrimOp (fsLit "sizeofSmallArray#") [alphaTyVar] [mkSmallArrayPrimTy alphaTy] (intPrimTy)
126
primOpInfo SizeofSmallArrayOp = mkGenPrimOp (fsLit "sizeofSmallArray#") [alphaTyVar] [mkSmallArrayPrimTy alphaTy] (intPrimTy)
126
false
false
0
7
10
36
18
18
null
null
banacorn/formal-language
haskell-legacy/Language/instances.hs
mit
-------------------------------------------------------------- dropQuote :: String -> String dropQuote [] = []
112
dropQuote :: String -> String dropQuote [] = []
47
dropQuote [] = []
17
true
true
0
8
11
29
13
16
null
null
Noeda/compiled-expressions
src/Data/CompiledExpression/Internal.hs
mit
synthVarSize (Tanh sz) = 1 + synthVarSize sz
44
synthVarSize (Tanh sz) = 1 + synthVarSize sz
44
synthVarSize (Tanh sz) = 1 + synthVarSize sz
44
false
false
0
7
7
22
10
12
null
null
sergv/vector
Data/Vector/Generic.hs
bsd-3-clause
fromListN n = unstream . Bundle.fromListN n
43
fromListN n = unstream . Bundle.fromListN n
43
fromListN n = unstream . Bundle.fromListN n
43
false
false
2
6
6
22
8
14
null
null
fibsifan/pandoc
src/Text/Pandoc/Readers/HTML.hs
gpl-2.0
mathMLNamespace :: String mathMLNamespace = "http://www.w3.org/1998/Math/MathML"
80
mathMLNamespace :: String mathMLNamespace = "http://www.w3.org/1998/Math/MathML"
80
mathMLNamespace = "http://www.w3.org/1998/Math/MathML"
54
false
true
0
6
5
18
7
11
null
null
rasendubi/arachne
src/Network/MQTT/Parser.hs
bsd-3-clause
parseClientIdentifier :: ParserWithLength ClientIdentifier parseClientIdentifier = ClientIdentifier <$> parseText
113
parseClientIdentifier :: ParserWithLength ClientIdentifier parseClientIdentifier = ClientIdentifier <$> parseText
113
parseClientIdentifier = ClientIdentifier <$> parseText
54
false
true
0
5
8
18
9
9
null
null
esmolanka/sexp-grammar
invertible-grammar/src/Data/InvertibleGrammar/Base.hs
bsd-3-clause
forward (Traverse g) = traverse (forward g)
47
forward (Traverse g) = traverse (forward g)
47
forward (Traverse g) = traverse (forward g)
47
false
false
0
7
10
24
11
13
null
null
gebner/reforest
src/Reforest/Compression.hs
mit
langToGrammar :: [Term] -> Grammar langToGrammar = map (Prod (NT 0 0))
70
langToGrammar :: [Term] -> Grammar langToGrammar = map (Prod (NT 0 0))
70
langToGrammar = map (Prod (NT 0 0))
35
false
true
0
8
11
41
19
22
null
null
mettekou/ghc
compiler/main/HscTypes.hs
bsd-3-clause
tyThingsTyCoVars :: [TyThing] -> TyCoVarSet tyThingsTyCoVars tts = unionVarSets $ map ttToVarSet tts where ttToVarSet (AnId id) = tyCoVarsOfType $ idType id ttToVarSet (AConLike cl) = case cl of RealDataCon dc -> tyCoVarsOfType $ dataConRepType dc PatSynCon{} -> emptyVarSet ttToVarSet (ATyCon tc) = case tyConClass_maybe tc of Just cls -> (mkVarSet . fst . classTvsFds) cls Nothing -> tyCoVarsOfType $ tyConKind tc ttToVarSet (ACoAxiom _) = emptyVarSet -- | The Names that a TyThing should bring into scope. Used to build -- the GlobalRdrEnv for the InteractiveContext.
685
tyThingsTyCoVars :: [TyThing] -> TyCoVarSet tyThingsTyCoVars tts = unionVarSets $ map ttToVarSet tts where ttToVarSet (AnId id) = tyCoVarsOfType $ idType id ttToVarSet (AConLike cl) = case cl of RealDataCon dc -> tyCoVarsOfType $ dataConRepType dc PatSynCon{} -> emptyVarSet ttToVarSet (ATyCon tc) = case tyConClass_maybe tc of Just cls -> (mkVarSet . fst . classTvsFds) cls Nothing -> tyCoVarsOfType $ tyConKind tc ttToVarSet (ACoAxiom _) = emptyVarSet -- | The Names that a TyThing should bring into scope. Used to build -- the GlobalRdrEnv for the InteractiveContext.
685
tyThingsTyCoVars tts = unionVarSets $ map ttToVarSet tts where ttToVarSet (AnId id) = tyCoVarsOfType $ idType id ttToVarSet (AConLike cl) = case cl of RealDataCon dc -> tyCoVarsOfType $ dataConRepType dc PatSynCon{} -> emptyVarSet ttToVarSet (ATyCon tc) = case tyConClass_maybe tc of Just cls -> (mkVarSet . fst . classTvsFds) cls Nothing -> tyCoVarsOfType $ tyConKind tc ttToVarSet (ACoAxiom _) = emptyVarSet -- | The Names that a TyThing should bring into scope. Used to build -- the GlobalRdrEnv for the InteractiveContext.
641
false
true
3
14
201
176
85
91
null
null
HIPERFIT/futhark
src/Futhark/CodeGen/ImpGen/GPU/Base.hs
isc
groupReduceWithOffset :: TV Int32 -> Imp.TExp Int32 -> Lambda GPUMem -> [VName] -> InKernelGen () groupReduceWithOffset offset w lam arrs = do constants <- kernelConstants <$> askEnv let local_tid = kernelLocalThreadId constants global_tid = kernelGlobalThreadId constants barrier | all primType $ lambdaReturnType lam = sOp $ Imp.Barrier Imp.FenceLocal | otherwise = sOp $ Imp.Barrier Imp.FenceGlobal readReduceArgument param arr | Prim _ <- paramType param = do let i = local_tid + tvExp offset copyDWIMFix (paramName param) [] (Var arr) [sExt64 i] | otherwise = do let i = global_tid + tvExp offset copyDWIMFix (paramName param) [] (Var arr) [sExt64 i] writeReduceOpResult param arr | Prim _ <- paramType param = copyDWIMFix arr [sExt64 local_tid] (Var $ paramName param) [] | otherwise = return () let (reduce_acc_params, reduce_arr_params) = splitAt (length arrs) $ lambdaParams lam skip_waves <- dPrimV "skip_waves" (1 :: Imp.TExp Int32) dLParams $ lambdaParams lam offset <-- (0 :: Imp.TExp Int32) comment "participating threads read initial accumulator" $ sWhen (local_tid .<. w) $ zipWithM_ readReduceArgument reduce_acc_params arrs let do_reduce = do comment "read array element" $ zipWithM_ readReduceArgument reduce_arr_params arrs comment "apply reduction operation" $ compileBody' reduce_acc_params $ lambdaBody lam comment "write result of operation" $ zipWithM_ writeReduceOpResult reduce_acc_params arrs in_wave_reduce = everythingVolatile do_reduce wave_size = kernelWaveSize constants group_size = kernelGroupSize constants wave_id = local_tid `quot` wave_size in_wave_id = local_tid - wave_id * wave_size num_waves = (sExt32 group_size + wave_size - 1) `quot` wave_size arg_in_bounds = local_tid + tvExp offset .<. w doing_in_wave_reductions = tvExp offset .<. wave_size apply_in_in_wave_iteration = (in_wave_id .&. (2 * tvExp offset - 1)) .==. 0 in_wave_reductions = do offset <-- (1 :: Imp.TExp Int32) sWhile doing_in_wave_reductions $ do sWhen (arg_in_bounds .&&. apply_in_in_wave_iteration) in_wave_reduce offset <-- tvExp offset * 2 doing_cross_wave_reductions = tvExp skip_waves .<. num_waves is_first_thread_in_wave = in_wave_id .==. 0 wave_not_skipped = (wave_id .&. (2 * tvExp skip_waves - 1)) .==. 0 apply_in_cross_wave_iteration = arg_in_bounds .&&. is_first_thread_in_wave .&&. wave_not_skipped cross_wave_reductions = sWhile doing_cross_wave_reductions $ do barrier offset <-- tvExp skip_waves * wave_size sWhen apply_in_cross_wave_iteration do_reduce skip_waves <-- tvExp skip_waves * 2 in_wave_reductions cross_wave_reductions
3,070
groupReduceWithOffset :: TV Int32 -> Imp.TExp Int32 -> Lambda GPUMem -> [VName] -> InKernelGen () groupReduceWithOffset offset w lam arrs = do constants <- kernelConstants <$> askEnv let local_tid = kernelLocalThreadId constants global_tid = kernelGlobalThreadId constants barrier | all primType $ lambdaReturnType lam = sOp $ Imp.Barrier Imp.FenceLocal | otherwise = sOp $ Imp.Barrier Imp.FenceGlobal readReduceArgument param arr | Prim _ <- paramType param = do let i = local_tid + tvExp offset copyDWIMFix (paramName param) [] (Var arr) [sExt64 i] | otherwise = do let i = global_tid + tvExp offset copyDWIMFix (paramName param) [] (Var arr) [sExt64 i] writeReduceOpResult param arr | Prim _ <- paramType param = copyDWIMFix arr [sExt64 local_tid] (Var $ paramName param) [] | otherwise = return () let (reduce_acc_params, reduce_arr_params) = splitAt (length arrs) $ lambdaParams lam skip_waves <- dPrimV "skip_waves" (1 :: Imp.TExp Int32) dLParams $ lambdaParams lam offset <-- (0 :: Imp.TExp Int32) comment "participating threads read initial accumulator" $ sWhen (local_tid .<. w) $ zipWithM_ readReduceArgument reduce_acc_params arrs let do_reduce = do comment "read array element" $ zipWithM_ readReduceArgument reduce_arr_params arrs comment "apply reduction operation" $ compileBody' reduce_acc_params $ lambdaBody lam comment "write result of operation" $ zipWithM_ writeReduceOpResult reduce_acc_params arrs in_wave_reduce = everythingVolatile do_reduce wave_size = kernelWaveSize constants group_size = kernelGroupSize constants wave_id = local_tid `quot` wave_size in_wave_id = local_tid - wave_id * wave_size num_waves = (sExt32 group_size + wave_size - 1) `quot` wave_size arg_in_bounds = local_tid + tvExp offset .<. w doing_in_wave_reductions = tvExp offset .<. wave_size apply_in_in_wave_iteration = (in_wave_id .&. (2 * tvExp offset - 1)) .==. 0 in_wave_reductions = do offset <-- (1 :: Imp.TExp Int32) sWhile doing_in_wave_reductions $ do sWhen (arg_in_bounds .&&. apply_in_in_wave_iteration) in_wave_reduce offset <-- tvExp offset * 2 doing_cross_wave_reductions = tvExp skip_waves .<. num_waves is_first_thread_in_wave = in_wave_id .==. 0 wave_not_skipped = (wave_id .&. (2 * tvExp skip_waves - 1)) .==. 0 apply_in_cross_wave_iteration = arg_in_bounds .&&. is_first_thread_in_wave .&&. wave_not_skipped cross_wave_reductions = sWhile doing_cross_wave_reductions $ do barrier offset <-- tvExp skip_waves * wave_size sWhen apply_in_cross_wave_iteration do_reduce skip_waves <-- tvExp skip_waves * 2 in_wave_reductions cross_wave_reductions
3,070
groupReduceWithOffset offset w lam arrs = do constants <- kernelConstants <$> askEnv let local_tid = kernelLocalThreadId constants global_tid = kernelGlobalThreadId constants barrier | all primType $ lambdaReturnType lam = sOp $ Imp.Barrier Imp.FenceLocal | otherwise = sOp $ Imp.Barrier Imp.FenceGlobal readReduceArgument param arr | Prim _ <- paramType param = do let i = local_tid + tvExp offset copyDWIMFix (paramName param) [] (Var arr) [sExt64 i] | otherwise = do let i = global_tid + tvExp offset copyDWIMFix (paramName param) [] (Var arr) [sExt64 i] writeReduceOpResult param arr | Prim _ <- paramType param = copyDWIMFix arr [sExt64 local_tid] (Var $ paramName param) [] | otherwise = return () let (reduce_acc_params, reduce_arr_params) = splitAt (length arrs) $ lambdaParams lam skip_waves <- dPrimV "skip_waves" (1 :: Imp.TExp Int32) dLParams $ lambdaParams lam offset <-- (0 :: Imp.TExp Int32) comment "participating threads read initial accumulator" $ sWhen (local_tid .<. w) $ zipWithM_ readReduceArgument reduce_acc_params arrs let do_reduce = do comment "read array element" $ zipWithM_ readReduceArgument reduce_arr_params arrs comment "apply reduction operation" $ compileBody' reduce_acc_params $ lambdaBody lam comment "write result of operation" $ zipWithM_ writeReduceOpResult reduce_acc_params arrs in_wave_reduce = everythingVolatile do_reduce wave_size = kernelWaveSize constants group_size = kernelGroupSize constants wave_id = local_tid `quot` wave_size in_wave_id = local_tid - wave_id * wave_size num_waves = (sExt32 group_size + wave_size - 1) `quot` wave_size arg_in_bounds = local_tid + tvExp offset .<. w doing_in_wave_reductions = tvExp offset .<. wave_size apply_in_in_wave_iteration = (in_wave_id .&. (2 * tvExp offset - 1)) .==. 0 in_wave_reductions = do offset <-- (1 :: Imp.TExp Int32) sWhile doing_in_wave_reductions $ do sWhen (arg_in_bounds .&&. apply_in_in_wave_iteration) in_wave_reduce offset <-- tvExp offset * 2 doing_cross_wave_reductions = tvExp skip_waves .<. num_waves is_first_thread_in_wave = in_wave_id .==. 0 wave_not_skipped = (wave_id .&. (2 * tvExp skip_waves - 1)) .==. 0 apply_in_cross_wave_iteration = arg_in_bounds .&&. is_first_thread_in_wave .&&. wave_not_skipped cross_wave_reductions = sWhile doing_cross_wave_reductions $ do barrier offset <-- tvExp skip_waves * wave_size sWhen apply_in_cross_wave_iteration do_reduce skip_waves <-- tvExp skip_waves * 2 in_wave_reductions cross_wave_reductions
2,962
false
true
0
17
847
827
388
439
null
null
lpeterse/koka
src/Type/Pretty.hs
apache-2.0
ppVis env vis = case vis of Private -> keyword env "private " Public -> keyword env "public " {-------------------------------------------------------------------------- Synonym Info --------------------------------------------------------------------------}
275
ppVis env vis = case vis of Private -> keyword env "private " Public -> keyword env "public " {-------------------------------------------------------------------------- Synonym Info --------------------------------------------------------------------------}
275
ppVis env vis = case vis of Private -> keyword env "private " Public -> keyword env "public " {-------------------------------------------------------------------------- Synonym Info --------------------------------------------------------------------------}
275
false
false
0
8
39
39
18
21
null
null
sopvop/json-token-stream
src/Data/JSON/TokenStream/Write.hs
bsd-3-clause
toLazyByteString :: Encoding -> BL.ByteString toLazyByteString = B.toLazyByteString . toBuilder
95
toLazyByteString :: Encoding -> BL.ByteString toLazyByteString = B.toLazyByteString . toBuilder
95
toLazyByteString = B.toLazyByteString . toBuilder
49
false
true
0
6
9
23
12
11
null
null
alphalambda/codeworld
codeworld-api/src/CodeWorld/Sketches.hs
apache-2.0
sketchedPawnBlack :: HasCallStack => Picture sketchedPawnBlack = Sketch (getDebugSrcLoc callStack) "sketchedPawnBlack" $(embedAsUrl "image/svg+xml" "data/PawnBlackTransparency70.svg") 10 10
211
sketchedPawnBlack :: HasCallStack => Picture sketchedPawnBlack = Sketch (getDebugSrcLoc callStack) "sketchedPawnBlack" $(embedAsUrl "image/svg+xml" "data/PawnBlackTransparency70.svg") 10 10
211
sketchedPawnBlack = Sketch (getDebugSrcLoc callStack) "sketchedPawnBlack" $(embedAsUrl "image/svg+xml" "data/PawnBlackTransparency70.svg") 10 10
166
false
true
0
7
37
46
20
26
null
null
jwbuurlage/category-theory-programmers
examples/parser/lisp_like_dsl.hs
mit
threeInts :: Parser [Int] threeInts = do x <- parseOneInt y <- parseOneInt z <- parseOneInt return [x, y, z] where parseOneInt = spaces *> intParser
162
threeInts :: Parser [Int] threeInts = do x <- parseOneInt y <- parseOneInt z <- parseOneInt return [x, y, z] where parseOneInt = spaces *> intParser
162
threeInts = do x <- parseOneInt y <- parseOneInt z <- parseOneInt return [x, y, z] where parseOneInt = spaces *> intParser
136
false
true
3
8
39
76
34
42
null
null
amutake/psg-scheme
src/Primitives.hs
bsd-3-clause
primEqP _ = throwError $ NumArgs "eq?: args == 2"
49
primEqP _ = throwError $ NumArgs "eq?: args == 2"
49
primEqP _ = throwError $ NumArgs "eq?: args == 2"
49
false
false
0
6
9
16
7
9
null
null
vikraman/ghc
compiler/cmm/CLabel.hs
bsd-3-clause
isForeignLabel _lbl = False
27
isForeignLabel _lbl = False
27
isForeignLabel _lbl = False
27
false
false
0
5
3
9
4
5
null
null
glguy/irc-core
src/Client/CApi/Exports.hs
isc
{- ^ 0 on success -} -- | Add a message to a chat window as if it was received -- directly from the IRC server. This is useful when implementing -- extensions that intercept incoming chat messages and transform -- them before showing the user. glirc_inject_chat :: Glirc_inject_chat glirc_inject_chat stab netPtr netLen srcPtr srcLen tgtPtr tgtLen msgPtr msgLen = do mvar <- derefToken stab net <- peekFgnStringLen (FgnStringLen netPtr netLen) src <- peekFgnStringLen (FgnStringLen srcPtr srcLen) tgt <- mkId <$> peekFgnStringLen (FgnStringLen tgtPtr tgtLen) txt <- peekFgnStringLen (FgnStringLen msgPtr msgLen) now <- getZonedTime let msg = ClientMessage { _msgBody = IrcBody (Privmsg (Source (parseUserInfo src) "") tgt txt) , _msgTime = now , _msgNetwork = net } modifyMVar_ mvar $ \(i, st) -> do return (i, recordChannelMessage net tgt msg st) return 0 `catch` \SomeException{} -> return 1
1,030
glirc_inject_chat :: Glirc_inject_chat glirc_inject_chat stab netPtr netLen srcPtr srcLen tgtPtr tgtLen msgPtr msgLen = do mvar <- derefToken stab net <- peekFgnStringLen (FgnStringLen netPtr netLen) src <- peekFgnStringLen (FgnStringLen srcPtr srcLen) tgt <- mkId <$> peekFgnStringLen (FgnStringLen tgtPtr tgtLen) txt <- peekFgnStringLen (FgnStringLen msgPtr msgLen) now <- getZonedTime let msg = ClientMessage { _msgBody = IrcBody (Privmsg (Source (parseUserInfo src) "") tgt txt) , _msgTime = now , _msgNetwork = net } modifyMVar_ mvar $ \(i, st) -> do return (i, recordChannelMessage net tgt msg st) return 0 `catch` \SomeException{} -> return 1
780
glirc_inject_chat stab netPtr netLen srcPtr srcLen tgtPtr tgtLen msgPtr msgLen = do mvar <- derefToken stab net <- peekFgnStringLen (FgnStringLen netPtr netLen) src <- peekFgnStringLen (FgnStringLen srcPtr srcLen) tgt <- mkId <$> peekFgnStringLen (FgnStringLen tgtPtr tgtLen) txt <- peekFgnStringLen (FgnStringLen msgPtr msgLen) now <- getZonedTime let msg = ClientMessage { _msgBody = IrcBody (Privmsg (Source (parseUserInfo src) "") tgt txt) , _msgTime = now , _msgNetwork = net } modifyMVar_ mvar $ \(i, st) -> do return (i, recordChannelMessage net tgt msg st) return 0 `catch` \SomeException{} -> return 1
741
true
true
0
18
275
253
125
128
null
null
egaburov/funstuff
Haskell/lenses/lens1.hs
apache-2.0
view :: Lens' s a -> s -> a --view ln s = getConst (ln Const s) view ln = getConst . ln Const
93
view :: Lens' s a -> s -> a view ln = getConst . ln Const
57
view ln = getConst . ln Const
29
true
true
0
6
23
35
17
18
null
null
nikivazou/hscolour
Language/Haskell/HsColour/MIRC.hs
gpl-2.0
{-@ go :: forall <p :: a -> Prop>. Eq a => xs:[a<p>] -> ws:[a<p>] -> zs:[a] -> [a<p>] /[(len zs), (len ws)] @-} go :: Eq a => [a] -> [a] -> [a] -> [a] go xs (w:ws) (z:zs) | w == z = z : go xs xs zs | otherwise = go xs ws (z:zs)
250
go :: Eq a => [a] -> [a] -> [a] -> [a] go xs (w:ws) (z:zs) | w == z = z : go xs xs zs | otherwise = go xs ws (z:zs)
138
go xs (w:ws) (z:zs) | w == z = z : go xs xs zs | otherwise = go xs ws (z:zs)
99
true
true
1
12
80
111
56
55
null
null
haslab/SecreC
src/Language/SecreC/Transformation/Dafny.hs
gpl-3.0
ppLeakageAtt (Just True) = dtext "{:leakageout}"
48
ppLeakageAtt (Just True) = dtext "{:leakageout}"
48
ppLeakageAtt (Just True) = dtext "{:leakageout}"
48
false
false
0
6
5
19
8
11
null
null
bruno-cadorette/Baeta-Compiler
src/STDLib.hs
gpl-3.0
sub = mathHelper (-)
20
sub = mathHelper (-)
20
sub = mathHelper (-)
20
false
false
1
5
3
14
6
8
null
null
feuerbach/music
Types.hs
mit
add :: Samples -> Samples -> Samples add = (Samples .) . go `on` getSamples where go (s1:ss1) (s2:ss2) = let !s = (s1+s2) in s : go ss1 ss2 go [] ss = ss go ss [] = ss
193
add :: Samples -> Samples -> Samples add = (Samples .) . go `on` getSamples where go (s1:ss1) (s2:ss2) = let !s = (s1+s2) in s : go ss1 ss2 go [] ss = ss go ss [] = ss
193
add = (Samples .) . go `on` getSamples where go (s1:ss1) (s2:ss2) = let !s = (s1+s2) in s : go ss1 ss2 go [] ss = ss go ss [] = ss
156
false
true
5
10
65
136
60
76
null
null
AlephAlpha/Samau
OldSamau/Eval.hs
gpl-2.0
smSize (SmString xs:s) = SmInt (genericLength xs):s
51
smSize (SmString xs:s) = SmInt (genericLength xs):s
51
smSize (SmString xs:s) = SmInt (genericLength xs):s
51
false
false
0
8
6
32
15
17
null
null
twadleigh/cuda-npp
C2HS.hs
bsd-3-clause
-- Composite marshalling functions -- ------------------------------- -- Strings with explicit length -- withCStringLenIntConv :: Num n => String -> ((CString, n) -> IO a) -> IO a withCStringLenIntConv s f = withCStringLen s $ \(p, n) -> f (p, fromIntegral n)
263
withCStringLenIntConv :: Num n => String -> ((CString, n) -> IO a) -> IO a withCStringLenIntConv s f = withCStringLen s $ \(p, n) -> f (p, fromIntegral n)
157
withCStringLenIntConv s f = withCStringLen s $ \(p, n) -> f (p, fromIntegral n)
82
true
true
0
10
44
84
45
39
null
null
rvion/lamdu
Lamdu/GUI/TypeView.hs
gpl-3.0
split :: Monad m => M m a -> M m a split (M act) = do splitGen <- M $ state Random.split M $ lift $ evalStateT act splitGen
143
split :: Monad m => M m a -> M m a split (M act) = do splitGen <- M $ state Random.split M $ lift $ evalStateT act splitGen
143
split (M act) = do splitGen <- M $ state Random.split M $ lift $ evalStateT act splitGen
108
false
true
0
10
49
73
33
40
null
null
mightybyte/cabal
cabal-install/Main.hs
bsd-3-clause
initAction :: InitFlags -> [String] -> GlobalFlags -> IO () initAction initFlags _extraArgs globalFlags = do let verbosity = fromFlag (initVerbosity initFlags) (_useSandbox, config) <- loadConfigOrSandboxConfig verbosity (globalFlags { globalRequireSandbox = Flag False }) let configFlags = savedConfigureFlags config let globalFlags' = savedGlobalFlags config `mappend` globalFlags (comp, _, conf) <- configCompilerAux' configFlags initCabal verbosity (configPackageDB' configFlags) (globalRepos globalFlags') comp conf initFlags
633
initAction :: InitFlags -> [String] -> GlobalFlags -> IO () initAction initFlags _extraArgs globalFlags = do let verbosity = fromFlag (initVerbosity initFlags) (_useSandbox, config) <- loadConfigOrSandboxConfig verbosity (globalFlags { globalRequireSandbox = Flag False }) let configFlags = savedConfigureFlags config let globalFlags' = savedGlobalFlags config `mappend` globalFlags (comp, _, conf) <- configCompilerAux' configFlags initCabal verbosity (configPackageDB' configFlags) (globalRepos globalFlags') comp conf initFlags
633
initAction initFlags _extraArgs globalFlags = do let verbosity = fromFlag (initVerbosity initFlags) (_useSandbox, config) <- loadConfigOrSandboxConfig verbosity (globalFlags { globalRequireSandbox = Flag False }) let configFlags = savedConfigureFlags config let globalFlags' = savedGlobalFlags config `mappend` globalFlags (comp, _, conf) <- configCompilerAux' configFlags initCabal verbosity (configPackageDB' configFlags) (globalRepos globalFlags') comp conf initFlags
573
false
true
0
12
163
165
81
84
null
null
prophet-on-that/hslogger-reader
src/System/Log/Reader.hs
bsd-3-clause
-- | As 'logMessageParser', but provide a custom time format for -- parsing @ "$time" @ and @ "$utcTime" @ formatters. Compatible with -- hslogger's /tfLogFormatter/ function. tfLogMessageParser :: FormatString -> Parser T.Text -- ^ LoggerName parser -> Parser ZonedTime -- ^ Time parser -> Either String (Parser LogMessage) tfLogMessageParser format loggerNameParser zonedTimeParser = do instrs <- parseOnly (formatStringParser <* endOfInput) format return $ buildParser loggerNameParser zonedTimeParser instrs -- | Parse time format string @ "%F %X %Z" @ with 'defaultTimeLocale'.
595
tfLogMessageParser :: FormatString -> Parser T.Text -- ^ LoggerName parser -> Parser ZonedTime -- ^ Time parser -> Either String (Parser LogMessage) tfLogMessageParser format loggerNameParser zonedTimeParser = do instrs <- parseOnly (formatStringParser <* endOfInput) format return $ buildParser loggerNameParser zonedTimeParser instrs -- | Parse time format string @ "%F %X %Z" @ with 'defaultTimeLocale'.
419
tfLogMessageParser format loggerNameParser zonedTimeParser = do instrs <- parseOnly (formatStringParser <* endOfInput) format return $ buildParser loggerNameParser zonedTimeParser instrs -- | Parse time format string @ "%F %X %Z" @ with 'defaultTimeLocale'.
262
true
true
0
11
93
93
45
48
null
null
ctford/Idris-Elba-dev
src/IRTS/Lang.hs
bsd-3-clause
lift env (LProj t i) = do t' <- lift env t return (LProj t' i)
88
lift env (LProj t i) = do t' <- lift env t return (LProj t' i)
88
lift env (LProj t i) = do t' <- lift env t return (LProj t' i)
88
false
false
0
9
41
47
20
27
null
null
Ekleog/hasklate
src/Main.hs
mit
symbolName "<" = "symbol_lessthan"
34
symbolName "<" = "symbol_lessthan"
34
symbolName "<" = "symbol_lessthan"
34
false
false
1
5
3
13
4
9
null
null
tphyahoo/happs-tutorial
src/ControllerStressTests.hs
bsd-3-clause
stresstestUser jobsperU i = ( UserName . B.pack $ ("user"++(show i)) , UserInfos ( B.pack $ "password" ++ (show i)) (stresstestprofile i) (Jobs $ M.fromList $ map (stresstestjob i) [1..jobsperU]) ) where stresstestprofile i = UserProfile { contact = B.pack $ "someone" ++ (show i) ++ "@somewhere.com" , blurb = B.pack $ "la la la" , consultant = if even i then True else False , avatar = B.pack ""} stresstestjob i j = ( JobName . B.pack $ "make something " ++ (show (i,j)) , Job { jobbudget = B.pack . show $ (i,j) , jobblurb = B.pack . ("blurb " ++) . show $ (i,j) } ) -- dummy data appropriate for a job site demo and testing -- tphyahoo is consultant type user (wants to find work) -- zzz posted a lot of test jobs
1,069
stresstestUser jobsperU i = ( UserName . B.pack $ ("user"++(show i)) , UserInfos ( B.pack $ "password" ++ (show i)) (stresstestprofile i) (Jobs $ M.fromList $ map (stresstestjob i) [1..jobsperU]) ) where stresstestprofile i = UserProfile { contact = B.pack $ "someone" ++ (show i) ++ "@somewhere.com" , blurb = B.pack $ "la la la" , consultant = if even i then True else False , avatar = B.pack ""} stresstestjob i j = ( JobName . B.pack $ "make something " ++ (show (i,j)) , Job { jobbudget = B.pack . show $ (i,j) , jobblurb = B.pack . ("blurb " ++) . show $ (i,j) } ) -- dummy data appropriate for a job site demo and testing -- tphyahoo is consultant type user (wants to find work) -- zzz posted a lot of test jobs
1,069
stresstestUser jobsperU i = ( UserName . B.pack $ ("user"++(show i)) , UserInfos ( B.pack $ "password" ++ (show i)) (stresstestprofile i) (Jobs $ M.fromList $ map (stresstestjob i) [1..jobsperU]) ) where stresstestprofile i = UserProfile { contact = B.pack $ "someone" ++ (show i) ++ "@somewhere.com" , blurb = B.pack $ "la la la" , consultant = if even i then True else False , avatar = B.pack ""} stresstestjob i j = ( JobName . B.pack $ "make something " ++ (show (i,j)) , Job { jobbudget = B.pack . show $ (i,j) , jobblurb = B.pack . ("blurb " ++) . show $ (i,j) } ) -- dummy data appropriate for a job site demo and testing -- tphyahoo is consultant type user (wants to find work) -- zzz posted a lot of test jobs
1,069
false
false
1
12
488
279
153
126
null
null
pront/nemo-mpi
src/api/autogen/API.hs
gpl-2.0
inputCount :: ApiFunction -> Int inputCount = length . fn_inputs
64
inputCount :: ApiFunction -> Int inputCount = length . fn_inputs
64
inputCount = length . fn_inputs
31
false
true
0
5
9
19
10
9
null
null
jwiegley/ghc-release
libraries/bytestring/Data/ByteString/Internal.hs
gpl-3.0
packBytes :: [Word8] -> ByteString packBytes ws = unsafePackLenBytes (List.length ws) ws
88
packBytes :: [Word8] -> ByteString packBytes ws = unsafePackLenBytes (List.length ws) ws
88
packBytes ws = unsafePackLenBytes (List.length ws) ws
53
false
true
0
8
11
34
17
17
null
null
TomMD/CV
CV/HoughTransform.hs
bsd-3-clause
imageHoughLinesMultiScale :: Int -> Double -> Double -> Int -> Double -> Double -> Image GrayScale D8 -> ImageWithLines imageHoughLinesMultiScale n ρ θ t distDiv angleDiv img = (img `With` [Line (realToFrac y)(realToFrac k) | (y,k) <- hough]) where (w,h) = getSize img hough = houghLinesMultiscale img n ρ θ t distDiv angleDiv
346
imageHoughLinesMultiScale :: Int -> Double -> Double -> Int -> Double -> Double -> Image GrayScale D8 -> ImageWithLines imageHoughLinesMultiScale n ρ θ t distDiv angleDiv img = (img `With` [Line (realToFrac y)(realToFrac k) | (y,k) <- hough]) where (w,h) = getSize img hough = houghLinesMultiscale img n ρ θ t distDiv angleDiv
346
imageHoughLinesMultiScale n ρ θ t distDiv angleDiv img = (img `With` [Line (realToFrac y)(realToFrac k) | (y,k) <- hough]) where (w,h) = getSize img hough = houghLinesMultiscale img n ρ θ t distDiv angleDiv
226
false
true
1
12
72
139
72
67
null
null
fmapfmapfmap/amazonka
amazonka-swf/gen/Network/AWS/SWF/StartWorkflowExecution.hs
mpl-2.0
-- | The task priority to use for this workflow execution. This will override -- any default priority that was assigned when the workflow type was -- registered. If not set, then the default task priority for the workflow -- type will be used. Valid values are integers that range from Java\'s -- 'Integer.MIN_VALUE' (-2147483648) to 'Integer.MAX_VALUE' (2147483647). -- Higher numbers indicate higher priority. -- -- For more information about setting task priority, see -- <http://docs.aws.amazon.com/amazonswf/latest/developerguide/programming-priority.html Setting Task Priority> -- in the /Amazon Simple Workflow Developer Guide/. sTaskPriority :: Lens' StartWorkflowExecution (Maybe Text) sTaskPriority = lens _sTaskPriority (\ s a -> s{_sTaskPriority = a})
763
sTaskPriority :: Lens' StartWorkflowExecution (Maybe Text) sTaskPriority = lens _sTaskPriority (\ s a -> s{_sTaskPriority = a})
127
sTaskPriority = lens _sTaskPriority (\ s a -> s{_sTaskPriority = a})
68
true
true
0
9
103
55
34
21
null
null
phadej/stack
src/Stack/Upload.hs
bsd-3-clause
mkUploader :: Config -> UploadSettings -> IO Uploader mkUploader config us = do manager <- usGetManager us (creds, fromFile') <- loadCreds $ usCredsSource us config when (not fromFile' && usSaveCreds us) $ saveCreds config creds req0 <- parseUrl $ usUploadUrl us let req1 = req0 { requestHeaders = [("Accept", "text/plain")] , checkStatus = \_ _ _ -> Nothing } return Uploader { upload_ = \tarName bytes -> do let formData = [partFileRequestBody "package" tarName (RequestBodyLBS bytes)] req2 <- formDataBody formData req1 let req3 = applyBasicAuth (encodeUtf8 $ hcUsername creds) (encodeUtf8 $ hcPassword creds) req2 putStr $ "Uploading " ++ tarName ++ "... " hFlush stdout withResponse req3 manager $ \res -> case statusCode $ responseStatus res of 200 -> putStrLn "done!" 401 -> do putStrLn "authentication failure" cfp <- credsFile config handleIO (const $ return ()) (removeFile cfp) error "Authentication failure uploading to server" 403 -> do putStrLn "forbidden upload" putStrLn "Usually means: you've already uploaded this package/version combination" putStrLn "Ignoring error and continuing, full message from Hackage below:\n" printBody res 503 -> do putStrLn "service unavailable" putStrLn "This error some times gets sent even though the upload succeeded" putStrLn "Check on Hackage to see if your pacakge is present" printBody res code -> do putStrLn $ "unhandled status code: " ++ show code printBody res error $ "Upload failed on " ++ tarName }
2,144
mkUploader :: Config -> UploadSettings -> IO Uploader mkUploader config us = do manager <- usGetManager us (creds, fromFile') <- loadCreds $ usCredsSource us config when (not fromFile' && usSaveCreds us) $ saveCreds config creds req0 <- parseUrl $ usUploadUrl us let req1 = req0 { requestHeaders = [("Accept", "text/plain")] , checkStatus = \_ _ _ -> Nothing } return Uploader { upload_ = \tarName bytes -> do let formData = [partFileRequestBody "package" tarName (RequestBodyLBS bytes)] req2 <- formDataBody formData req1 let req3 = applyBasicAuth (encodeUtf8 $ hcUsername creds) (encodeUtf8 $ hcPassword creds) req2 putStr $ "Uploading " ++ tarName ++ "... " hFlush stdout withResponse req3 manager $ \res -> case statusCode $ responseStatus res of 200 -> putStrLn "done!" 401 -> do putStrLn "authentication failure" cfp <- credsFile config handleIO (const $ return ()) (removeFile cfp) error "Authentication failure uploading to server" 403 -> do putStrLn "forbidden upload" putStrLn "Usually means: you've already uploaded this package/version combination" putStrLn "Ignoring error and continuing, full message from Hackage below:\n" printBody res 503 -> do putStrLn "service unavailable" putStrLn "This error some times gets sent even though the upload succeeded" putStrLn "Check on Hackage to see if your pacakge is present" printBody res code -> do putStrLn $ "unhandled status code: " ++ show code printBody res error $ "Upload failed on " ++ tarName }
2,144
mkUploader config us = do manager <- usGetManager us (creds, fromFile') <- loadCreds $ usCredsSource us config when (not fromFile' && usSaveCreds us) $ saveCreds config creds req0 <- parseUrl $ usUploadUrl us let req1 = req0 { requestHeaders = [("Accept", "text/plain")] , checkStatus = \_ _ _ -> Nothing } return Uploader { upload_ = \tarName bytes -> do let formData = [partFileRequestBody "package" tarName (RequestBodyLBS bytes)] req2 <- formDataBody formData req1 let req3 = applyBasicAuth (encodeUtf8 $ hcUsername creds) (encodeUtf8 $ hcPassword creds) req2 putStr $ "Uploading " ++ tarName ++ "... " hFlush stdout withResponse req3 manager $ \res -> case statusCode $ responseStatus res of 200 -> putStrLn "done!" 401 -> do putStrLn "authentication failure" cfp <- credsFile config handleIO (const $ return ()) (removeFile cfp) error "Authentication failure uploading to server" 403 -> do putStrLn "forbidden upload" putStrLn "Usually means: you've already uploaded this package/version combination" putStrLn "Ignoring error and continuing, full message from Hackage below:\n" printBody res 503 -> do putStrLn "service unavailable" putStrLn "This error some times gets sent even though the upload succeeded" putStrLn "Check on Hackage to see if your pacakge is present" printBody res code -> do putStrLn $ "unhandled status code: " ++ show code printBody res error $ "Upload failed on " ++ tarName }
2,090
false
true
0
25
908
450
203
247
null
null
burz/Feval
FVL/Eval.hs
mit
substitute s v (Fx' (Function x p)) = Fx' $ if x == s then Function x p else Function x (substitute s v p)
114
substitute s v (Fx' (Function x p)) = Fx' $ if x == s then Function x p else Function x (substitute s v p)
114
substitute s v (Fx' (Function x p)) = Fx' $ if x == s then Function x p else Function x (substitute s v p)
114
false
false
0
9
32
63
31
32
null
null
crackleware/hscolour
Language/Haskell/HsColour/MIRC.hs
gpl-2.0
code :: Colour -> Bool -> String code Black False = "1"
57
code :: Colour -> Bool -> String code Black False = "1"
57
code Black False = "1"
24
false
true
0
6
13
24
12
12
null
null
oldmanmike/CsoundRaw
src/Sound/Csound/Threading.hs
bsd-3-clause
csoundUnlockMutex :: MonadIO m => Ptr () -> m () csoundUnlockMutex mutex = liftIO (csoundUnlockMutex' mutex)
108
csoundUnlockMutex :: MonadIO m => Ptr () -> m () csoundUnlockMutex mutex = liftIO (csoundUnlockMutex' mutex)
108
csoundUnlockMutex mutex = liftIO (csoundUnlockMutex' mutex)
59
false
true
0
8
15
44
20
24
null
null
snoyberg/ghc
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
bsd-3-clause
{- | @reifyRoles nm@ returns the list of roles associated with the parameters of the tycon @nm@. Fails if @nm@ cannot be found or is not a tycon. The returned list should never contain 'InferR'. -} reifyRoles :: Name -> Q [Role] reifyRoles nm = Q (qReifyRoles nm)
263
reifyRoles :: Name -> Q [Role] reifyRoles nm = Q (qReifyRoles nm)
65
reifyRoles nm = Q (qReifyRoles nm)
34
true
true
0
7
47
34
17
17
null
null
yesodweb/persistent
persistent-test/src/LongIdentifierTest.hs
mit
specsWith :: (MonadIO m) => RunDb SqlBackend m -> Spec specsWith runDb = describe "Long identifiers" $ do -- See 'refName' in Postgresql.hs for why these tests are necessary. it "migrating is idempotent" $ runDb $ do again <- getMigration migration liftIO $ again @?= [] it "migrating really is idempotent" $ runDb $ do runMigration migration again <- getMigration migration liftIO $ again @?= []
438
specsWith :: (MonadIO m) => RunDb SqlBackend m -> Spec specsWith runDb = describe "Long identifiers" $ do -- See 'refName' in Postgresql.hs for why these tests are necessary. it "migrating is idempotent" $ runDb $ do again <- getMigration migration liftIO $ again @?= [] it "migrating really is idempotent" $ runDb $ do runMigration migration again <- getMigration migration liftIO $ again @?= []
438
specsWith runDb = describe "Long identifiers" $ do -- See 'refName' in Postgresql.hs for why these tests are necessary. it "migrating is idempotent" $ runDb $ do again <- getMigration migration liftIO $ again @?= [] it "migrating really is idempotent" $ runDb $ do runMigration migration again <- getMigration migration liftIO $ again @?= []
383
false
true
0
13
107
126
55
71
null
null
nevrenato/Hets_Fork
CASL/CompositionTable/ParseSparQ.hs
gpl-2.0
parseSparQTable :: Parser Table parseSparQTable = inParens $ do calculusName <- parseCalculusName (i1, rs1) <- parseIdBaOths ct <- parseConversetable (i2, rs2) <- parseIdBaOths compt <- parseCompTable (i3, rs3) <- parseIdBaOths case i1 ++ i2 ++ i3 of [i] -> return $ Table (Table_Attrs calculusName i $ rs1 ++ rs2 ++ rs3) compt ct (Reflectiontable []) $ Models [] [] -> fail "missing identity relation" is -> fail $ "non-unique identity relation " ++ show is
496
parseSparQTable :: Parser Table parseSparQTable = inParens $ do calculusName <- parseCalculusName (i1, rs1) <- parseIdBaOths ct <- parseConversetable (i2, rs2) <- parseIdBaOths compt <- parseCompTable (i3, rs3) <- parseIdBaOths case i1 ++ i2 ++ i3 of [i] -> return $ Table (Table_Attrs calculusName i $ rs1 ++ rs2 ++ rs3) compt ct (Reflectiontable []) $ Models [] [] -> fail "missing identity relation" is -> fail $ "non-unique identity relation " ++ show is
496
parseSparQTable = inParens $ do calculusName <- parseCalculusName (i1, rs1) <- parseIdBaOths ct <- parseConversetable (i2, rs2) <- parseIdBaOths compt <- parseCompTable (i3, rs3) <- parseIdBaOths case i1 ++ i2 ++ i3 of [i] -> return $ Table (Table_Attrs calculusName i $ rs1 ++ rs2 ++ rs3) compt ct (Reflectiontable []) $ Models [] [] -> fail "missing identity relation" is -> fail $ "non-unique identity relation " ++ show is
464
false
true
0
18
112
180
88
92
null
null
ucam-cl-dtg/naps-camfort
Transformation/CommonBlockElimToCalls.hs
mit
nonNullArgs (ASeq _ _ _) = True
31
nonNullArgs (ASeq _ _ _) = True
31
nonNullArgs (ASeq _ _ _) = True
31
false
false
0
6
6
20
9
11
null
null
moonKimura/aeson-0.6.2.1
Data/Aeson/Types/Internal.hs
bsd-3-clause
-- | Run a 'Parser' with an 'Either' result type. parseEither :: (a -> Parser b) -> a -> Either String b parseEither m v = runParser (m v) Left Right
149
parseEither :: (a -> Parser b) -> a -> Either String b parseEither m v = runParser (m v) Left Right
99
parseEither m v = runParser (m v) Left Right
44
true
true
0
8
30
53
26
27
null
null
Apanatshka/99-questions
P06.hs
mit
isPalindrome' :: Eq a => [a] -> Bool isPalindrome' list | even . length $ list = take half list == reverse (drop half list) | otherwise = take half list == reverse (drop (half+1) list) where half = flip div 2 $ length list
241
isPalindrome' :: Eq a => [a] -> Bool isPalindrome' list | even . length $ list = take half list == reverse (drop half list) | otherwise = take half list == reverse (drop (half+1) list) where half = flip div 2 $ length list
241
isPalindrome' list | even . length $ list = take half list == reverse (drop half list) | otherwise = take half list == reverse (drop (half+1) list) where half = flip div 2 $ length list
204
false
true
1
10
63
116
55
61
null
null
trbauer/hpath
HPath.hs
mit
pmLookup pm f = DM.lookup f pm
30
pmLookup pm f = DM.lookup f pm
30
pmLookup pm f = DM.lookup f pm
30
false
false
0
6
6
18
8
10
null
null
spechub/Hets
Common/Lib/SizedList.hs
gpl-2.0
null :: SizedList a -> Bool null (N n _) = n == 0
49
null :: SizedList a -> Bool null (N n _) = n == 0
49
null (N n _) = n == 0
21
false
true
0
7
13
33
16
17
null
null
yobiya/jcc
json.hs
mit
{- - 囲まれている要素を取り出す - - String 要素を取り出される文字列 - Char 囲む開始文字 - Char 囲む終了文字 - Fragile String エラーメッセージか取り出された文字列 -} bracketContent :: String -> Char -> Char -> Fragile String bracketContent text sb eb | sb == eb = maybe (emlNonBracketPair sb eb) Right $ sameBracketContent text sb | otherwise = maybe (emlNonBracketPair sb eb) Right $ bracketContentLevel text sb eb []
424
bracketContent :: String -> Char -> Char -> Fragile String bracketContent text sb eb | sb == eb = maybe (emlNonBracketPair sb eb) Right $ sameBracketContent text sb | otherwise = maybe (emlNonBracketPair sb eb) Right $ bracketContentLevel text sb eb []
279
bracketContent text sb eb | sb == eb = maybe (emlNonBracketPair sb eb) Right $ sameBracketContent text sb | otherwise = maybe (emlNonBracketPair sb eb) Right $ bracketContentLevel text sb eb []
220
true
true
0
9
121
103
48
55
null
null
meiersi/scyther-proof
src/Scyther/Facts.hs
gpl-3.0
-- | Insert all non-trivial events implied by the given event. insertEvNonTrivial :: Cert Event -> Facts -> Facts insertEvNonTrivial ev prems = case certified ev of Learn m -> foldl' (flip (insertLearn . Cert)) prems (splitNonTrivial m) Step _ _ -> insertEv ev prems -- | Insert all event orders which are non-trivial in their first argument -- implied by the given event order.
384
insertEvNonTrivial :: Cert Event -> Facts -> Facts insertEvNonTrivial ev prems = case certified ev of Learn m -> foldl' (flip (insertLearn . Cert)) prems (splitNonTrivial m) Step _ _ -> insertEv ev prems -- | Insert all event orders which are non-trivial in their first argument -- implied by the given event order.
321
insertEvNonTrivial ev prems = case certified ev of Learn m -> foldl' (flip (insertLearn . Cert)) prems (splitNonTrivial m) Step _ _ -> insertEv ev prems -- | Insert all event orders which are non-trivial in their first argument -- implied by the given event order.
270
true
true
0
12
70
93
44
49
null
null
dmjio/aeson
src/Data/Aeson/KeyMap.hs
bsd-3-clause
-- | Convert a 'HashMap' to a 'KeyMap'. fromHashMap :: HashMap Key v -> KeyMap v fromHashMap = fromList . H.toList
114
fromHashMap :: HashMap Key v -> KeyMap v fromHashMap = fromList . H.toList
74
fromHashMap = fromList . H.toList
33
true
true
1
7
20
37
16
21
null
null
nomeata/list-fusion-lab
ListImpls/FusingFoldl.hs
bsd-3-clause
uncons (x:xs) = Just (x, xs)
38
uncons (x:xs) = Just (x, xs)
38
uncons (x:xs) = Just (x, xs)
38
false
false
0
6
15
26
13
13
null
null
abinr/nine
test/ExTwoSpec.hs
bsd-3-clause
nextToLastAsMaybe :: [a] -> Maybe a nextToLastAsMaybe list = case list of [] -> Nothing [x] -> Nothing x : y : [] -> Just x _:xs -> nextToLastAsMaybe xs
194
nextToLastAsMaybe :: [a] -> Maybe a nextToLastAsMaybe list = case list of [] -> Nothing [x] -> Nothing x : y : [] -> Just x _:xs -> nextToLastAsMaybe xs
194
nextToLastAsMaybe list = case list of [] -> Nothing [x] -> Nothing x : y : [] -> Just x _:xs -> nextToLastAsMaybe xs
158
false
true
0
10
71
81
39
42
null
null
acamino/state-codes
src/Data/StateCodes/ISO31662US.hs
mit
toText TN = "TN"
16
toText TN = "TN"
16
toText TN = "TN"
16
false
false
0
5
3
9
4
5
null
null
a143753/AOJ
0642.hs
apache-2.0
ans' [] = [0]
13
ans' [] = [0]
13
ans' [] = [0]
13
false
false
1
5
3
17
7
10
null
null
tomlokhorst/language-cil
src/Language/Cil/Build.hs
bsd-3-clause
ldloc 1 = OpCode $ Ldloc_1
26
ldloc 1 = OpCode $ Ldloc_1
26
ldloc 1 = OpCode $ Ldloc_1
26
false
false
3
5
5
18
6
12
null
null
tarleb/huskydoc
src/Text/Huskydoc/Inlines.hs
isc
schemas :: [String] schemas = ["https", "http", "ftp", "irc", "mailto"]
71
schemas :: [String] schemas = ["https", "http", "ftp", "irc", "mailto"]
71
schemas = ["https", "http", "ftp", "irc", "mailto"]
51
false
true
0
5
9
29
18
11
null
null
luigy/stack
src/Stack/Build/ConstructPlan.hs
bsd-3-clause
psWanted (PSUpstream {}) = False
32
psWanted (PSUpstream {}) = False
32
psWanted (PSUpstream {}) = False
32
false
false
0
7
4
16
8
8
null
null
uProxy/uproxy-idl-compiler
Parse/Pretty.hs
apache-2.0
typeParameter :: TypeParameter -> Doc typeParameter (TypeParameter name ext) = text name <+> renderMaybe (\t -> text "extends" <+> _type t) ext
147
typeParameter :: TypeParameter -> Doc typeParameter (TypeParameter name ext) = text name <+> renderMaybe (\t -> text "extends" <+> _type t) ext
147
typeParameter (TypeParameter name ext) = text name <+> renderMaybe (\t -> text "extends" <+> _type t) ext
109
false
true
2
9
25
57
27
30
null
null
pparkkin/eta
compiler/ETA/Prelude/TysWiredIn.hs
bsd-3-clause
wordTyCon :: TyCon wordTyCon = pcNonRecDataTyCon wordTyConName (Just (CType "" Nothing (fsLit "HsWord"))) [] [wordDataCon]
182
wordTyCon :: TyCon wordTyCon = pcNonRecDataTyCon wordTyConName (Just (CType "" Nothing (fsLit "HsWord"))) [] [wordDataCon]
182
wordTyCon = pcNonRecDataTyCon wordTyConName (Just (CType "" Nothing (fsLit "HsWord"))) [] [wordDataCon]
163
false
true
0
11
74
47
24
23
null
null
jareks/haskell-workout
prime500/prime500.hs
gpl-3.0
getPrimes n = foldl (\primes i -> primes ++ [nextPrime primes]) (getPrimes 2) [2..n]
86
getPrimes n = foldl (\primes i -> primes ++ [nextPrime primes]) (getPrimes 2) [2..n]
86
getPrimes n = foldl (\primes i -> primes ++ [nextPrime primes]) (getPrimes 2) [2..n]
86
false
false
1
10
15
51
24
27
null
null
dsorokin/aivika-experiment-chart
examples/Furnace/Experiment.hs
bsd-3-clause
inputIngotCount = resultByName inputIngotCountName
51
inputIngotCount = resultByName inputIngotCountName
51
inputIngotCount = resultByName inputIngotCountName
51
false
false
1
5
4
12
4
8
null
null
agrafix/legoDSL
NXT/Types.hs
bsd-3-clause
prettyStmt :: Stmt -> String prettyStmt (If cond t f) = "if (" ++ (prettyT cond) ++ ") {" ++ (concatMap prettyStmt t) ++ "}" ++ (case f of [] -> "" _ -> " else { " ++ (concatMap prettyStmt f) ++ "}" )
239
prettyStmt :: Stmt -> String prettyStmt (If cond t f) = "if (" ++ (prettyT cond) ++ ") {" ++ (concatMap prettyStmt t) ++ "}" ++ (case f of [] -> "" _ -> " else { " ++ (concatMap prettyStmt f) ++ "}" )
239
prettyStmt (If cond t f) = "if (" ++ (prettyT cond) ++ ") {" ++ (concatMap prettyStmt t) ++ "}" ++ (case f of [] -> "" _ -> " else { " ++ (concatMap prettyStmt f) ++ "}" )
210
false
true
6
13
83
107
51
56
null
null
dorchard/gram_lang
frontend/src/Language/Granule/Checker/Constraints/SymbolicGrades.hs
bsd-3-clause
symGradeTimes (SExtNat x) (SExtNat y) = return $ SExtNat (x * y)
64
symGradeTimes (SExtNat x) (SExtNat y) = return $ SExtNat (x * y)
64
symGradeTimes (SExtNat x) (SExtNat y) = return $ SExtNat (x * y)
64
false
false
0
8
11
37
18
19
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/ExtensionPredicates.hs
bsd-3-clause
-- | Is the <https://www.opengl.org/registry/specs/AMD/depth_clamp_separate.txt AMD_depth_clamp_separate> extension supported? glGetAMDDepthClampSeparate :: MonadIO m => m Bool glGetAMDDepthClampSeparate = getExtensions >>= (return . member "GL_AMD_depth_clamp_separate")
271
glGetAMDDepthClampSeparate :: MonadIO m => m Bool glGetAMDDepthClampSeparate = getExtensions >>= (return . member "GL_AMD_depth_clamp_separate")
144
glGetAMDDepthClampSeparate = getExtensions >>= (return . member "GL_AMD_depth_clamp_separate")
94
true
true
0
8
22
36
18
18
null
null
bjornbm/aeq
tests/Tests.hs
bsd-3-clause
test_sameishSignificandBits_fewbits_F4 = sameishSignificandBits (1.5 + epsilon) (1.5 :: F) @?= floatDigits (undefined :: F) - 1
139
test_sameishSignificandBits_fewbits_F4 = sameishSignificandBits (1.5 + epsilon) (1.5 :: F) @?= floatDigits (undefined :: F) - 1
139
test_sameishSignificandBits_fewbits_F4 = sameishSignificandBits (1.5 + epsilon) (1.5 :: F) @?= floatDigits (undefined :: F) - 1
139
false
false
0
9
27
41
22
19
null
null