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
nickbart1980/pandoc
src/Text/Pandoc/Parsing.hs
gpl-2.0
-- | Update the position on which the last string ended. updateLastStrPos :: HasLastStrPosition st => Parser s st () updateLastStrPos = getPosition >>= updateState . setLastStrPos
179
updateLastStrPos :: HasLastStrPosition st => Parser s st () updateLastStrPos = getPosition >>= updateState . setLastStrPos
122
updateLastStrPos = getPosition >>= updateState . setLastStrPos
62
true
true
0
7
26
36
18
18
null
null
tdeekens/tda452-code
Exercises/exercise-3.hs
mit
bag (x:xs) = (x, (length idx) + 1) : bag xs' where idx = elemIndices x xs xs' = deleteAll x xs
109
bag (x:xs) = (x, (length idx) + 1) : bag xs' where idx = elemIndices x xs xs' = deleteAll x xs
109
bag (x:xs) = (x, (length idx) + 1) : bag xs' where idx = elemIndices x xs xs' = deleteAll x xs
109
false
false
1
9
36
63
31
32
null
null
ekohl/ganeti
htools/Ganeti/Luxi.hs
gpl-2.0
strOfOp QueryTags {} = "QueryTags"
42
strOfOp QueryTags {} = "QueryTags"
42
strOfOp QueryTags {} = "QueryTags"
42
false
false
0
6
12
13
6
7
null
null
TomMD/irc-core
src/Irc/Model.hs
bsd-3-clause
doAcceptList :: [Identifier] {- ^ nicks -} -> IrcConnection -> Logic IrcConnection doAcceptList acc conn = do msg <- getMessage case msg of RplAcceptList nick -> doAcceptList (nick:acc) conn RplEndOfAccept -> doServerMessage "ACCEPTLIST" (B8.unwords (map idBytes (reverse acc))) conn _ -> fail "doAcceptList: Unexpected message!"
397
doAcceptList :: [Identifier] {- ^ nicks -} -> IrcConnection -> Logic IrcConnection doAcceptList acc conn = do msg <- getMessage case msg of RplAcceptList nick -> doAcceptList (nick:acc) conn RplEndOfAccept -> doServerMessage "ACCEPTLIST" (B8.unwords (map idBytes (reverse acc))) conn _ -> fail "doAcceptList: Unexpected message!"
397
doAcceptList acc conn = do msg <- getMessage case msg of RplAcceptList nick -> doAcceptList (nick:acc) conn RplEndOfAccept -> doServerMessage "ACCEPTLIST" (B8.unwords (map idBytes (reverse acc))) conn _ -> fail "doAcceptList: Unexpected message!"
310
false
true
0
16
112
110
53
57
null
null
brendanhay/gogol
gogol-logging/gen/Network/Google/Logging/Types/Product.hs
mpl-2.0
-- | Creates a value of 'MonitoredResourceMetadata' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'mrmUserLabels' -- -- * 'mrmSystemLabels' monitoredResourceMetadata :: MonitoredResourceMetadata monitoredResourceMetadata = MonitoredResourceMetadata' {_mrmUserLabels = Nothing, _mrmSystemLabels = Nothing}
401
monitoredResourceMetadata :: MonitoredResourceMetadata monitoredResourceMetadata = MonitoredResourceMetadata' {_mrmUserLabels = Nothing, _mrmSystemLabels = Nothing}
174
monitoredResourceMetadata = MonitoredResourceMetadata' {_mrmUserLabels = Nothing, _mrmSystemLabels = Nothing}
115
true
true
1
7
59
39
23
16
null
null
sashabu/libcspm
src/CSPM/Parser/Exceptions.hs
bsd-3-clause
looksLikeRTFErrorMessage :: FilePath -> ErrorMessage looksLikeRTFErrorMessage fp = mkErrorMessage Unknown $ text "The file" <+> quotes (text fp) $$ text "looks like a file in rich-text format (RTF). Only plain-text files are accepted."
243
looksLikeRTFErrorMessage :: FilePath -> ErrorMessage looksLikeRTFErrorMessage fp = mkErrorMessage Unknown $ text "The file" <+> quotes (text fp) $$ text "looks like a file in rich-text format (RTF). Only plain-text files are accepted."
243
looksLikeRTFErrorMessage fp = mkErrorMessage Unknown $ text "The file" <+> quotes (text fp) $$ text "looks like a file in rich-text format (RTF). Only plain-text files are accepted."
190
false
true
2
8
40
49
22
27
null
null
Feeniks/wreq
Network/Wreq/Internal/AWS.hs
bsd-3-clause
removeRunscope :: S.ByteString -> S.ByteString removeRunscope hostname | ".runscope.net" `S.isSuffixOf` hostname = S.concat . Prelude.map (p2 . p1) . S.group -- decode -- drop suffix "-<BUCKET>.runscope.net" before decoding . S.reverse . S.tail . S.dropWhile (/= '-') . S.reverse $ hostname | otherwise = hostname where p1 "-" = "." p1 other = other p2 "--" = "-" p2 other = other
439
removeRunscope :: S.ByteString -> S.ByteString removeRunscope hostname | ".runscope.net" `S.isSuffixOf` hostname = S.concat . Prelude.map (p2 . p1) . S.group -- decode -- drop suffix "-<BUCKET>.runscope.net" before decoding . S.reverse . S.tail . S.dropWhile (/= '-') . S.reverse $ hostname | otherwise = hostname where p1 "-" = "." p1 other = other p2 "--" = "-" p2 other = other
439
removeRunscope hostname | ".runscope.net" `S.isSuffixOf` hostname = S.concat . Prelude.map (p2 . p1) . S.group -- decode -- drop suffix "-<BUCKET>.runscope.net" before decoding . S.reverse . S.tail . S.dropWhile (/= '-') . S.reverse $ hostname | otherwise = hostname where p1 "-" = "." p1 other = other p2 "--" = "-" p2 other = other
392
false
true
1
15
119
139
71
68
null
null
bergmark/purescript
src/Language/PureScript/Parser/Declarations.hs
mit
parseBooleanLiteral :: P.Parsec String ParseState Value parseBooleanLiteral = BooleanLiteral <$> booleanLiteral
111
parseBooleanLiteral :: P.Parsec String ParseState Value parseBooleanLiteral = BooleanLiteral <$> booleanLiteral
111
parseBooleanLiteral = BooleanLiteral <$> booleanLiteral
55
false
true
0
6
10
24
12
12
null
null
mdsteele/fallback
src/Fallback/Scenario/Feats.hs
gpl-3.0
featDescription Multishot = "Fire arrows at up to three different targets."
75
featDescription Multishot = "Fire arrows at up to three different targets."
75
featDescription Multishot = "Fire arrows at up to three different targets."
75
false
false
0
4
10
10
4
6
null
null
dpieroux/euler
0/0018.hs
mit
euler :: [[Int]] -> [Int] euler = foldl update [] where update :: [Int] -> [Int] -> [Int] update acc row = zipWith (+) row acc''' where acc' = 0:acc acc'' = acc ++ [0] acc''' = zipWith max acc' acc''
240
euler :: [[Int]] -> [Int] euler = foldl update [] where update :: [Int] -> [Int] -> [Int] update acc row = zipWith (+) row acc''' where acc' = 0:acc acc'' = acc ++ [0] acc''' = zipWith max acc' acc''
240
euler = foldl update [] where update :: [Int] -> [Int] -> [Int] update acc row = zipWith (+) row acc''' where acc' = 0:acc acc'' = acc ++ [0] acc''' = zipWith max acc' acc''
214
false
true
0
8
81
121
62
59
null
null
sdiehl/ghc
hadrian/src/Packages.hs
bsd-3-clause
ghcBootTh = lib "ghc-boot-th"
40
ghcBootTh = lib "ghc-boot-th"
40
ghcBootTh = lib "ghc-boot-th"
40
false
false
1
5
14
12
4
8
null
null
felipeZ/Dynamics
src/ConstrainOptimization.hs
bsd-3-clause
updateGeometry :: Molecule -> Hessian -> ExternalGrad -> (Molecule,Position) updateGeometry mol hess gext = (set getCoord newGeom mol,dx) where newGeom = R.computeUnboxedS $ R.zipWith (+) oldgeom dxRepa oldgeom = mol^.getCoord dxRepa = R.fromListUnboxed (extent oldgeom) . NLA.toList $ dx dx = scaleDX $ newtonRaphson grad hess grad = R.toList $ totalGrad mol gext
446
updateGeometry :: Molecule -> Hessian -> ExternalGrad -> (Molecule,Position) updateGeometry mol hess gext = (set getCoord newGeom mol,dx) where newGeom = R.computeUnboxedS $ R.zipWith (+) oldgeom dxRepa oldgeom = mol^.getCoord dxRepa = R.fromListUnboxed (extent oldgeom) . NLA.toList $ dx dx = scaleDX $ newtonRaphson grad hess grad = R.toList $ totalGrad mol gext
401
updateGeometry mol hess gext = (set getCoord newGeom mol,dx) where newGeom = R.computeUnboxedS $ R.zipWith (+) oldgeom dxRepa oldgeom = mol^.getCoord dxRepa = R.fromListUnboxed (extent oldgeom) . NLA.toList $ dx dx = scaleDX $ newtonRaphson grad hess grad = R.toList $ totalGrad mol gext
324
false
true
3
9
134
152
73
79
null
null
NatureShade/SymbolicHaskell
src/Math/Symbolic/Simplify.hs
mit
likeSTerm _ _ = False
21
likeSTerm _ _ = False
21
likeSTerm _ _ = False
21
false
false
1
5
4
12
5
7
null
null
rueshyna/gogol
gogol-admin-directory/gen/Network/Google/Directory/Types/Product.hs
mpl-2.0
-- | Developer options enabled or disabled on device (Read-only) mobDeveloperOptionsStatus :: Lens' MobileDevice (Maybe Bool) mobDeveloperOptionsStatus = lens _mobDeveloperOptionsStatus (\ s a -> s{_mobDeveloperOptionsStatus = a})
238
mobDeveloperOptionsStatus :: Lens' MobileDevice (Maybe Bool) mobDeveloperOptionsStatus = lens _mobDeveloperOptionsStatus (\ s a -> s{_mobDeveloperOptionsStatus = a})
173
mobDeveloperOptionsStatus = lens _mobDeveloperOptionsStatus (\ s a -> s{_mobDeveloperOptionsStatus = a})
112
true
true
0
9
34
48
25
23
null
null
nevrenato/HyLoRes_Source
2.4/src/hylores.hs
gpl-2.0
exit :: Int -> IO a exit = exitWith . ExitFailure
49
exit :: Int -> IO a exit = exitWith . ExitFailure
49
exit = exitWith . ExitFailure
29
false
true
0
7
10
28
12
16
null
null
alphaHeavy/kontiki
src/Network/Kontiki/Types.hs
bsd-3-clause
-- | Calculate the successor of a given `Index'. succIndex :: Index -> Index succIndex (Index i) = Index (succ i)
113
succIndex :: Index -> Index succIndex (Index i) = Index (succ i)
64
succIndex (Index i) = Index (succ i)
36
true
true
0
9
20
39
18
21
null
null
rvion/lamdu
Lamdu/Sugar/PresentationModes.hs
gpl-3.0
addToBody b = return b
22
addToBody b = return b
22
addToBody b = return b
22
false
false
0
5
4
12
5
7
null
null
gleachkr/Carnap
Carnap/src/Carnap/Core/Data/Util.hs
gpl-3.0
withHead f x@(Fx _) = f x
25
withHead f x@(Fx _) = f x
25
withHead f x@(Fx _) = f x
25
false
false
1
7
6
30
11
19
null
null
wavewave/lhc-analysis-collection
heavyhiggs/lheparsertest2.hs
gpl-3.0
matchTest :: LHEventTop -> Maybe [DecayTop (Int,PtlIDInfo)] matchTest ev = let m1 = matchDecayTop patt_t m2 = matchDecayTop patt_tbar m3 = matchDecayTop patt_hh r1 = let r = mapMaybe m1 dtops in if null r then Nothing else Just (head r) r2 = let r = mapMaybe m2 dtops in if null r then Nothing else Just (head r) r3 = let r = mapMaybe m3 dtops in if null r then Nothing else Just (head r) in Tr.sequenceA [r1,r2,r3] where dtops = lhet_dtops ev
494
matchTest :: LHEventTop -> Maybe [DecayTop (Int,PtlIDInfo)] matchTest ev = let m1 = matchDecayTop patt_t m2 = matchDecayTop patt_tbar m3 = matchDecayTop patt_hh r1 = let r = mapMaybe m1 dtops in if null r then Nothing else Just (head r) r2 = let r = mapMaybe m2 dtops in if null r then Nothing else Just (head r) r3 = let r = mapMaybe m3 dtops in if null r then Nothing else Just (head r) in Tr.sequenceA [r1,r2,r3] where dtops = lhet_dtops ev
494
matchTest ev = let m1 = matchDecayTop patt_t m2 = matchDecayTop patt_tbar m3 = matchDecayTop patt_hh r1 = let r = mapMaybe m1 dtops in if null r then Nothing else Just (head r) r2 = let r = mapMaybe m2 dtops in if null r then Nothing else Just (head r) r3 = let r = mapMaybe m3 dtops in if null r then Nothing else Just (head r) in Tr.sequenceA [r1,r2,r3] where dtops = lhet_dtops ev
434
false
true
0
14
135
211
104
107
null
null
bgold-cosmos/Tidal
src/Sound/Tidal/Core.hs
gpl-3.0
in112 :: Pattern Double in112 = cF 0 "112"
42
in112 :: Pattern Double in112 = cF 0 "112"
42
in112 = cF 0 "112"
18
false
true
0
6
8
26
10
16
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 2641171 = 4725
34
getValueFromProduct 2641171 = 4725
34
getValueFromProduct 2641171 = 4725
34
false
false
0
5
3
9
4
5
null
null
qpliu/esolang
roag/hs/roag.hs
gpl-3.0
transform (Up,True) Rotate = (Rt,True)
39
transform (Up,True) Rotate = (Rt,True)
39
transform (Up,True) Rotate = (Rt,True)
39
false
false
1
6
5
25
13
12
null
null
Gabriel439/Haskell-Dhall-Library
dhall-lsp-server/src/Dhall/LSP/Backend/Dhall.hs
bsd-3-clause
-- | Construct a FileIdentifier from a local file path. fileIdentifierFromFilePath :: FilePath -> FileIdentifier fileIdentifierFromFilePath path = let filename = Text.pack $ takeFileName path directory = takeDirectory path components = map Text.pack . reverse . splitDirectories $ directory file = Dhall.File (Dhall.Directory components) filename in FileIdentifier $ Dhall.chainedFromLocalHere Dhall.Absolute file Dhall.Code
446
fileIdentifierFromFilePath :: FilePath -> FileIdentifier fileIdentifierFromFilePath path = let filename = Text.pack $ takeFileName path directory = takeDirectory path components = map Text.pack . reverse . splitDirectories $ directory file = Dhall.File (Dhall.Directory components) filename in FileIdentifier $ Dhall.chainedFromLocalHere Dhall.Absolute file Dhall.Code
390
fileIdentifierFromFilePath path = let filename = Text.pack $ takeFileName path directory = takeDirectory path components = map Text.pack . reverse . splitDirectories $ directory file = Dhall.File (Dhall.Directory components) filename in FileIdentifier $ Dhall.chainedFromLocalHere Dhall.Absolute file Dhall.Code
333
true
true
0
13
73
106
52
54
null
null
tonyday567/chart-svg
src/Data/Colour.hs
bsd-3-clause
-- | Select a Colour from the palette with a specified opacity -- -- >>> palette1a 0 0.5 -- Colour 0.02 0.73 0.80 0.50 palette1a :: Int -> Double -> Colour palette1a x a = set opac' a $ cycle palette1_ List.!! x
211
palette1a :: Int -> Double -> Colour palette1a x a = set opac' a $ cycle palette1_ List.!! x
92
palette1a x a = set opac' a $ cycle palette1_ List.!! x
55
true
true
0
7
42
46
24
22
null
null
feuerbach/music
DSL.hs
mit
melodyDuration :: Melody -> Duration melodyDuration = \case Par m1 m2 -> max (melodyDuration m1) (melodyDuration m2) Then m1 m2 -> melodyDuration m1 + melodyDuration m2 Mono _ d -> d Empty -> 0 Apply _ m -> melodyDuration m Mult _ m -> melodyDuration m Silence d -> d ---------------------------------------------------------------------- -- Monadic DSL ----------------------------------------------------------------------
465
melodyDuration :: Melody -> Duration melodyDuration = \case Par m1 m2 -> max (melodyDuration m1) (melodyDuration m2) Then m1 m2 -> melodyDuration m1 + melodyDuration m2 Mono _ d -> d Empty -> 0 Apply _ m -> melodyDuration m Mult _ m -> melodyDuration m Silence d -> d ---------------------------------------------------------------------- -- Monadic DSL ----------------------------------------------------------------------
465
melodyDuration = \case Par m1 m2 -> max (melodyDuration m1) (melodyDuration m2) Then m1 m2 -> melodyDuration m1 + melodyDuration m2 Mono _ d -> d Empty -> 0 Apply _ m -> melodyDuration m Mult _ m -> melodyDuration m Silence d -> d ---------------------------------------------------------------------- -- Monadic DSL ----------------------------------------------------------------------
428
false
true
0
10
95
123
58
65
null
null
freevoid/rwh-exercises
ch04/ch04.hs
mit
-- ex. 3 -- see firstwords.hs -- ex. 4 -- see asciitranspose.hs -- How to think about loops -- ex. 1 asInt_fold :: String -> Int asInt_fold ('-':cs) | null cs = error "Only minus sign provided" | otherwise = negate (asInt_fold cs)
242
asInt_fold :: String -> Int asInt_fold ('-':cs) | null cs = error "Only minus sign provided" | otherwise = negate (asInt_fold cs)
137
asInt_fold ('-':cs) | null cs = error "Only minus sign provided" | otherwise = negate (asInt_fold cs)
109
true
true
0
9
54
68
33
35
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/enumFromThenTo_5.hs
mit
numericEnumFromThen n m = iterate (psMyInt (msMyInt m n)) n
59
numericEnumFromThen n m = iterate (psMyInt (msMyInt m n)) n
59
numericEnumFromThen n m = iterate (psMyInt (msMyInt m n)) n
59
false
false
0
9
9
30
14
16
null
null
k0001/gtk2hs
tools/c2hs/base/state/StateTrans.hs
gpl-3.0
assignMV :: MVar a -> a -> STB bs gs () assignMV mv x = liftIO (writeIORef mv x)
86
assignMV :: MVar a -> a -> STB bs gs () assignMV mv x = liftIO (writeIORef mv x)
86
assignMV mv x = liftIO (writeIORef mv x)
41
false
true
0
8
24
47
22
25
null
null
juodaspaulius/clafer
src/Language/Clafer/Generator/Graph.hs
mit
htmlChars ('-':'>':'>':xs) = "-&gt;&gt;" ++ htmlChars xs
56
htmlChars ('-':'>':'>':xs) = "-&gt;&gt;" ++ htmlChars xs
56
htmlChars ('-':'>':'>':xs) = "-&gt;&gt;" ++ htmlChars xs
56
false
false
0
9
6
31
15
16
null
null
brendanhay/gogol
gogol-logging/gen/Network/Google/Resource/Logging/Organizations/UpdateCmekSettings.hs
mpl-2.0
-- | JSONP oucsCallback :: Lens' OrganizationsUpdateCmekSettings (Maybe Text) oucsCallback = lens _oucsCallback (\ s a -> s{_oucsCallback = a})
145
oucsCallback :: Lens' OrganizationsUpdateCmekSettings (Maybe Text) oucsCallback = lens _oucsCallback (\ s a -> s{_oucsCallback = a})
134
oucsCallback = lens _oucsCallback (\ s a -> s{_oucsCallback = a})
67
true
true
0
9
21
48
25
23
null
null
Codas/yesod-form-materialize
Yesod/Form/Materialize/Fields.hs
mit
-- | Creates a input with @type="text"@. matTextField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Markup -> ColSize -> Field m Text matTextField l col = textField { fieldView = view } where view theId name attrs val isReq = toWidget [hamlet| $newline never <div class="input-field #{colClass col}"> <input id="#{theId}" name="#{name}" *{attrs} type="text" :isReq:required value="#{either id id val}"> <label for="#{theId}">#{l} |] -- | Creates an input with @type="password"@.
506
matTextField :: Monad m => RenderMessage (HandlerSite m) FormMessage => Markup -> ColSize -> Field m Text matTextField l col = textField { fieldView = view } where view theId name attrs val isReq = toWidget [hamlet| $newline never <div class="input-field #{colClass col}"> <input id="#{theId}" name="#{name}" *{attrs} type="text" :isReq:required value="#{either id id val}"> <label for="#{theId}">#{l} |] -- | Creates an input with @type="password"@.
465
matTextField l col = textField { fieldView = view } where view theId name attrs val isReq = toWidget [hamlet| $newline never <div class="input-field #{colClass col}"> <input id="#{theId}" name="#{name}" *{attrs} type="text" :isReq:required value="#{either id id val}"> <label for="#{theId}">#{l} |] -- | Creates an input with @type="password"@.
359
true
true
0
9
84
86
45
41
null
null
creswick/minServant
src/Db.hs
bsd-3-clause
loadNotes :: IO [Note] loadNotes = do res <- X.bracket (PG.connect connInfo) PG.close $ \conn -> do query conn [sqlStmt| SELECT note_id, title, content, note_date FROM notes; |] case res of Left err -> do putStrLn ("Error loading notes: "++show err) return [] Right notes -> return notes
406
loadNotes :: IO [Note] loadNotes = do res <- X.bracket (PG.connect connInfo) PG.close $ \conn -> do query conn [sqlStmt| SELECT note_id, title, content, note_date FROM notes; |] case res of Left err -> do putStrLn ("Error loading notes: "++show err) return [] Right notes -> return notes
406
loadNotes = do res <- X.bracket (PG.connect connInfo) PG.close $ \conn -> do query conn [sqlStmt| SELECT note_id, title, content, note_date FROM notes; |] case res of Left err -> do putStrLn ("Error loading notes: "++show err) return [] Right notes -> return notes
383
false
true
0
15
166
114
54
60
null
null
prl-tokyo/bigul-configuration-adaptation
Transformations/src/BiFlux/XPath/HXT/XPathParser.hs
mit
-- [20] FilterExpr filterExpr :: XPathParser Expr filterExpr = do prim <- primaryExpr predicates <- many predicate if length predicates > 0 then return (FilterExpr (prim : predicates)) else return prim <?> "filterExpr"
262
filterExpr :: XPathParser Expr filterExpr = do prim <- primaryExpr predicates <- many predicate if length predicates > 0 then return (FilterExpr (prim : predicates)) else return prim <?> "filterExpr"
243
filterExpr = do prim <- primaryExpr predicates <- many predicate if length predicates > 0 then return (FilterExpr (prim : predicates)) else return prim <?> "filterExpr"
212
true
true
2
12
76
80
36
44
null
null
alphalambda/codeworld
codeworld-base/src/Internal/Picture.hs
apache-2.0
reflectedPoint :: (Point, Number) -> Point reflectedPoint (p, a) = fromCWPoint (CW.reflectedPoint (toDouble (pi * a / 180)) (toCWPoint p))
142
reflectedPoint :: (Point, Number) -> Point reflectedPoint (p, a) = fromCWPoint (CW.reflectedPoint (toDouble (pi * a / 180)) (toCWPoint p))
142
reflectedPoint (p, a) = fromCWPoint (CW.reflectedPoint (toDouble (pi * a / 180)) (toCWPoint p))
99
false
true
0
12
23
71
36
35
null
null
arnizamani/SeqSolver
Amath/Expr/AbsExp.hs
gpl-2.0
showExp (ERec i e) = "Rec:(" ++ show i ++ "," ++ showExp e ++ ")"
65
showExp (ERec i e) = "Rec:(" ++ show i ++ "," ++ showExp e ++ ")"
65
showExp (ERec i e) = "Rec:(" ++ show i ++ "," ++ showExp e ++ ")"
65
false
false
0
9
15
39
18
21
null
null
ryantm/ghc
compiler/main/DriverPhases.hs
bsd-3-clause
eqPhase Cc Cc = True
37
eqPhase Cc Cc = True
37
eqPhase Cc Cc = True
37
false
false
0
5
21
13
5
8
null
null
plow-technologies/shakespeare-dynamic
ghcjs-shakespeare-dynamic/src/Shakespeare/Ophelia/Parser/VDOM/Types.hs
mit
-- DOM that can change addEvents ev (LiveChildren evs vchs) = LiveChildren (evs ++ ev) vchs
91
addEvents ev (LiveChildren evs vchs) = LiveChildren (evs ++ ev) vchs
68
addEvents ev (LiveChildren evs vchs) = LiveChildren (evs ++ ev) vchs
68
true
false
0
7
15
32
16
16
null
null
ThatSnail/hs-softbody
Vector.hs
mit
pr2 :: Vector2DP -> Vector2D pr2 v@(Vector2DP vr va) = Vector2D vx vy where vx = vr * (cos va) vy = vr * (sin va)
133
pr2 :: Vector2DP -> Vector2D pr2 v@(Vector2DP vr va) = Vector2D vx vy where vx = vr * (cos va) vy = vr * (sin va)
133
pr2 v@(Vector2DP vr va) = Vector2D vx vy where vx = vr * (cos va) vy = vr * (sin va)
104
false
true
5
7
45
72
35
37
null
null
christiaanb/Idris-dev
src/Idris/DSL.hs
bsd-3-clause
expandDo dsl (PLam n ty tm) = PLam n (expandDo dsl ty) (expandDo dsl tm)
72
expandDo dsl (PLam n ty tm) = PLam n (expandDo dsl ty) (expandDo dsl tm)
72
expandDo dsl (PLam n ty tm) = PLam n (expandDo dsl ty) (expandDo dsl tm)
72
false
false
0
7
14
46
21
25
null
null
cschneid/wc-conduits
src/ConduitWordCount.hs
bsd-3-clause
countLinesC :: Conduit ByteString (ResourceT IO) Counts countLinesC = awaitForever (yield . makeNewCount) where makeNewCount bs = Counts mempty mempty (count bs) count = Sum . length . BW.filter isNewline isNewline = (== '\n')
245
countLinesC :: Conduit ByteString (ResourceT IO) Counts countLinesC = awaitForever (yield . makeNewCount) where makeNewCount bs = Counts mempty mempty (count bs) count = Sum . length . BW.filter isNewline isNewline = (== '\n')
245
countLinesC = awaitForever (yield . makeNewCount) where makeNewCount bs = Counts mempty mempty (count bs) count = Sum . length . BW.filter isNewline isNewline = (== '\n')
189
false
true
2
7
52
92
43
49
null
null
orchid-hybrid/bee
Bee/X86.hs
gpl-3.0
s' (Jne l) = " jne " ++ l
29
s' (Jne l) = " jne " ++ l
29
s' (Jne l) = " jne " ++ l
29
false
false
0
6
12
20
9
11
null
null
roman-smrz/rawe
src/FRP/Rawe/Prelude.hs
bsd-3-clause
-- takeWhile, applied to a predicate p and a list xs, returns the longest -- prefix (possibly empty) of xs of elements that satisfy p. dropWhile p xs -- returns the remaining suffix. span p xs is equivalent to -- (takeWhile p xs, dropWhile p xs), while break p uses the negation of p. takeWhile :: (Bhv a -> Bhv Bool) -> Bhv [a] -> Bhv [a] takeWhile p = bfix (\t -> list nil (\x xs -> ite (p x) (x ~: t xs) nil))
430
takeWhile :: (Bhv a -> Bhv Bool) -> Bhv [a] -> Bhv [a] takeWhile p = bfix (\t -> list nil (\x xs -> ite (p x) (x ~: t xs) nil))
141
takeWhile p = bfix (\t -> list nil (\x xs -> ite (p x) (x ~: t xs) nil))
72
true
true
0
14
103
105
53
52
null
null
open-etcs/openetcs-dmi
src/ETCS/DMI/Widgets/SpeedDial.hs
bsd-3-clause
csgColorMapping TSM WaS = (Yellow, Just Orange)
48
csgColorMapping TSM WaS = (Yellow, Just Orange)
48
csgColorMapping TSM WaS = (Yellow, Just Orange)
48
false
false
0
6
7
22
10
12
null
null
AngelitoJ/HsParser
src/MolcasParser.hs
gpl-3.0
moduleStart :: MyParser MolState (String,String) moduleStart = do optional ( try (string "*** " >> newline)) -- Depends upon weather on Sweden, the module and the daily fellow string "--- Start Module:" -- Here we go, fasten your seat belts skipMany space moduleName <- many1 alphaNum skipMany space string "at" content <- anyLine return $ (moduleName, content ) -- "--- Stop Module: gateway at Sun Dec 2 22:41:43 2012 /rc=0 ---"
527
moduleStart :: MyParser MolState (String,String) moduleStart = do optional ( try (string "*** " >> newline)) -- Depends upon weather on Sweden, the module and the daily fellow string "--- Start Module:" -- Here we go, fasten your seat belts skipMany space moduleName <- many1 alphaNum skipMany space string "at" content <- anyLine return $ (moduleName, content ) -- "--- Stop Module: gateway at Sun Dec 2 22:41:43 2012 /rc=0 ---"
527
moduleStart = do optional ( try (string "*** " >> newline)) -- Depends upon weather on Sweden, the module and the daily fellow string "--- Start Module:" -- Here we go, fasten your seat belts skipMany space moduleName <- many1 alphaNum skipMany space string "at" content <- anyLine return $ (moduleName, content ) -- "--- Stop Module: gateway at Sun Dec 2 22:41:43 2012 /rc=0 ---"
478
false
true
0
12
168
101
47
54
null
null
lpalma/hamerkop
test/Helper.hs
bsd-3-clause
createPost :: (String, String, UTCTime) -> Post createPost (u, m, d) = Post { user = u , msg = m , date = d }
178
createPost :: (String, String, UTCTime) -> Post createPost (u, m, d) = Post { user = u , msg = m , date = d }
178
createPost (u, m, d) = Post { user = u , msg = m , date = d }
130
false
true
0
6
94
60
35
25
null
null
shlevy/ghc
compiler/utils/Outputable.hs
bsd-3-clause
qualModule :: PprStyle -> QueryQualifyModule qualModule (PprUser q _ _) m = queryQualifyModule q m
99
qualModule :: PprStyle -> QueryQualifyModule qualModule (PprUser q _ _) m = queryQualifyModule q m
99
qualModule (PprUser q _ _) m = queryQualifyModule q m
54
false
true
0
9
15
40
18
22
null
null
DanielWaterworth/Idris-dev
src/Idris/Core/Elaborate.hs
bsd-3-clause
complete_fill :: Elab' aux () complete_fill = processTactic' CompleteFill
73
complete_fill :: Elab' aux () complete_fill = processTactic' CompleteFill
73
complete_fill = processTactic' CompleteFill
43
false
true
1
6
8
24
10
14
null
null
tibbe/ghc
compiler/main/HscMain.hs
bsd-3-clause
hscCompileCoreExpr :: HscEnv -> SrcSpan -> CoreExpr -> IO HValue hscCompileCoreExpr hsc_env = lookupHook hscCompileCoreExprHook hscCompileCoreExpr' (hsc_dflags hsc_env) hsc_env
178
hscCompileCoreExpr :: HscEnv -> SrcSpan -> CoreExpr -> IO HValue hscCompileCoreExpr hsc_env = lookupHook hscCompileCoreExprHook hscCompileCoreExpr' (hsc_dflags hsc_env) hsc_env
178
hscCompileCoreExpr hsc_env = lookupHook hscCompileCoreExprHook hscCompileCoreExpr' (hsc_dflags hsc_env) hsc_env
113
false
true
0
8
20
44
21
23
null
null
Shou/Tombot
Tombot/Discourse.hs
gpl-2.0
posts :: (Integral int, Show int, IsString string, Monoid string) => int -> string posts n = "/posts/" <> (fromString $ show n) <> ".json"
144
posts :: (Integral int, Show int, IsString string, Monoid string) => int -> string posts n = "/posts/" <> (fromString $ show n) <> ".json"
144
posts n = "/posts/" <> (fromString $ show n) <> ".json"
55
false
true
2
8
30
70
33
37
null
null
brendanhay/gogol
gogol-healthcare/gen/Network/Google/Healthcare/Types/Product.hs
mpl-2.0
-- | Optional. Specific Consents to evaluate the access request against. -- These Consents must have the same \`user_id\` as the User data mappings -- being evalauted, must exist in the current \`consent_store\`, and must -- have a \`state\` of either \`ACTIVE\` or \`DRAFT\`. A maximum of 100 -- Consents can be provided here. If unspecified, all \`ACTIVE\` unexpired -- Consents in the current \`consent_store\` will be evaluated. eucrConsentList :: Lens' EvaluateUserConsentsRequest (Maybe ConsentList) eucrConsentList = lens _eucrConsentList (\ s a -> s{_eucrConsentList = a})
588
eucrConsentList :: Lens' EvaluateUserConsentsRequest (Maybe ConsentList) eucrConsentList = lens _eucrConsentList (\ s a -> s{_eucrConsentList = a})
155
eucrConsentList = lens _eucrConsentList (\ s a -> s{_eucrConsentList = a})
82
true
true
1
9
92
57
30
27
null
null
jacekszymanski/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_CMD_WORDRIGHT :: Int wxSTC_CMD_WORDRIGHT = 2310
53
wxSTC_CMD_WORDRIGHT :: Int wxSTC_CMD_WORDRIGHT = 2310
53
wxSTC_CMD_WORDRIGHT = 2310
26
false
true
0
4
5
11
6
5
null
null
ModernSteward/blog
Handler/AdminUsers.hs
bsd-2-clause
getAdminListUsersR :: Handler RepHtml getAdminListUsersR = do users <- runDB listUsers defaultLayout $ do setTitle "Users page" $(widgetFile "admin/users")
179
getAdminListUsersR :: Handler RepHtml getAdminListUsersR = do users <- runDB listUsers defaultLayout $ do setTitle "Users page" $(widgetFile "admin/users")
179
getAdminListUsersR = do users <- runDB listUsers defaultLayout $ do setTitle "Users page" $(widgetFile "admin/users")
141
false
true
0
12
42
47
20
27
null
null
geophf/1HaskellADay
exercises/HAD/Y2021/M02/D02/Exercise.hs
mit
fetchTwitterz :: FilePath -> IO [Taster] fetchTwitterz = undefined
66
fetchTwitterz :: FilePath -> IO [Taster] fetchTwitterz = undefined
66
fetchTwitterz = undefined
25
false
true
0
8
8
27
12
15
null
null
chpatrick/clang-lens
src/Language/C/Clang/Internal/Refs.hs
apache-2.0
newNode :: Parent p => p -> (Ptr (RefOf p) -> IO ( Ptr a, Finalizer )) -> IO (Node p a) newNode prn f = deref prn $ \pptr -> do ( cptr, cfin ) <- f pptr incCount prn rt <- newRoot cptr (cfin >> decCount prn) return $ Node prn rt
236
newNode :: Parent p => p -> (Ptr (RefOf p) -> IO ( Ptr a, Finalizer )) -> IO (Node p a) newNode prn f = deref prn $ \pptr -> do ( cptr, cfin ) <- f pptr incCount prn rt <- newRoot cptr (cfin >> decCount prn) return $ Node prn rt
236
newNode prn f = deref prn $ \pptr -> do ( cptr, cfin ) <- f pptr incCount prn rt <- newRoot cptr (cfin >> decCount prn) return $ Node prn rt
148
false
true
0
13
61
138
65
73
null
null
whittle/crunchbase
Data/API/CrunchBase/Response.hs
mit
mkDate :: Object -> T.Text -- ^year key -> T.Text -- ^month key -> T.Text -- ^day key -> Parser (Maybe FuzzyDate) mkDate o year month day = fuzzyDateValid <$> o .:? year <*> o .:? month <*> o .:? day
305
mkDate :: Object -> T.Text -- ^year key -> T.Text -- ^month key -> T.Text -- ^day key -> Parser (Maybe FuzzyDate) mkDate o year month day = fuzzyDateValid <$> o .:? year <*> o .:? month <*> o .:? day
305
mkDate o year month day = fuzzyDateValid <$> o .:? year <*> o .:? month <*> o .:? day
163
false
true
0
11
146
78
40
38
null
null
dan-t/dcpu16
BinaryCode.hs
bsd-3-clause
(.<<.) = shiftL
15
(.<<.) = shiftL
15
(.<<.) = shiftL
15
false
false
1
5
2
12
5
7
null
null
Saevon/Recipes
haskell/learn1.hs
mit
squareEven :: Integral a => [a] -> a squareEven = sumEven . map (^2)
68
squareEven :: Integral a => [a] -> a squareEven = sumEven . map (^2)
68
squareEven = sumEven . map (^2)
31
false
true
0
7
13
36
19
17
null
null
urbanslug/cs194
Src/Week7/HW07.hs
gpl-3.0
-- getStdRanddom :: (StdGen -> (a, StdGen)) -> IO a -- getStdRanddom :: IO (a, StdGen) -- getStdRanddom = getStdGen >>= return . random f :: (Random a) => StdGen -> (a, StdGen) f = random
188
f :: (Random a) => StdGen -> (a, StdGen) f = random
51
f = random
10
true
true
0
9
36
40
21
19
null
null
agentm/project-m36
test/TutorialD/Interpreter/Import/ImportTest.hs
unlicense
testTutdFileImport :: Test testTutdFileImport = TestCase $ withSystemTempFile "m.tutd" $ \tempPath handle -> do BS.hPut handle (TE.encodeUtf8 "x:=relation{tuple{a 5,b \"spam\"}}; y:=relation{tuple{b \"漢字\"}}") hClose handle let expectedExpr = MultipleExpr [ Assign "x" (MakeRelationFromExprs Nothing $ TupleExprs () [TupleExpr (M.fromList [("a", NakedAtomExpr $ IntegerAtom 5), ("b", NakedAtomExpr $ TextAtom "spam")])]), Assign "y" (MakeRelationFromExprs Nothing $ TupleExprs () [TupleExpr (M.fromList [("b", NakedAtomExpr (TextAtom "漢字"))])])] --on Windows, the file URI should not include the drive letter "/c/Users..." -> "/Users" let uri = "file://" <> map (\c -> if c == '\\' then '/' else c) ( joinDrive "/" (dropDrive tempPath)) fileURI <- mkURI (T.pack uri) imported <- importTutorialDFromFile fileURI Nothing assertEqual "import tutd" (Right expectedExpr) imported
1,020
testTutdFileImport :: Test testTutdFileImport = TestCase $ withSystemTempFile "m.tutd" $ \tempPath handle -> do BS.hPut handle (TE.encodeUtf8 "x:=relation{tuple{a 5,b \"spam\"}}; y:=relation{tuple{b \"漢字\"}}") hClose handle let expectedExpr = MultipleExpr [ Assign "x" (MakeRelationFromExprs Nothing $ TupleExprs () [TupleExpr (M.fromList [("a", NakedAtomExpr $ IntegerAtom 5), ("b", NakedAtomExpr $ TextAtom "spam")])]), Assign "y" (MakeRelationFromExprs Nothing $ TupleExprs () [TupleExpr (M.fromList [("b", NakedAtomExpr (TextAtom "漢字"))])])] --on Windows, the file URI should not include the drive letter "/c/Users..." -> "/Users" let uri = "file://" <> map (\c -> if c == '\\' then '/' else c) ( joinDrive "/" (dropDrive tempPath)) fileURI <- mkURI (T.pack uri) imported <- importTutorialDFromFile fileURI Nothing assertEqual "import tutd" (Right expectedExpr) imported
1,020
testTutdFileImport = TestCase $ withSystemTempFile "m.tutd" $ \tempPath handle -> do BS.hPut handle (TE.encodeUtf8 "x:=relation{tuple{a 5,b \"spam\"}}; y:=relation{tuple{b \"漢字\"}}") hClose handle let expectedExpr = MultipleExpr [ Assign "x" (MakeRelationFromExprs Nothing $ TupleExprs () [TupleExpr (M.fromList [("a", NakedAtomExpr $ IntegerAtom 5), ("b", NakedAtomExpr $ TextAtom "spam")])]), Assign "y" (MakeRelationFromExprs Nothing $ TupleExprs () [TupleExpr (M.fromList [("b", NakedAtomExpr (TextAtom "漢字"))])])] --on Windows, the file URI should not include the drive letter "/c/Users..." -> "/Users" let uri = "file://" <> map (\c -> if c == '\\' then '/' else c) ( joinDrive "/" (dropDrive tempPath)) fileURI <- mkURI (T.pack uri) imported <- importTutorialDFromFile fileURI Nothing assertEqual "import tutd" (Right expectedExpr) imported
993
false
true
0
27
257
299
145
154
null
null
basvandijk/repr
Prelude/Repr.hs
bsd-3-clause
-- | Lifts @Prelude.'Prelude.gcd'@ into @'Repr's@ gcd ∷ Integral α ⇒ Repr α → Repr α → Repr α gcd = app2 Prelude.gcd "gcd"
122
gcd ∷ Integral α ⇒ Repr α → Repr α → Repr α gcd = app2 Prelude.gcd "gcd"
72
gcd = app2 Prelude.gcd "gcd"
28
true
true
0
9
23
49
21
28
null
null
qnikst/distributed-process
benchmarks/Latency.hs
bsd-3-clause
initialProcess :: String -> Process () initialProcess "SERVER" = do us <- getSelfPid liftIO $ BSL.writeFile "pingServer.pid" (encode us) pingServer
153
initialProcess :: String -> Process () initialProcess "SERVER" = do us <- getSelfPid liftIO $ BSL.writeFile "pingServer.pid" (encode us) pingServer
153
initialProcess "SERVER" = do us <- getSelfPid liftIO $ BSL.writeFile "pingServer.pid" (encode us) pingServer
114
false
true
0
10
25
53
24
29
null
null
fmapfmapfmap/amazonka
amazonka-opsworks/gen/Network/AWS/OpsWorks/DescribeInstances.hs
mpl-2.0
-- | A stack ID. If you use this parameter, 'DescribeInstances' returns -- descriptions of the instances associated with the specified stack. diStackId :: Lens' DescribeInstances (Maybe Text) diStackId = lens _diStackId (\ s a -> s{_diStackId = a})
248
diStackId :: Lens' DescribeInstances (Maybe Text) diStackId = lens _diStackId (\ s a -> s{_diStackId = a})
106
diStackId = lens _diStackId (\ s a -> s{_diStackId = a})
56
true
true
0
9
38
47
26
21
null
null
sdiehl/ghc
testsuite/tests/hiefile/should_compile/CPP.hs
bsd-3-clause
foo :: String foo = {- " single quotes are fine in block comments {- nested block comments are fine -} -} "foo"
129
foo :: String foo = {- " single quotes are fine in block comments {- nested block comments are fine -} -} "foo"
129
foo = {- " single quotes are fine in block comments {- nested block comments are fine -} -} "foo"
115
false
true
0
6
40
19
8
11
null
null
leksah/yi
src/library/Yi/Buffer/Misc.hs
gpl-2.0
------------------------------------------------------------------------ -- | @deleteNAt n p@ deletes @n@ characters forwards from position @p@ deleteNAt :: Direction -> Int -> Point -> BufferM () deleteNAt _ 0 _ = return ()
225
deleteNAt :: Direction -> Int -> Point -> BufferM () deleteNAt _ 0 _ = return ()
80
deleteNAt _ 0 _ = return ()
27
true
true
0
9
30
42
21
21
null
null
penteract/HigherOrderHornRefinement
HOCHC/Reduce/HRSParser.hs
bsd-3-clause
printa :: HOMCP -> String printa ((ts,nts,rs),d,qs) =unlines [ "terminals {", ts >>= (\(c,s) -> c++":"++prnS s++";\n"), "}","nonterminals {", nts >>= (\(c,s) -> c++":"++prnS s++";\n"), "}","rules {", rs >>= (\(v,args,t) -> intercalate " " (v:args)++"=" ++prnt t ++";\n"), "}", unlines [q++","++t++"->"++show (d q t) | q <- qs , (t,_) <- ts] ]
378
printa :: HOMCP -> String printa ((ts,nts,rs),d,qs) =unlines [ "terminals {", ts >>= (\(c,s) -> c++":"++prnS s++";\n"), "}","nonterminals {", nts >>= (\(c,s) -> c++":"++prnS s++";\n"), "}","rules {", rs >>= (\(v,args,t) -> intercalate " " (v:args)++"=" ++prnt t ++";\n"), "}", unlines [q++","++t++"->"++show (d q t) | q <- qs , (t,_) <- ts] ]
378
printa ((ts,nts,rs),d,qs) =unlines [ "terminals {", ts >>= (\(c,s) -> c++":"++prnS s++";\n"), "}","nonterminals {", nts >>= (\(c,s) -> c++":"++prnS s++";\n"), "}","rules {", rs >>= (\(v,args,t) -> intercalate " " (v:args)++"=" ++prnt t ++";\n"), "}", unlines [q++","++t++"->"++show (d q t) | q <- qs , (t,_) <- ts] ]
352
false
true
0
15
88
238
132
106
null
null
yiannist/ganeti
src/Ganeti/Types.hs
bsd-2-clause
-- | Smart constructor for 'Positive'. mkPositive :: (Monad m, Num a, Ord a, Show a) => a -> m (Positive a) mkPositive i | i > 0 = return (Positive i) | otherwise = fail $ "Invalid value for positive type '" ++ show i ++ "'"
264
mkPositive :: (Monad m, Num a, Ord a, Show a) => a -> m (Positive a) mkPositive i | i > 0 = return (Positive i) | otherwise = fail $ "Invalid value for positive type '" ++ show i ++ "'"
225
mkPositive i | i > 0 = return (Positive i) | otherwise = fail $ "Invalid value for positive type '" ++ show i ++ "'"
156
true
true
0
9
87
98
47
51
null
null
Javran/h2048
src/Game/H2048/Core.hs
mit
{-| Merge two cells with a reward as specified by 'GameRule'. -} mergeWithScore :: GameRule -> Cell -> Cell -> Maybe (Cell, Int) mergeWithScore gr a b = do let Cell ctPrev = a c <- merge a b pure (c, _grMergeAward gr ctPrev) {-| Merge a single line of cells, return the resulting line and scores awarded according to the 'GameRule'. -} {- Notice that input and output are both lists: * Moving on one direction squeezes out those empty cells, therefore it is not necessary to consider empty cells at all. * Similar rationale for output type - the result is always a line of cells free of empty ones in between any of those. -}
656
mergeWithScore :: GameRule -> Cell -> Cell -> Maybe (Cell, Int) mergeWithScore gr a b = do let Cell ctPrev = a c <- merge a b pure (c, _grMergeAward gr ctPrev) {-| Merge a single line of cells, return the resulting line and scores awarded according to the 'GameRule'. -} {- Notice that input and output are both lists: * Moving on one direction squeezes out those empty cells, therefore it is not necessary to consider empty cells at all. * Similar rationale for output type - the result is always a line of cells free of empty ones in between any of those. -}
588
mergeWithScore gr a b = do let Cell ctPrev = a c <- merge a b pure (c, _grMergeAward gr ctPrev) {-| Merge a single line of cells, return the resulting line and scores awarded according to the 'GameRule'. -} {- Notice that input and output are both lists: * Moving on one direction squeezes out those empty cells, therefore it is not necessary to consider empty cells at all. * Similar rationale for output type - the result is always a line of cells free of empty ones in between any of those. -}
524
true
true
0
10
148
84
41
43
null
null
ehird/mchost
MC/Protocol/Fields.hs
bsd-3-clause
heldItem :: String -> FieldInfo heldItem = simpleField [t| HeldItem |]
70
heldItem :: String -> FieldInfo heldItem = simpleField [t| HeldItem |]
70
heldItem = simpleField [t| HeldItem |]
38
false
true
0
5
10
22
13
9
null
null
kolmodin/cabal
cabal-install/Distribution/Client/FileMonitor.hs
bsd-3-clause
buildMonitorStateFile :: Maybe MonitorTimestamp -- ^ start time of update -> FileHashCache -- ^ existing file hashes -> MonitorKindFile -> MonitorKindDir -> FilePath -- ^ the root directory -> FilePath -> IO MonitorStateFileStatus buildMonitorStateFile mstartTime hashcache kindfile kinddir root path = do let abspath = root </> path isFile <- doesFileExist abspath isDir <- doesDirectoryExist abspath case (isFile, kindfile, isDir, kinddir) of (_, FileNotExists, _, DirNotExists) -> -- we don't need to care if it exists now, since we check at probe time return MonitorStateNonExistent (False, _, False, _) -> return MonitorStateAlreadyChanged (True, FileExists, _, _) -> return MonitorStateFileExists (True, FileModTime, _, _) -> handleIOException MonitorStateAlreadyChanged $ do mtime <- getModTime abspath if changedDuringUpdate mstartTime mtime then return MonitorStateAlreadyChanged else return (MonitorStateFileModTime mtime) (True, FileHashed, _, _) -> handleIOException MonitorStateAlreadyChanged $ do mtime <- getModTime abspath if changedDuringUpdate mstartTime mtime then return MonitorStateAlreadyChanged else do hash <- getFileHash hashcache abspath abspath mtime return (MonitorStateFileHashed mtime hash) (_, _, True, DirExists) -> return MonitorStateDirExists (_, _, True, DirModTime) -> handleIOException MonitorStateAlreadyChanged $ do mtime <- getModTime abspath if changedDuringUpdate mstartTime mtime then return MonitorStateAlreadyChanged else return (MonitorStateDirModTime mtime) (False, _, True, DirNotExists) -> return MonitorStateAlreadyChanged (True, FileNotExists, False, _) -> return MonitorStateAlreadyChanged -- | If we have a timestamp for the beginning of the update, then any file -- mtime later than this means that it changed during the update and we ought -- to consider the file as already changed. --
2,271
buildMonitorStateFile :: Maybe MonitorTimestamp -- ^ start time of update -> FileHashCache -- ^ existing file hashes -> MonitorKindFile -> MonitorKindDir -> FilePath -- ^ the root directory -> FilePath -> IO MonitorStateFileStatus buildMonitorStateFile mstartTime hashcache kindfile kinddir root path = do let abspath = root </> path isFile <- doesFileExist abspath isDir <- doesDirectoryExist abspath case (isFile, kindfile, isDir, kinddir) of (_, FileNotExists, _, DirNotExists) -> -- we don't need to care if it exists now, since we check at probe time return MonitorStateNonExistent (False, _, False, _) -> return MonitorStateAlreadyChanged (True, FileExists, _, _) -> return MonitorStateFileExists (True, FileModTime, _, _) -> handleIOException MonitorStateAlreadyChanged $ do mtime <- getModTime abspath if changedDuringUpdate mstartTime mtime then return MonitorStateAlreadyChanged else return (MonitorStateFileModTime mtime) (True, FileHashed, _, _) -> handleIOException MonitorStateAlreadyChanged $ do mtime <- getModTime abspath if changedDuringUpdate mstartTime mtime then return MonitorStateAlreadyChanged else do hash <- getFileHash hashcache abspath abspath mtime return (MonitorStateFileHashed mtime hash) (_, _, True, DirExists) -> return MonitorStateDirExists (_, _, True, DirModTime) -> handleIOException MonitorStateAlreadyChanged $ do mtime <- getModTime abspath if changedDuringUpdate mstartTime mtime then return MonitorStateAlreadyChanged else return (MonitorStateDirModTime mtime) (False, _, True, DirNotExists) -> return MonitorStateAlreadyChanged (True, FileNotExists, False, _) -> return MonitorStateAlreadyChanged -- | If we have a timestamp for the beginning of the update, then any file -- mtime later than this means that it changed during the update and we ought -- to consider the file as already changed. --
2,271
buildMonitorStateFile mstartTime hashcache kindfile kinddir root path = do let abspath = root </> path isFile <- doesFileExist abspath isDir <- doesDirectoryExist abspath case (isFile, kindfile, isDir, kinddir) of (_, FileNotExists, _, DirNotExists) -> -- we don't need to care if it exists now, since we check at probe time return MonitorStateNonExistent (False, _, False, _) -> return MonitorStateAlreadyChanged (True, FileExists, _, _) -> return MonitorStateFileExists (True, FileModTime, _, _) -> handleIOException MonitorStateAlreadyChanged $ do mtime <- getModTime abspath if changedDuringUpdate mstartTime mtime then return MonitorStateAlreadyChanged else return (MonitorStateFileModTime mtime) (True, FileHashed, _, _) -> handleIOException MonitorStateAlreadyChanged $ do mtime <- getModTime abspath if changedDuringUpdate mstartTime mtime then return MonitorStateAlreadyChanged else do hash <- getFileHash hashcache abspath abspath mtime return (MonitorStateFileHashed mtime hash) (_, _, True, DirExists) -> return MonitorStateDirExists (_, _, True, DirModTime) -> handleIOException MonitorStateAlreadyChanged $ do mtime <- getModTime abspath if changedDuringUpdate mstartTime mtime then return MonitorStateAlreadyChanged else return (MonitorStateDirModTime mtime) (False, _, True, DirNotExists) -> return MonitorStateAlreadyChanged (True, FileNotExists, False, _) -> return MonitorStateAlreadyChanged -- | If we have a timestamp for the beginning of the update, then any file -- mtime later than this means that it changed during the update and we ought -- to consider the file as already changed. --
1,907
false
true
0
18
670
450
233
217
null
null
wavewave/cvmaker
src/Text/StringTemplate/Helpers.hs
gpl-3.0
{- | I'm this does the same thing as directoryGroup (modulo IO strictness), which uses an applicative idiom that melts my brain. Not a direct translation, but it's easier for me to understand when written Important change: readFile is strict. If it is left lazy, appkiller.sh causes happstutorial to crash when in dynamicTemplateReload mode. (See HAppS GoogleGroup.) I think this needs to be fixed in HStringTemplate distribution as well. This should be fixed in HSTringTemplate package as well. -} directoryGroupNew :: (Stringable a) => FilePath -> IO (STGroup a) directoryGroupNew = directoryGroupNew' (\_ -> False) (\_ -> False)
664
directoryGroupNew :: (Stringable a) => FilePath -> IO (STGroup a) directoryGroupNew = directoryGroupNew' (\_ -> False) (\_ -> False)
132
directoryGroupNew = directoryGroupNew' (\_ -> False) (\_ -> False)
66
true
true
0
10
130
60
31
29
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_372 (168#) = happyReduce_74
34
action_372 (168#) = happyReduce_74
34
action_372 (168#) = happyReduce_74
34
false
false
0
6
3
12
6
6
null
null
tomberek/rulestesting
Auto.hs
bsd-3-clause
runAutoIO_ :: AutoXIO a b -> a -> IO (Maybe b) runAutoIO_ f a = liftM fst $ (runAutoX . runAutoXIO) f a
104
runAutoIO_ :: AutoXIO a b -> a -> IO (Maybe b) runAutoIO_ f a = liftM fst $ (runAutoX . runAutoXIO) f a
104
runAutoIO_ f a = liftM fst $ (runAutoX . runAutoXIO) f a
57
false
true
0
9
23
57
27
30
null
null
bus000/Dikunt
plugins/Greetings/Main.hs
bsd-3-clause
main :: IO () main = do (nick:_) <- getArgs hSetBuffering stdout LineBuffering hSetBuffering stdin LineBuffering forever $ do line <- T.getLine handleMessage nick $ (decode . T.encodeUtf8) line
227
main :: IO () main = do (nick:_) <- getArgs hSetBuffering stdout LineBuffering hSetBuffering stdin LineBuffering forever $ do line <- T.getLine handleMessage nick $ (decode . T.encodeUtf8) line
227
main = do (nick:_) <- getArgs hSetBuffering stdout LineBuffering hSetBuffering stdin LineBuffering forever $ do line <- T.getLine handleMessage nick $ (decode . T.encodeUtf8) line
213
false
true
0
14
62
84
38
46
null
null
ancientlanguage/haskell-analysis
grammar/src/Grammar/Common/Decompose.hs
mit
decomposeChar '\x03CE' = "\x03C9\x0301"
39
decomposeChar '\x03CE' = "\x03C9\x0301"
39
decomposeChar '\x03CE' = "\x03C9\x0301"
39
false
false
0
5
3
9
4
5
null
null
neongreen/hat
src/DB.hs
bsd-3-clause
setWords :: Uid Game -> Uid User -> [Text] -> Acid.Update GlobalState () setWords gameId userId ws = gameById gameId.wordReq._Just.submitted.at userId .= Just (S.fromList ws)
176
setWords :: Uid Game -> Uid User -> [Text] -> Acid.Update GlobalState () setWords gameId userId ws = gameById gameId.wordReq._Just.submitted.at userId .= Just (S.fromList ws)
176
setWords gameId userId ws = gameById gameId.wordReq._Just.submitted.at userId .= Just (S.fromList ws)
103
false
true
2
10
26
89
39
50
null
null
rootzlevel/hledger-add
src/Brick/Widgets/HelpMessage.hs
bsd-3-clause
helpWidget :: n -> KeyBindings -> HelpWidget n helpWidget = flip HelpWidget
75
helpWidget :: n -> KeyBindings -> HelpWidget n helpWidget = flip HelpWidget
75
helpWidget = flip HelpWidget
28
false
true
0
7
11
25
12
13
null
null
rueshyna/gogol
gogol-language/gen/Network/Google/Resource/Language/Documents/AnalyzeEntities.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). daeUploadProtocol :: Lens' DocumentsAnalyzeEntities (Maybe Text) daeUploadProtocol = lens _daeUploadProtocol (\ s a -> s{_daeUploadProtocol = a})
215
daeUploadProtocol :: Lens' DocumentsAnalyzeEntities (Maybe Text) daeUploadProtocol = lens _daeUploadProtocol (\ s a -> s{_daeUploadProtocol = a})
153
daeUploadProtocol = lens _daeUploadProtocol (\ s a -> s{_daeUploadProtocol = a})
88
true
true
0
8
33
49
25
24
null
null
JacquesCarette/literate-scientific-software
code/drasil-example/Drasil/GlassBR/Unitals.hs
bsd-2-clause
probBreak = cc' probBr (foldlSent_ [S "the fraction of glass lites or plies that would break at the", S "first occurrence of a specified load and duration, typically expressed", S "in lites per 1000", sParen $ makeCiteS astm2016])
240
probBreak = cc' probBr (foldlSent_ [S "the fraction of glass lites or plies that would break at the", S "first occurrence of a specified load and duration, typically expressed", S "in lites per 1000", sParen $ makeCiteS astm2016])
240
probBreak = cc' probBr (foldlSent_ [S "the fraction of glass lites or plies that would break at the", S "first occurrence of a specified load and duration, typically expressed", S "in lites per 1000", sParen $ makeCiteS astm2016])
240
false
false
0
9
47
46
22
24
null
null
haskell-web-intro/secdev
examples/reflex-ghcjs-client/src/Blobs.hs
mit
updateBlob :: Parameters -> GaussianParameters Float -> GaussianParameters Float updateBlob (SigmaX sx) g = g { sigmaX = sx }
125
updateBlob :: Parameters -> GaussianParameters Float -> GaussianParameters Float updateBlob (SigmaX sx) g = g { sigmaX = sx }
125
updateBlob (SigmaX sx) g = g { sigmaX = sx }
44
false
true
0
10
19
49
23
26
null
null
kig/tomtegebra
Tomtegebra/Algebra.hs
gpl-3.0
subExprAt' e i c | i == c = (Just e, c)
39
subExprAt' e i c | i == c = (Just e, c)
39
subExprAt' e i c | i == c = (Just e, c)
39
false
false
0
8
11
32
15
17
null
null
ChrisCoffey/haskell_sandbox
hackerRank/interpreters/Interpreters/src/while.hs
mit
ifStatement :: Parser Statement ifStatement = do reserved "if" cond <- bExpression reserved "then" yes <- braces statement reserved "else" no <- braces statement return $ If cond yes no
215
ifStatement :: Parser Statement ifStatement = do reserved "if" cond <- bExpression reserved "then" yes <- braces statement reserved "else" no <- braces statement return $ If cond yes no
215
ifStatement = do reserved "if" cond <- bExpression reserved "then" yes <- braces statement reserved "else" no <- braces statement return $ If cond yes no
183
false
true
0
8
59
73
30
43
null
null
TomHammersley/HaskellRenderer
app/src/Misc.hs
gpl-2.0
randDouble :: (RandomGen g) => State g Double randDouble = do gen <- get let (r, gen') = randomR (0, 1) gen put gen' return r -- Handy little thing to apply a different function to each of the two elements in a Maybe (a, a) pair. Useful in various ray tracing bits of code
281
randDouble :: (RandomGen g) => State g Double randDouble = do gen <- get let (r, gen') = randomR (0, 1) gen put gen' return r -- Handy little thing to apply a different function to each of the two elements in a Maybe (a, a) pair. Useful in various ray tracing bits of code
281
randDouble = do gen <- get let (r, gen') = randomR (0, 1) gen put gen' return r -- Handy little thing to apply a different function to each of the two elements in a Maybe (a, a) pair. Useful in various ray tracing bits of code
235
false
true
0
11
63
72
35
37
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_213 (34#) = happyGoto action_347
39
action_213 (34#) = happyGoto action_347
39
action_213 (34#) = happyGoto action_347
39
false
false
0
6
4
15
7
8
null
null
JacquesCarette/literate-scientific-software
code/drasil-docLang/Drasil/Sections/TraceabilityMandGs.hs
bsd-2-clause
tvGenDefns :: TraceViewCat tvGenDefns = traceView gendefTable
61
tvGenDefns :: TraceViewCat tvGenDefns = traceView gendefTable
61
tvGenDefns = traceView gendefTable
34
false
true
0
6
6
21
8
13
null
null
lally/orgmode
tests/Data/ArbOrgNode.hs
bsd-3-clause
arbTextLine :: LineNumber -> Gen TextLine arbTextLine linenr = do indent <- arbIndent text <- arbitraryText indent return (TextLine indent text linenr) -- lnfunc takes a line and returns something >= to it. It may return -- Nothing.
240
arbTextLine :: LineNumber -> Gen TextLine arbTextLine linenr = do indent <- arbIndent text <- arbitraryText indent return (TextLine indent text linenr) -- lnfunc takes a line and returns something >= to it. It may return -- Nothing.
240
arbTextLine linenr = do indent <- arbIndent text <- arbitraryText indent return (TextLine indent text linenr) -- lnfunc takes a line and returns something >= to it. It may return -- Nothing.
198
false
true
0
9
45
56
26
30
null
null
bestian/haskell-sandbox
guessNumber.hs
unlicense
roll100 :: IO Int roll100 = getStdRandom (randomR (1,100))
58
roll100 :: IO Int roll100 = getStdRandom (randomR (1,100))
58
roll100 = getStdRandom (randomR (1,100))
40
false
true
0
8
8
29
15
14
null
null
TomMD/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
-- These primops are implemented by CallishMachOps, because they sometimes -- turn into foreign calls depending on the backend. callishOp :: PrimOp -> Maybe CallishMachOp callishOp DoublePowerOp = Just MO_F64_Pwr
214
callishOp :: PrimOp -> Maybe CallishMachOp callishOp DoublePowerOp = Just MO_F64_Pwr
85
callishOp DoublePowerOp = Just MO_F64_Pwr
42
true
true
0
7
31
30
14
16
null
null
li-zhirui/EoplLangs
src/CallByName/Parser.hs
bsd-3-clause
parens = between (symbol "(") (symbol ")")
42
parens = between (symbol "(") (symbol ")")
42
parens = between (symbol "(") (symbol ")")
42
false
false
0
7
6
23
11
12
null
null
danchoi/jsontsv
Main.hs
mit
-- evaluates the a JS key path against a Value context to a leaf Value evalKeyPath :: Config -> [Key] -> Value -> Value evalKeyPath config [] x@(String _) = x
158
evalKeyPath :: Config -> [Key] -> Value -> Value evalKeyPath config [] x@(String _) = x
87
evalKeyPath config [] x@(String _) = x
38
true
true
0
8
30
50
25
25
null
null
danr/tfp1
Lang/ToPolyFOL.hs
gpl-3.0
trType :: T.Type v -> P.Type (Poly v) trType t0 = case t0 of T.ArrTy t1 t2 -> P.TyCon TyFn [trType t1,trType t2] T.TyVar x -> P.TyVar (Id x) T.TyCon tc ts -> P.TyCon (Id tc) (map trType ts) T.Forall{} -> error "ToPolyFOL.trType on Forall" T.Star -> error "ToPolyFOL.trType on Star"
315
trType :: T.Type v -> P.Type (Poly v) trType t0 = case t0 of T.ArrTy t1 t2 -> P.TyCon TyFn [trType t1,trType t2] T.TyVar x -> P.TyVar (Id x) T.TyCon tc ts -> P.TyCon (Id tc) (map trType ts) T.Forall{} -> error "ToPolyFOL.trType on Forall" T.Star -> error "ToPolyFOL.trType on Star"
315
trType t0 = case t0 of T.ArrTy t1 t2 -> P.TyCon TyFn [trType t1,trType t2] T.TyVar x -> P.TyVar (Id x) T.TyCon tc ts -> P.TyCon (Id tc) (map trType ts) T.Forall{} -> error "ToPolyFOL.trType on Forall" T.Star -> error "ToPolyFOL.trType on Star"
277
false
true
10
9
84
149
71
78
null
null
np/hx
Mnemonic.hs
gpl-3.0
w8_to_w32 _ = error "w8_to_w32: expects the number of input bytes to be a multiple of 4 (8 hexadecimal digits)"
111
w8_to_w32 _ = error "w8_to_w32: expects the number of input bytes to be a multiple of 4 (8 hexadecimal digits)"
111
w8_to_w32 _ = error "w8_to_w32: expects the number of input bytes to be a multiple of 4 (8 hexadecimal digits)"
111
false
false
0
5
19
12
5
7
null
null
EarthCitizen/baskell
test/Gen.hs
bsd-3-clause
exprToString (Multiply a b) = parensWithOp a b "*"
53
exprToString (Multiply a b) = parensWithOp a b "*"
53
exprToString (Multiply a b) = parensWithOp a b "*"
53
false
false
0
7
11
24
11
13
null
null
brendanhay/gogol
gogol-deploymentmanager/gen/Network/Google/Resource/DeploymentManager/Deployments/List.hs
mpl-2.0
-- | Creates a value of 'DeploymentsList' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'dlXgafv' -- -- * 'dlUploadProtocol' -- -- * 'dlOrderBy' -- -- * 'dlProject' -- -- * 'dlAccessToken' -- -- * 'dlUploadType' -- -- * 'dlFilter' -- -- * 'dlPageToken' -- -- * 'dlMaxResults' -- -- * 'dlCallback' deploymentsList :: Text -- ^ 'dlProject' -> DeploymentsList deploymentsList pDlProject_ = DeploymentsList' { _dlXgafv = Nothing , _dlUploadProtocol = Nothing , _dlOrderBy = Nothing , _dlProject = pDlProject_ , _dlAccessToken = Nothing , _dlUploadType = Nothing , _dlFilter = Nothing , _dlPageToken = Nothing , _dlMaxResults = 500 , _dlCallback = Nothing }
793
deploymentsList :: Text -- ^ 'dlProject' -> DeploymentsList deploymentsList pDlProject_ = DeploymentsList' { _dlXgafv = Nothing , _dlUploadProtocol = Nothing , _dlOrderBy = Nothing , _dlProject = pDlProject_ , _dlAccessToken = Nothing , _dlUploadType = Nothing , _dlFilter = Nothing , _dlPageToken = Nothing , _dlMaxResults = 500 , _dlCallback = Nothing }
409
deploymentsList pDlProject_ = DeploymentsList' { _dlXgafv = Nothing , _dlUploadProtocol = Nothing , _dlOrderBy = Nothing , _dlProject = pDlProject_ , _dlAccessToken = Nothing , _dlUploadType = Nothing , _dlFilter = Nothing , _dlPageToken = Nothing , _dlMaxResults = 500 , _dlCallback = Nothing }
341
true
true
0
6
176
104
74
30
null
null
kwf/data-kiln
Data/Kiln/Examples.hs
bsd-3-clause
cons :: a -> Maybe (MSLL s a) -> Squishy s (MSLL s a) cons car cdr = newClay (Compose (car, cdr))
97
cons :: a -> Maybe (MSLL s a) -> Squishy s (MSLL s a) cons car cdr = newClay (Compose (car, cdr))
97
cons car cdr = newClay (Compose (car, cdr))
43
false
true
0
9
21
63
31
32
null
null
input-output-hk/pos-haskell-prototype
wallet/test/unit/Test/Spec/CoinSelection.hs
mit
maxNumInputs :: Word64 maxNumInputs = 300
41
maxNumInputs :: Word64 maxNumInputs = 300
41
maxNumInputs = 300
18
false
true
0
6
5
18
7
11
null
null
ftomassetti/civs-haskell
src/Civs/Model.hs
apache-2.0
takeRandom seed list n = helper ss0 list n [] where rg = mkStdGen seed ss0 = randoms rg :: [Int] helper :: [Int] -> [a] -> Int -> [a] -> [a] helper ss list 0 taken = taken helper ss list n taken = let index = (head ss) `mod` (length list) extracted = list !! index in helper (tail ss) list (n-1) (extracted:taken) ------------------------------------------------- -- Language -------------------------------------------------
691
takeRandom seed list n = helper ss0 list n [] where rg = mkStdGen seed ss0 = randoms rg :: [Int] helper :: [Int] -> [a] -> Int -> [a] -> [a] helper ss list 0 taken = taken helper ss list n taken = let index = (head ss) `mod` (length list) extracted = list !! index in helper (tail ss) list (n-1) (extracted:taken) ------------------------------------------------- -- Language -------------------------------------------------
691
takeRandom seed list n = helper ss0 list n [] where rg = mkStdGen seed ss0 = randoms rg :: [Int] helper :: [Int] -> [a] -> Int -> [a] -> [a] helper ss list 0 taken = taken helper ss list n taken = let index = (head ss) `mod` (length list) extracted = list !! index in helper (tail ss) list (n-1) (extracted:taken) ------------------------------------------------- -- Language -------------------------------------------------
691
false
false
0
13
334
180
95
85
null
null
bgamari/tpar
TPar/SubPubStream/Test.hs
bsd-3-clause
traceP :: (MonadIO m, Show a) => Pipe a a m r traceP = P.P.mapM (\x -> dbg x >> return x)
89
traceP :: (MonadIO m, Show a) => Pipe a a m r traceP = P.P.mapM (\x -> dbg x >> return x)
89
traceP = P.P.mapM (\x -> dbg x >> return x)
43
false
true
0
9
21
64
31
33
null
null
urbanslug/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
pprStmtInCtxt :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsStmtContext idL -> StmtLR idL idR body -> SDoc pprStmtInCtxt ctxt (LastStmt e _) | isListCompExpr ctxt -- For [ e | .. ], do not mutter about "stmts" = hang (ptext (sLit "In the expression:")) 2 (ppr e)
306
pprStmtInCtxt :: (OutputableBndr idL, OutputableBndr idR, Outputable body) => HsStmtContext idL -> StmtLR idL idR body -> SDoc pprStmtInCtxt ctxt (LastStmt e _) | isListCompExpr ctxt -- For [ e | .. ], do not mutter about "stmts" = hang (ptext (sLit "In the expression:")) 2 (ppr e)
306
pprStmtInCtxt ctxt (LastStmt e _) | isListCompExpr ctxt -- For [ e | .. ], do not mutter about "stmts" = hang (ptext (sLit "In the expression:")) 2 (ppr e)
164
false
true
0
10
71
98
47
51
null
null
josuf107/Adverb
Adverb/Common.hs
gpl-3.0
hypnotically = id
17
hypnotically = id
17
hypnotically = id
17
false
false
0
4
2
6
3
3
null
null
phischu/fragnix
tests/packages/scotty/System.Console.ANSI.Unix.hs
bsd-3-clause
hClearFromCursorToScreenEnd h = hPutStr h clearFromCursorToScreenEndCode
72
hClearFromCursorToScreenEnd h = hPutStr h clearFromCursorToScreenEndCode
72
hClearFromCursorToScreenEnd h = hPutStr h clearFromCursorToScreenEndCode
72
false
false
0
5
5
14
6
8
null
null