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
corajr/adventofcode2015
22/src/RPG.hs
mit
spellSet :: Set.Set Spell spellSet = Set.fromList spells
56
spellSet :: Set.Set Spell spellSet = Set.fromList spells
56
spellSet = Set.fromList spells
30
false
true
0
6
7
21
10
11
null
null
maciejspychala/haskell-server
src/Auth.hs
mit
right :: Either a b -> b right (Right a) = a
45
right :: Either a b -> b right (Right a) = a
44
right (Right a) = a
19
false
true
0
9
12
35
15
20
null
null
patperry/hs-linear-algebra
tests-old/STVector.hs
bsd-3-clause
implementsIf :: (AEq a, Show a) => (forall s . STVector s E -> ST s Bool) -> (forall s . STVector s E -> ST s a) -> ([E] -> (a,[E])) -> Property implementsIf pre a f = forAll arbitrary $ \(Nat n) -> forAll (Test.vector n) $ \x -> runST ( do x' <- thawVector x pre x') ==> runST ( do x' <- unsafeThawVector x commutes x' a f )
418
implementsIf :: (AEq a, Show a) => (forall s . STVector s E -> ST s Bool) -> (forall s . STVector s E -> ST s a) -> ([E] -> (a,[E])) -> Property implementsIf pre a f = forAll arbitrary $ \(Nat n) -> forAll (Test.vector n) $ \x -> runST ( do x' <- thawVector x pre x') ==> runST ( do x' <- unsafeThawVector x commutes x' a f )
418
implementsIf pre a f = forAll arbitrary $ \(Nat n) -> forAll (Test.vector n) $ \x -> runST ( do x' <- thawVector x pre x') ==> runST ( do x' <- unsafeThawVector x commutes x' a f )
252
false
true
0
15
165
198
98
100
null
null
christiaanb/ghc
compiler/cmm/CmmContFlowOpt.hs
bsd-3-clause
splice :: Block CmmNode C O -> CmmBlock -> CmmBlock splice head rest = entry `blockJoinHead` code0 `blockAppend` code1 where (CmmEntry lbl sc0, code0) = blockSplitHead head (CmmEntry _ sc1, code1) = blockSplitHead rest entry = CmmEntry lbl (combineTickScopes sc0 sc1) -- If node is a call with continuation call return Just label of that -- continuation. Otherwise return Nothing.
401
splice :: Block CmmNode C O -> CmmBlock -> CmmBlock splice head rest = entry `blockJoinHead` code0 `blockAppend` code1 where (CmmEntry lbl sc0, code0) = blockSplitHead head (CmmEntry _ sc1, code1) = blockSplitHead rest entry = CmmEntry lbl (combineTickScopes sc0 sc1) -- If node is a call with continuation call return Just label of that -- continuation. Otherwise return Nothing.
401
splice head rest = entry `blockJoinHead` code0 `blockAppend` code1 where (CmmEntry lbl sc0, code0) = blockSplitHead head (CmmEntry _ sc1, code1) = blockSplitHead rest entry = CmmEntry lbl (combineTickScopes sc0 sc1) -- If node is a call with continuation call return Just label of that -- continuation. Otherwise return Nothing.
349
false
true
2
7
80
104
55
49
null
null
JenniferWang/incremental-haskell
src/Kind.hs
mit
iteriChildren (Bind _ lhs rhs _) g = let l = g 0 (pack lhs) in if (isNothing rhs) then [l] else l:[g 1 (pack $ fromJust rhs)]
270
iteriChildren (Bind _ lhs rhs _) g = let l = g 0 (pack lhs) in if (isNothing rhs) then [l] else l:[g 1 (pack $ fromJust rhs)]
270
iteriChildren (Bind _ lhs rhs _) g = let l = g 0 (pack lhs) in if (isNothing rhs) then [l] else l:[g 1 (pack $ fromJust rhs)]
270
false
false
0
13
172
84
42
42
null
null
kolmodin/spdy
Network/SPDY/Binary.hs
bsd-3-clause
streamOutFrame :: OutputStream L.ByteString -> IO (OutputStream Frame) streamOutFrame outp = Streams.makeOutputStream go where go Nothing = write Nothing outp go (Just frame) = do let lbs = runPut (runBitPut (putFrame frame)) write (Just lbs) outp
269
streamOutFrame :: OutputStream L.ByteString -> IO (OutputStream Frame) streamOutFrame outp = Streams.makeOutputStream go where go Nothing = write Nothing outp go (Just frame) = do let lbs = runPut (runBitPut (putFrame frame)) write (Just lbs) outp
269
streamOutFrame outp = Streams.makeOutputStream go where go Nothing = write Nothing outp go (Just frame) = do let lbs = runPut (runBitPut (putFrame frame)) write (Just lbs) outp
198
false
true
1
15
57
104
48
56
null
null
cje/hilbert
test/THilbert.hs
bsd-3-clause
prop_graycodeBijective :: PrecisionNum -> Property prop_graycodeBijective i = (value i >= 0) ==> grayCodeInverse (grayCode i) == i
159
prop_graycodeBijective :: PrecisionNum -> Property prop_graycodeBijective i = (value i >= 0) ==> grayCodeInverse (grayCode i) == i
158
prop_graycodeBijective i = (value i >= 0) ==> grayCodeInverse (grayCode i) == i
107
false
true
0
9
46
45
22
23
null
null
gleachkr/Carnap
Carnap/src/Carnap/Core/ModelChecking/ModelFinder.hs
gpl-3.0
inToPred :: Domain t => TermName t -> MTerm nm (Set t) -> Sat nm inToPred name (MSingelton name') = SBool (name == name')
132
inToPred :: Domain t => TermName t -> MTerm nm (Set t) -> Sat nm inToPred name (MSingelton name') = SBool (name == name')
132
inToPred name (MSingelton name') = SBool (name == name')
67
false
true
0
10
34
64
30
34
null
null
unknownloner/calccomp
Asm/InstrBytes.hs
mit
-- Combines Constant base with bits for register r shifted s bits left regBits :: Int -> Register -> Int -> Int regBits base r s = fromIntegral $ base + (bits * (2 ^ s)) where bits = if regIs8Bit r then case r of A -> 7 B -> 0 C -> 1 D -> 2 E -> 3 H -> 4 L -> 5 _ -> 6 else case r of BC -> 0 DE -> 1 HL -> 2 _ -> 3
613
regBits :: Int -> Register -> Int -> Int regBits base r s = fromIntegral $ base + (bits * (2 ^ s)) where bits = if regIs8Bit r then case r of A -> 7 B -> 0 C -> 1 D -> 2 E -> 3 H -> 4 L -> 5 _ -> 6 else case r of BC -> 0 DE -> 1 HL -> 2 _ -> 3
542
regBits base r s = fromIntegral $ base + (bits * (2 ^ s)) where bits = if regIs8Bit r then case r of A -> 7 B -> 0 C -> 1 D -> 2 E -> 3 H -> 4 L -> 5 _ -> 6 else case r of BC -> 0 DE -> 1 HL -> 2 _ -> 3
501
true
true
0
10
384
151
78
73
null
null
kishoredbn/barrelfish
hake/ARMv7.hs
mit
kernelLdFlags = [ Str "-Wl,-N", Str "-fno-builtin", Str "-nostdlib", Str "-pie", Str "-Wl,--fatal-warnings", Str "-Wl,--dynamic-list-data", Str "-Wl,--export-dynamic" ]
292
kernelLdFlags = [ Str "-Wl,-N", Str "-fno-builtin", Str "-nostdlib", Str "-pie", Str "-Wl,--fatal-warnings", Str "-Wl,--dynamic-list-data", Str "-Wl,--export-dynamic" ]
292
kernelLdFlags = [ Str "-Wl,-N", Str "-fno-builtin", Str "-nostdlib", Str "-pie", Str "-Wl,--fatal-warnings", Str "-Wl,--dynamic-list-data", Str "-Wl,--export-dynamic" ]
292
false
false
0
6
141
48
24
24
null
null
alexgadea/fun-gui
GUI/GState.hs
gpl-3.0
getGState :: GuiMonad GState getGState = get >>= readRef
56
getGState :: GuiMonad GState getGState = get >>= readRef
56
getGState = get >>= readRef
27
false
true
0
5
8
18
9
9
null
null
Haskell-Praxis/core-catcher
app/Main.hs
mit
wsApp :: TVar (ServerState WsConnection) -> WS.ServerApp wsApp stateVar pendingConn = do conn <- WS.acceptRequest pendingConn let wsConn = WsConnection conn WS.forkPingThread conn 30 cId <- connectClient wsConn stateVar -- call to ConnectionMgnt sendSendableMsg wsConn Protocol.ServerHello Exception.finally (wsListen (cId, wsConn) stateVar) (disconnectClient cId stateVar) -- call to ConnectionMgnt
440
wsApp :: TVar (ServerState WsConnection) -> WS.ServerApp wsApp stateVar pendingConn = do conn <- WS.acceptRequest pendingConn let wsConn = WsConnection conn WS.forkPingThread conn 30 cId <- connectClient wsConn stateVar -- call to ConnectionMgnt sendSendableMsg wsConn Protocol.ServerHello Exception.finally (wsListen (cId, wsConn) stateVar) (disconnectClient cId stateVar) -- call to ConnectionMgnt
440
wsApp stateVar pendingConn = do conn <- WS.acceptRequest pendingConn let wsConn = WsConnection conn WS.forkPingThread conn 30 cId <- connectClient wsConn stateVar -- call to ConnectionMgnt sendSendableMsg wsConn Protocol.ServerHello Exception.finally (wsListen (cId, wsConn) stateVar) (disconnectClient cId stateVar) -- call to ConnectionMgnt
383
false
true
0
10
88
121
56
65
null
null
GaloisInc/mistral
src/Mistral/ModuleSystem/Rename.hs
bsd-3-clause
rwFreshOrigin :: Namespace -> Origin -> RW -> (Origin,RW) rwFreshOrigin ns o rw = case o of FromIdent l src n -> let (n',rw') = rwFreshIdent ns l n rw in (FromIdent l src n', rw') -- parameters are only ever present at the value level FromParam src n -> let (n',rw') = rwFreshParam n rw in (FromParam src n', rw') -- imported names don't need to be freshened FromImport{} -> (o, rw) -- | Identifiers are always turned into global names.
495
rwFreshOrigin :: Namespace -> Origin -> RW -> (Origin,RW) rwFreshOrigin ns o rw = case o of FromIdent l src n -> let (n',rw') = rwFreshIdent ns l n rw in (FromIdent l src n', rw') -- parameters are only ever present at the value level FromParam src n -> let (n',rw') = rwFreshParam n rw in (FromParam src n', rw') -- imported names don't need to be freshened FromImport{} -> (o, rw) -- | Identifiers are always turned into global names.
495
rwFreshOrigin ns o rw = case o of FromIdent l src n -> let (n',rw') = rwFreshIdent ns l n rw in (FromIdent l src n', rw') -- parameters are only ever present at the value level FromParam src n -> let (n',rw') = rwFreshParam n rw in (FromParam src n', rw') -- imported names don't need to be freshened FromImport{} -> (o, rw) -- | Identifiers are always turned into global names.
437
false
true
0
12
140
157
81
76
null
null
bergmark/mmdoc
src/Warn.hs
bsd-3-clause
checkProtection (Package Nothing n _ is cs) = W.Unencapsulated (pr n) : concatMap checkImportProtection is ++ concatMap checkProtection cs
138
checkProtection (Package Nothing n _ is cs) = W.Unencapsulated (pr n) : concatMap checkImportProtection is ++ concatMap checkProtection cs
138
checkProtection (Package Nothing n _ is cs) = W.Unencapsulated (pr n) : concatMap checkImportProtection is ++ concatMap checkProtection cs
138
false
false
0
9
18
53
24
29
null
null
mimi1vx/shellcheck
ShellCheck/Analytics.hs
gpl-3.0
producesComments :: (Parameters -> Token -> [TokenComment]) -> String -> Maybe Bool producesComments f s = do root <- prRoot pResult return . not . null $ runList (defaultSpec root) [f] where pSpec = ParseSpec { psFilename = "script", psScript = s } pResult = runIdentity $ parseScript (mockedSystemInterface []) pSpec -- Copied from https://wiki.haskell.org/Edit_distance
419
producesComments :: (Parameters -> Token -> [TokenComment]) -> String -> Maybe Bool producesComments f s = do root <- prRoot pResult return . not . null $ runList (defaultSpec root) [f] where pSpec = ParseSpec { psFilename = "script", psScript = s } pResult = runIdentity $ parseScript (mockedSystemInterface []) pSpec -- Copied from https://wiki.haskell.org/Edit_distance
419
producesComments f s = do root <- prRoot pResult return . not . null $ runList (defaultSpec root) [f] where pSpec = ParseSpec { psFilename = "script", psScript = s } pResult = runIdentity $ parseScript (mockedSystemInterface []) pSpec -- Copied from https://wiki.haskell.org/Edit_distance
335
false
true
4
10
101
139
66
73
null
null
JohnLato/scryptic
src/Scryptic/Language/LayoutScrypt.hs
gpl-3.0
-- | Insert a number of tokens at the begninning of a list of tokens. addTokens :: Position -- ^ Position of the first new token. -> [String] -- ^ Token symbols. -> [Token] -- ^ The rest of the tokens. These will have their -- positions updated to make room for the new tokens . -> [Token] addTokens p ss ts = foldr (addToken p) ts ss
412
addTokens :: Position -- ^ Position of the first new token. -> [String] -- ^ Token symbols. -> [Token] -- ^ The rest of the tokens. These will have their -- positions updated to make room for the new tokens . -> [Token] addTokens p ss ts = foldr (addToken p) ts ss
319
addTokens p ss ts = foldr (addToken p) ts ss
44
true
true
0
8
145
57
32
25
null
null
rolph-recto/liquid-fixpoint
src/Language/Fixpoint/Smt/Interface.hs
bsd-3-clause
smtBracket :: Context -> IO a -> IO a smtBracket me a = do smtPush me r <- a smtPop me return r
166
smtBracket :: Context -> IO a -> IO a smtBracket me a = do smtPush me r <- a smtPop me return r
166
smtBracket me a = do smtPush me r <- a smtPop me return r
128
false
true
0
8
93
60
24
36
null
null
fpco/hlint
data/Default.hs
bsd-3-clause
error = foldr1 (+) ==> sum where note = RemovesError "on []"
62
error = foldr1 (+) ==> sum where note = RemovesError "on []"
62
error = foldr1 (+) ==> sum where note = RemovesError "on []"
62
false
false
0
7
13
25
13
12
null
null
cosmo0920/Ahblog
tests/Handler/Home.hs
mit
homeSpecs :: Spec homeSpecs = ydescribe "/home tests" $ do yit "can access /" $ do get HomeR statusIs 200 yit "Home html contains class=\"page-header\"" $ do get HomeR htmlAllContain "body" "div class=\"page-header\"" htmlCount "h1" 1 yit "Home html contains hr" $ do get HomeR htmlCount "hr" 1
352
homeSpecs :: Spec homeSpecs = ydescribe "/home tests" $ do yit "can access /" $ do get HomeR statusIs 200 yit "Home html contains class=\"page-header\"" $ do get HomeR htmlAllContain "body" "div class=\"page-header\"" htmlCount "h1" 1 yit "Home html contains hr" $ do get HomeR htmlCount "hr" 1
352
homeSpecs = ydescribe "/home tests" $ do yit "can access /" $ do get HomeR statusIs 200 yit "Home html contains class=\"page-header\"" $ do get HomeR htmlAllContain "body" "div class=\"page-header\"" htmlCount "h1" 1 yit "Home html contains hr" $ do get HomeR htmlCount "hr" 1
334
false
true
0
11
105
96
38
58
null
null
exercism/xhaskell
exercises/practice/yacht/.meta/examples/success-standard/src/Yacht.hs
mit
yacht Fours = valueScore 4
27
yacht Fours = valueScore 4
27
yacht Fours = valueScore 4
27
false
false
0
5
5
12
5
7
null
null
michaxm/task-distribution
src/Control/Distributed/Task/TaskSpawning/TaskSpawning.hs
bsd-3-clause
-- Full binary deployment step 1/3 fullBinarySerializationOnMaster :: FilePath -> IO TaskDef fullBinarySerializationOnMaster programPath = do currentExecutable <- BL.readFile programPath return $ DeployFullBinary currentExecutable -- Serialized thunk deployment step 1/3: run within the client/master process to serialize itself.
334
fullBinarySerializationOnMaster :: FilePath -> IO TaskDef fullBinarySerializationOnMaster programPath = do currentExecutable <- BL.readFile programPath return $ DeployFullBinary currentExecutable -- Serialized thunk deployment step 1/3: run within the client/master process to serialize itself.
299
fullBinarySerializationOnMaster programPath = do currentExecutable <- BL.readFile programPath return $ DeployFullBinary currentExecutable -- Serialized thunk deployment step 1/3: run within the client/master process to serialize itself.
241
true
true
0
9
42
45
21
24
null
null
davbaumgartner/LAuREL
LAuREL/Parser.hs
bsd-3-clause
ifStatement :: Parser Expr ifStatement = do reserved "if" condition <- exprStatement reserved "->" <|> reserved "→" ifpos <- statement reserved "else" ifneg <- statement return If { ifCond = condition, ifTrue = ifpos, ifFalse = ifneg }
356
ifStatement :: Parser Expr ifStatement = do reserved "if" condition <- exprStatement reserved "->" <|> reserved "→" ifpos <- statement reserved "else" ifneg <- statement return If { ifCond = condition, ifTrue = ifpos, ifFalse = ifneg }
354
ifStatement = do reserved "if" condition <- exprStatement reserved "->" <|> reserved "→" ifpos <- statement reserved "else" ifneg <- statement return If { ifCond = condition, ifTrue = ifpos, ifFalse = ifneg }
309
false
true
0
9
158
88
40
48
null
null
alexander-at-github/eta
compiler/ETA/TypeCheck/TcType.hs
bsd-3-clause
isFlexi, isIndirect :: MetaDetails -> Bool isFlexi Flexi = True
63
isFlexi, isIndirect :: MetaDetails -> Bool isFlexi Flexi = True
63
isFlexi Flexi = True
20
false
true
0
5
9
20
11
9
null
null
csrhodes/pandoc
src/Text/Pandoc/Writers/CommonMark.hs
gpl-2.0
inlineToNodes (Span _ ils) = (inlinesToNodes ils ++)
52
inlineToNodes (Span _ ils) = (inlinesToNodes ils ++)
52
inlineToNodes (Span _ ils) = (inlinesToNodes ils ++)
52
false
false
0
7
7
24
12
12
null
null
svenkeidel/hsynth
src/Data/MidiFile.hs
bsd-3-clause
getVariableLengthQuantity :: Get Word32 getVariableLengthQuantity = go 0 where go acc = do w <- getWord8 let stop = w .&. 0b10000000 == 0 sevenBitData = w .&. 0b01111111 acc' = shiftL acc 7 + fromIntegral sevenBitData if stop then return acc' else go acc'
317
getVariableLengthQuantity :: Get Word32 getVariableLengthQuantity = go 0 where go acc = do w <- getWord8 let stop = w .&. 0b10000000 == 0 sevenBitData = w .&. 0b01111111 acc' = shiftL acc 7 + fromIntegral sevenBitData if stop then return acc' else go acc'
317
getVariableLengthQuantity = go 0 where go acc = do w <- getWord8 let stop = w .&. 0b10000000 == 0 sevenBitData = w .&. 0b01111111 acc' = shiftL acc 7 + fromIntegral sevenBitData if stop then return acc' else go acc'
277
false
true
0
11
106
94
45
49
null
null
facebookincubator/duckling
Duckling/Numeral/JA/Rules.hs
bsd-3-clause
ruleInteger7 :: Rule ruleInteger7 = Rule { name = "integer (200..900)" , pattern = [ numberBetween 2 10 , regex "百" ] , prod = \tokens -> case tokens of (Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 100 _ -> Nothing }
269
ruleInteger7 :: Rule ruleInteger7 = Rule { name = "integer (200..900)" , pattern = [ numberBetween 2 10 , regex "百" ] , prod = \tokens -> case tokens of (Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 100 _ -> Nothing }
269
ruleInteger7 = Rule { name = "integer (200..900)" , pattern = [ numberBetween 2 10 , regex "百" ] , prod = \tokens -> case tokens of (Token Numeral NumeralData{TNumeral.value = v}:_) -> double $ v * 100 _ -> Nothing }
248
false
true
0
17
76
107
55
52
null
null
raymoo/pins-ps
Pins/Handle/MonadAction/BotIO.hs
gpl-3.0
getStore :: String -> PermaStore -> String getStore k = M.findWithDefault [] k . permaStore
91
getStore :: String -> PermaStore -> String getStore k = M.findWithDefault [] k . permaStore
91
getStore k = M.findWithDefault [] k . permaStore
48
false
true
0
7
14
35
17
18
null
null
wangbj/hashing
src/Crypto/Hash/SHA512.hs
mit
sha512Init :: Context SHA512 sha512Init = Context 0 0 B.empty initHash
70
sha512Init :: Context SHA512 sha512Init = Context 0 0 B.empty initHash
70
sha512Init = Context 0 0 B.empty initHash
41
false
true
0
6
10
33
13
20
null
null
edsko/cabal
Cabal/src/Distribution/Simple/Build.hs
bsd-3-clause
replLib :: Verbosity -> PackageDescription -> LocalBuildInfo -> Library -> ComponentLocalBuildInfo -> IO () replLib verbosity pkg_descr lbi lib clbi = case compilerFlavor (compiler lbi) of -- 'cabal repl' doesn't need to support 'ghc --make -j', so we just pass -- NoFlag as the numJobs parameter. GHC -> GHC.replLib verbosity NoFlag pkg_descr lbi lib clbi GHCJS -> GHCJS.replLib verbosity NoFlag pkg_descr lbi lib clbi _ -> die "A REPL is not supported for this compiler."
535
replLib :: Verbosity -> PackageDescription -> LocalBuildInfo -> Library -> ComponentLocalBuildInfo -> IO () replLib verbosity pkg_descr lbi lib clbi = case compilerFlavor (compiler lbi) of -- 'cabal repl' doesn't need to support 'ghc --make -j', so we just pass -- NoFlag as the numJobs parameter. GHC -> GHC.replLib verbosity NoFlag pkg_descr lbi lib clbi GHCJS -> GHCJS.replLib verbosity NoFlag pkg_descr lbi lib clbi _ -> die "A REPL is not supported for this compiler."
535
replLib verbosity pkg_descr lbi lib clbi = case compilerFlavor (compiler lbi) of -- 'cabal repl' doesn't need to support 'ghc --make -j', so we just pass -- NoFlag as the numJobs parameter. GHC -> GHC.replLib verbosity NoFlag pkg_descr lbi lib clbi GHCJS -> GHCJS.replLib verbosity NoFlag pkg_descr lbi lib clbi _ -> die "A REPL is not supported for this compiler."
395
false
true
3
11
136
115
55
60
null
null
kelnage/tamarin-prover
lib/theory/src/Theory/Constraint/System.hs
gpl-3.0
normDG :: ProofContext -> System -> System normDG ctxt sys = L.set sNodes normalizedNodes sys where normalizedNodes = M.map (\r -> runReader (normRule r) (L.get pcMaudeHandle ctxt)) (L.get sNodes sys) -- | Returns the mirrored DG, if it exists.
251
normDG :: ProofContext -> System -> System normDG ctxt sys = L.set sNodes normalizedNodes sys where normalizedNodes = M.map (\r -> runReader (normRule r) (L.get pcMaudeHandle ctxt)) (L.get sNodes sys) -- | Returns the mirrored DG, if it exists.
251
normDG ctxt sys = L.set sNodes normalizedNodes sys where normalizedNodes = M.map (\r -> runReader (normRule r) (L.get pcMaudeHandle ctxt)) (L.get sNodes sys) -- | Returns the mirrored DG, if it exists.
208
false
true
0
11
45
92
45
47
null
null
sleepomeno/TForth
src/TF/Printer.hs
apache-2.0
infoNode = either infoForthWord infoExpr . view nodeIso
55
infoNode = either infoForthWord infoExpr . view nodeIso
55
infoNode = either infoForthWord infoExpr . view nodeIso
55
false
false
0
6
7
18
8
10
null
null
swift-nav/preamble
src/Preamble/Prelude.hs
mit
-- | Throw Exception on maybe nothing. -- maybeThrowIO :: (MonadIO m, Exception e) => e -> Maybe a -> m a maybeThrowIO e = maybe (liftIO $ throwIO e) pure
154
maybeThrowIO :: (MonadIO m, Exception e) => e -> Maybe a -> m a maybeThrowIO e = maybe (liftIO $ throwIO e) pure
112
maybeThrowIO e = maybe (liftIO $ throwIO e) pure
48
true
true
0
8
30
60
30
30
null
null
nevrenato/Hets_Fork
Common/AnnoState.hs
gpl-2.0
annosParser :: AParser st a -> AParser st [Annoted a] annosParser parser = do a <- annos l <- many1 $ pair parser annos let ps = map fst l as = map snd l is = zipWith addLeftAnno (a : init as) ps return (init is ++ [appendAnno (last is) (last as)]) {- | parse an item list preceded by a singular or plural keyword, interspersed with semicolons and an optional semicolon at the end -}
431
annosParser :: AParser st a -> AParser st [Annoted a] annosParser parser = do a <- annos l <- many1 $ pair parser annos let ps = map fst l as = map snd l is = zipWith addLeftAnno (a : init as) ps return (init is ++ [appendAnno (last is) (last as)]) {- | parse an item list preceded by a singular or plural keyword, interspersed with semicolons and an optional semicolon at the end -}
431
annosParser parser = do a <- annos l <- many1 $ pair parser annos let ps = map fst l as = map snd l is = zipWith addLeftAnno (a : init as) ps return (init is ++ [appendAnno (last is) (last as)]) {- | parse an item list preceded by a singular or plural keyword, interspersed with semicolons and an optional semicolon at the end -}
377
false
true
0
13
124
140
66
74
null
null
ssaavedra/liquidhaskell
src/Language/Haskell/Liquid/UX/Server.hs
bsd-3-clause
timeAction (Just _) _ = Rebuild
31
timeAction (Just _) _ = Rebuild
31
timeAction (Just _) _ = Rebuild
31
false
false
1
6
5
18
8
10
null
null
Tayacan/Vidar
Vidar/Match.hs
mit
matchElem (Name n1) (Name n2) = matchNames n1 n2
48
matchElem (Name n1) (Name n2) = matchNames n1 n2
48
matchElem (Name n1) (Name n2) = matchNames n1 n2
48
false
false
0
6
8
30
13
17
null
null
pseudonom/persistent
persistent-mysql/Database/Persist/MySQL.hs
mit
-- | Render an action that must be done on a column. showAlter :: DBName -> AlterColumn' -> String showAlter table (oldName, Change (Column n nu t def defConstraintName maxLen _ref)) = concat [ "ALTER TABLE " , escapeDBName table , " CHANGE " , escapeDBName oldName , " " , showColumn (Column n nu t def defConstraintName maxLen Nothing) ]
371
showAlter :: DBName -> AlterColumn' -> String showAlter table (oldName, Change (Column n nu t def defConstraintName maxLen _ref)) = concat [ "ALTER TABLE " , escapeDBName table , " CHANGE " , escapeDBName oldName , " " , showColumn (Column n nu t def defConstraintName maxLen Nothing) ]
318
showAlter table (oldName, Change (Column n nu t def defConstraintName maxLen _ref)) = concat [ "ALTER TABLE " , escapeDBName table , " CHANGE " , escapeDBName oldName , " " , showColumn (Column n nu t def defConstraintName maxLen Nothing) ]
272
true
true
0
9
92
100
52
48
null
null
pnlbwh/test-tensormasking
pipeline-lib/Pipeline/HCP/old/Preprocessing.hs
bsd-3-clause
posb0s :: FilePath posb0s = outdir </> "Pos_b0s.nii.gz"
55
posb0s :: FilePath posb0s = outdir </> "Pos_b0s.nii.gz"
55
posb0s = outdir </> "Pos_b0s.nii.gz"
36
false
true
0
6
7
22
9
13
null
null
psibi/yesod
yesod-bin/AddHandler.hs
mit
addHandler :: Maybe String -> Maybe String -> [String] -> IO () addHandler (Just route) pat met = do cabal <- getCabal checked <- checkRoute route cabal let routePair = case checked of Left err@EmptyRoute -> (error . show) err Left err@RouteCaseError -> (error . show) err Left err@(RouteExists _) -> (error . show) err Right p -> p addHandlerFiles cabal routePair pattern methods where pattern = fromMaybe "" pat -- pattern defaults to "" methods = unwords met -- methods default to none
560
addHandler :: Maybe String -> Maybe String -> [String] -> IO () addHandler (Just route) pat met = do cabal <- getCabal checked <- checkRoute route cabal let routePair = case checked of Left err@EmptyRoute -> (error . show) err Left err@RouteCaseError -> (error . show) err Left err@(RouteExists _) -> (error . show) err Right p -> p addHandlerFiles cabal routePair pattern methods where pattern = fromMaybe "" pat -- pattern defaults to "" methods = unwords met -- methods default to none
560
addHandler (Just route) pat met = do cabal <- getCabal checked <- checkRoute route cabal let routePair = case checked of Left err@EmptyRoute -> (error . show) err Left err@RouteCaseError -> (error . show) err Left err@(RouteExists _) -> (error . show) err Right p -> p addHandlerFiles cabal routePair pattern methods where pattern = fromMaybe "" pat -- pattern defaults to "" methods = unwords met -- methods default to none
496
false
true
1
16
155
209
97
112
null
null
gcampax/ghc
compiler/hsSyn/HsTypes.hs
bsd-3-clause
splitHsAppTys (L _ (HsParTy f)) as = splitHsAppTys f as
57
splitHsAppTys (L _ (HsParTy f)) as = splitHsAppTys f as
57
splitHsAppTys (L _ (HsParTy f)) as = splitHsAppTys f as
57
false
false
1
8
11
30
14
16
null
null
spechub/Hets
CMDL/DataTypesUtils.hs
gpl-2.0
getExitCodeInt :: CmdlState -> Int getExitCodeInt = errorCode
61
getExitCodeInt :: CmdlState -> Int getExitCodeInt = errorCode
61
getExitCodeInt = errorCode
26
false
true
0
5
7
15
8
7
null
null
PierreR/basic-prelude
test-is-a-prelude.hs
mit
sequence = P.sequence
21
sequence = P.sequence
21
sequence = P.sequence
21
false
false
0
5
2
8
4
4
null
null
erikd/persistent
persistent/Database/Persist/Sql/Class.hs
mit
extractMaybe :: Maybe a -> a extractMaybe = fromMaybe (error "Database.Persist.GenericSql.extractMaybe")
104
extractMaybe :: Maybe a -> a extractMaybe = fromMaybe (error "Database.Persist.GenericSql.extractMaybe")
104
extractMaybe = fromMaybe (error "Database.Persist.GenericSql.extractMaybe")
75
false
true
0
7
10
27
13
14
null
null
konn/hskk
cocoa/AppDelegate.hs
bsd-3-clause
tag2Kind 1 = Local
18
tag2Kind 1 = Local
18
tag2Kind 1 = Local
18
false
false
0
5
3
9
4
5
null
null
CoryXie/BarrelfishOS
tools/flounder/UMPCommon.hs
mit
tx_cap_handler :: UMPParams -> String -> [MsgSpec] -> C.Unit tx_cap_handler p ifn msgspecs = C.FunctionDef C.Static C.Void (tx_cap_handler_name p ifn) [C.Param (C.Ptr C.Void) "arg"] [ handler_preamble p ifn, C.Ex $ C.Call "assert" [capst `C.FieldOf` "rx_cap_ack"], C.Ex $ C.Call "assert" [capst `C.FieldOf` "monitor_mutex_held"], C.SBlank, C.SComment "Switch on current outgoing message", C.Switch (C.DerefField bindvar "tx_msgnum") cases [C.Ex $ C.Call "assert" [C.Unary C.Not $ C.StringConstant "invalid message number"], report_user_err (C.Variable "FLOUNDER_ERR_INVALID_STATE")] ] where umpst = C.DerefField my_bindvar "ump_state" capst = umpst `C.FieldOf` "capst" cases = [C.Case (C.Variable $ msg_enum_elem_name ifn mn) (tx_cap_handler_case p ifn mn (length frags) caps) | MsgSpec mn frags caps <- msgspecs, caps /= []]
998
tx_cap_handler :: UMPParams -> String -> [MsgSpec] -> C.Unit tx_cap_handler p ifn msgspecs = C.FunctionDef C.Static C.Void (tx_cap_handler_name p ifn) [C.Param (C.Ptr C.Void) "arg"] [ handler_preamble p ifn, C.Ex $ C.Call "assert" [capst `C.FieldOf` "rx_cap_ack"], C.Ex $ C.Call "assert" [capst `C.FieldOf` "monitor_mutex_held"], C.SBlank, C.SComment "Switch on current outgoing message", C.Switch (C.DerefField bindvar "tx_msgnum") cases [C.Ex $ C.Call "assert" [C.Unary C.Not $ C.StringConstant "invalid message number"], report_user_err (C.Variable "FLOUNDER_ERR_INVALID_STATE")] ] where umpst = C.DerefField my_bindvar "ump_state" capst = umpst `C.FieldOf` "capst" cases = [C.Case (C.Variable $ msg_enum_elem_name ifn mn) (tx_cap_handler_case p ifn mn (length frags) caps) | MsgSpec mn frags caps <- msgspecs, caps /= []]
998
tx_cap_handler p ifn msgspecs = C.FunctionDef C.Static C.Void (tx_cap_handler_name p ifn) [C.Param (C.Ptr C.Void) "arg"] [ handler_preamble p ifn, C.Ex $ C.Call "assert" [capst `C.FieldOf` "rx_cap_ack"], C.Ex $ C.Call "assert" [capst `C.FieldOf` "monitor_mutex_held"], C.SBlank, C.SComment "Switch on current outgoing message", C.Switch (C.DerefField bindvar "tx_msgnum") cases [C.Ex $ C.Call "assert" [C.Unary C.Not $ C.StringConstant "invalid message number"], report_user_err (C.Variable "FLOUNDER_ERR_INVALID_STATE")] ] where umpst = C.DerefField my_bindvar "ump_state" capst = umpst `C.FieldOf` "capst" cases = [C.Case (C.Variable $ msg_enum_elem_name ifn mn) (tx_cap_handler_case p ifn mn (length frags) caps) | MsgSpec mn frags caps <- msgspecs, caps /= []]
937
false
true
2
14
277
331
168
163
null
null
passy/hls-proxy
src/Lib/HLS/Parse.hs
bsd-3-clause
parseHlsPlaylist :: T.Text -> Either ParseError HLSPlaylist parseHlsPlaylist = M.parse (hlsPlaylistParser <* M.eof) ""
118
parseHlsPlaylist :: T.Text -> Either ParseError HLSPlaylist parseHlsPlaylist = M.parse (hlsPlaylistParser <* M.eof) ""
118
parseHlsPlaylist = M.parse (hlsPlaylistParser <* M.eof) ""
58
false
true
0
8
13
38
19
19
null
null
dec9ue/jhc_copygc
src/Ho/Library.hs
gpl-2.0
libModMap = hoModuleMap . libHoLib
34
libModMap = hoModuleMap . libHoLib
34
libModMap = hoModuleMap . libHoLib
34
false
false
0
5
4
10
5
5
null
null
nomeata/ghc
compiler/codeGen/CgPrimOp.hs
bsd-3-clause
-- WriteXXXoffAddr emitPrimOp res WriteOffAddrOp_Char args _ = doWriteOffAddrOp (Just mo_WordTo8) b8 res args
116
emitPrimOp res WriteOffAddrOp_Char args _ = doWriteOffAddrOp (Just mo_WordTo8) b8 res args
96
emitPrimOp res WriteOffAddrOp_Char args _ = doWriteOffAddrOp (Just mo_WordTo8) b8 res args
96
true
false
0
7
20
34
15
19
null
null
ambiata/highlighting-kate
Text/Highlighting/Kate/Syntax/Email.hs
gpl-2.0
regex_'5bCc'5d'5bCc'5d'3a'2e'2a'24 = compileRegex False "[Cc][Cc]:.*$"
70
regex_'5bCc'5d'5bCc'5d'3a'2e'2a'24 = compileRegex False "[Cc][Cc]:.*$"
70
regex_'5bCc'5d'5bCc'5d'3a'2e'2a'24 = compileRegex False "[Cc][Cc]:.*$"
70
false
false
0
5
4
11
5
6
null
null
beni55/hermit
src/HERMIT/Dictionary/Fold.hs
bsd-2-clause
-- | Build an equality from a list of universally quantified binders and two expressions. -- If the head of either expression is a lambda expression, it's binder will become a universally quantified binder -- over both sides. It is assumed the two expressions have the same type. -- -- Ex. mkEquality [] (\x. foo x) bar === forall x. foo x = bar x -- mkEquality [] (baz y z) (\x. foo x x) === forall x. baz y z x = foo x x -- mkEquality [] (\x. foo x) (\y. bar y) === forall x. foo x = bar x mkEquality :: [CoreBndr] -> CoreExpr -> CoreExpr -> Equality mkEquality vs lhs rhs = Equality vs' lhs' rhs' where (vs', Equiv lhs' rhs') = collectQs $ mkClause vs lhs rhs
683
mkEquality :: [CoreBndr] -> CoreExpr -> CoreExpr -> Equality mkEquality vs lhs rhs = Equality vs' lhs' rhs' where (vs', Equiv lhs' rhs') = collectQs $ mkClause vs lhs rhs
174
mkEquality vs lhs rhs = Equality vs' lhs' rhs' where (vs', Equiv lhs' rhs') = collectQs $ mkClause vs lhs rhs
113
true
true
0
8
153
77
42
35
null
null
brendanhay/khan
khan/Khan/Internal/Options.hs
mpl-2.0
trustOption :: Parser TrustPath trustOption = TrustPath <$> pathOption "trust" (value "") "Trust relationship file."
121
trustOption :: Parser TrustPath trustOption = TrustPath <$> pathOption "trust" (value "") "Trust relationship file."
121
trustOption = TrustPath <$> pathOption "trust" (value "") "Trust relationship file."
89
false
true
0
8
19
32
15
17
null
null
tekul/cryptonite
Crypto/Cipher/Types/Block.hs
bsd-3-clause
ivAdd :: BlockCipher c => IV c -> Int -> IV c ivAdd (IV b) i = IV $ copy b where copy :: ByteArray bs => bs -> bs copy bs = B.copyAndFreeze bs $ loop i (B.length bs - 1) loop :: Int -> Int -> Ptr Word8 -> IO () loop acc ofs p | ofs < 0 = return () | otherwise = do v <- peek (p `plusPtr` ofs) :: IO Word8 let accv = acc + fromIntegral v (hi,lo) = accv `divMod` 256 poke (p `plusPtr` ofs) (fromIntegral lo :: Word8) loop hi (ofs - 1) p
574
ivAdd :: BlockCipher c => IV c -> Int -> IV c ivAdd (IV b) i = IV $ copy b where copy :: ByteArray bs => bs -> bs copy bs = B.copyAndFreeze bs $ loop i (B.length bs - 1) loop :: Int -> Int -> Ptr Word8 -> IO () loop acc ofs p | ofs < 0 = return () | otherwise = do v <- peek (p `plusPtr` ofs) :: IO Word8 let accv = acc + fromIntegral v (hi,lo) = accv `divMod` 256 poke (p `plusPtr` ofs) (fromIntegral lo :: Word8) loop hi (ofs - 1) p
574
ivAdd (IV b) i = IV $ copy b where copy :: ByteArray bs => bs -> bs copy bs = B.copyAndFreeze bs $ loop i (B.length bs - 1) loop :: Int -> Int -> Ptr Word8 -> IO () loop acc ofs p | ofs < 0 = return () | otherwise = do v <- peek (p `plusPtr` ofs) :: IO Word8 let accv = acc + fromIntegral v (hi,lo) = accv `divMod` 256 poke (p `plusPtr` ofs) (fromIntegral lo :: Word8) loop hi (ofs - 1) p
528
false
true
17
10
242
241
122
119
null
null
jgm/pandoc-citeproc
src/Text/CSL/Parser.hs
bsd-3-clause
readCSLFile :: Maybe Text -> FilePath -> IO Style readCSLFile mbLocale src = do csldir <- getAppUserDataDirectory "csl" mbSrc <- findFile [".", csldir] src fetchRes <- fetchItem (fromMaybe src mbSrc) f <- case fetchRes of Left err -> E.throwIO err Right (rawbs, _) -> return $ L.fromChunks [rawbs] let cur = fromDocument $ X.parseLBS_ X.def f -- see if it's a dependent style, and if so, try to fetch its parent: let pickParentCur = get "link" >=> attributeIs (X.Name "rel" Nothing Nothing) "independent-parent" let parentCur = cur $/ get "info" &/ pickParentCur let parent' = T.concat $ map (stringAttr "href") parentCur when (parent' == T.pack src) $ E.throwIO $ DependentStyleHasItselfAsParent src case parent' of "" -> localizeCSL mbLocale $ parseCSLCursor cur y -> do -- note, we insert locale from the dependent style: let mbLocale' = case stringAttr "default-locale" cur of "" -> mbLocale x -> Just x readCSLFile mbLocale' (T.unpack y)
1,119
readCSLFile :: Maybe Text -> FilePath -> IO Style readCSLFile mbLocale src = do csldir <- getAppUserDataDirectory "csl" mbSrc <- findFile [".", csldir] src fetchRes <- fetchItem (fromMaybe src mbSrc) f <- case fetchRes of Left err -> E.throwIO err Right (rawbs, _) -> return $ L.fromChunks [rawbs] let cur = fromDocument $ X.parseLBS_ X.def f -- see if it's a dependent style, and if so, try to fetch its parent: let pickParentCur = get "link" >=> attributeIs (X.Name "rel" Nothing Nothing) "independent-parent" let parentCur = cur $/ get "info" &/ pickParentCur let parent' = T.concat $ map (stringAttr "href") parentCur when (parent' == T.pack src) $ E.throwIO $ DependentStyleHasItselfAsParent src case parent' of "" -> localizeCSL mbLocale $ parseCSLCursor cur y -> do -- note, we insert locale from the dependent style: let mbLocale' = case stringAttr "default-locale" cur of "" -> mbLocale x -> Just x readCSLFile mbLocale' (T.unpack y)
1,119
readCSLFile mbLocale src = do csldir <- getAppUserDataDirectory "csl" mbSrc <- findFile [".", csldir] src fetchRes <- fetchItem (fromMaybe src mbSrc) f <- case fetchRes of Left err -> E.throwIO err Right (rawbs, _) -> return $ L.fromChunks [rawbs] let cur = fromDocument $ X.parseLBS_ X.def f -- see if it's a dependent style, and if so, try to fetch its parent: let pickParentCur = get "link" >=> attributeIs (X.Name "rel" Nothing Nothing) "independent-parent" let parentCur = cur $/ get "info" &/ pickParentCur let parent' = T.concat $ map (stringAttr "href") parentCur when (parent' == T.pack src) $ E.throwIO $ DependentStyleHasItselfAsParent src case parent' of "" -> localizeCSL mbLocale $ parseCSLCursor cur y -> do -- note, we insert locale from the dependent style: let mbLocale' = case stringAttr "default-locale" cur of "" -> mbLocale x -> Just x readCSLFile mbLocale' (T.unpack y)
1,069
false
true
3
18
328
330
157
173
null
null
ygale/yesod
yesod-core/Yesod/Core/Class/Yesod.hs
mit
left _ = Nothing
16
left _ = Nothing
16
left _ = Nothing
16
false
false
0
5
3
9
4
5
null
null
noteed/humming
tests/Tests.hs
bsd-3-clause
---------------------------------------------------------------------- -- Tests ---------------------------------------------------------------------- emptyCount :: String -> IO () emptyCount connectionString = do output <- doCount connectionString assertEqual "The queue must be empty" "0\n" output output <- doCountQueue connectionString "FOO" assertEqual "The queue must be empty" "0\n" output
406
emptyCount :: String -> IO () emptyCount connectionString = do output <- doCount connectionString assertEqual "The queue must be empty" "0\n" output output <- doCountQueue connectionString "FOO" assertEqual "The queue must be empty" "0\n" output
254
emptyCount connectionString = do output <- doCount connectionString assertEqual "The queue must be empty" "0\n" output output <- doCountQueue connectionString "FOO" assertEqual "The queue must be empty" "0\n" output
224
true
true
0
8
48
68
31
37
null
null
suzumiyasmith/Hipmunk-Utils
src/Physics/Hipmunk/Utils.hs
bsd-3-clause
getVelocity :: Body -> IO (V2 Double) getVelocity b = do (Vector x y) <- get $ velocity b return $ V2 x y
109
getVelocity :: Body -> IO (V2 Double) getVelocity b = do (Vector x y) <- get $ velocity b return $ V2 x y
109
getVelocity b = do (Vector x y) <- get $ velocity b return $ V2 x y
71
false
true
0
9
27
61
28
33
null
null
Raveline/FQuoter
src/FQuoter/Main.hs
gpl-3.0
interpreter :: InputT IO () interpreter = do args <- liftIO getArgs config <- liftIO readConfig case parseInput(unwords args) of Left s -> outputStrLn $ show s Right c -> executeCommand config c
270
interpreter :: InputT IO () interpreter = do args <- liftIO getArgs config <- liftIO readConfig case parseInput(unwords args) of Left s -> outputStrLn $ show s Right c -> executeCommand config c
270
interpreter = do args <- liftIO getArgs config <- liftIO readConfig case parseInput(unwords args) of Left s -> outputStrLn $ show s Right c -> executeCommand config c
242
false
true
0
11
108
84
37
47
null
null
brendanhay/gogol
gogol-adexchangebuyer2/gen/Network/Google/Resource/AdExchangeBuyer2/Accounts/Creatives/StopWatching.hs
mpl-2.0
-- | Multipart request metadata. acswPayload :: Lens' AccountsCreativesStopWatching StopWatchingCreativeRequest acswPayload = lens _acswPayload (\ s a -> s{_acswPayload = a})
176
acswPayload :: Lens' AccountsCreativesStopWatching StopWatchingCreativeRequest acswPayload = lens _acswPayload (\ s a -> s{_acswPayload = a})
143
acswPayload = lens _acswPayload (\ s a -> s{_acswPayload = a})
64
true
true
1
9
22
46
22
24
null
null
eryx67/haskell-libtorrent
src/Network/Libtorrent/Session/DhtSettings.hs
bsd-3-clause
setMaxFailCount :: MonadIO m => DhtSettings -> CInt -> m () setMaxFailCount ho val = liftIO . withPtr ho $ \hoPtr -> [CU.exp| void { $(dht_settings * hoPtr)->max_fail_count = $(int val)} |]
194
setMaxFailCount :: MonadIO m => DhtSettings -> CInt -> m () setMaxFailCount ho val = liftIO . withPtr ho $ \hoPtr -> [CU.exp| void { $(dht_settings * hoPtr)->max_fail_count = $(int val)} |]
194
setMaxFailCount ho val = liftIO . withPtr ho $ \hoPtr -> [CU.exp| void { $(dht_settings * hoPtr)->max_fail_count = $(int val)} |]
133
false
true
0
9
36
58
30
28
null
null
hpacheco/HAAP
src/HAAP/Template.hs
mit
shLoadAndApplyTemplate :: HaapContext -> FilePath -> Sh Text.Text shLoadAndApplyTemplate ctx from = do txt::Text.Text <- Sh.readfile (shFromFilePath from) let tplt::T.Template = T.template txt let ctx' :: T.Context = unHaapConText ctx let txt'::TextL.Text = T.render tplt ctx' return (TextL.toStrict txt')
325
shLoadAndApplyTemplate :: HaapContext -> FilePath -> Sh Text.Text shLoadAndApplyTemplate ctx from = do txt::Text.Text <- Sh.readfile (shFromFilePath from) let tplt::T.Template = T.template txt let ctx' :: T.Context = unHaapConText ctx let txt'::TextL.Text = T.render tplt ctx' return (TextL.toStrict txt')
325
shLoadAndApplyTemplate ctx from = do txt::Text.Text <- Sh.readfile (shFromFilePath from) let tplt::T.Template = T.template txt let ctx' :: T.Context = unHaapConText ctx let txt'::TextL.Text = T.render tplt ctx' return (TextL.toStrict txt')
259
false
true
0
11
58
130
58
72
null
null
awto/pretty-template
examples/First.hs
bsd-3-clause
{- test1 :: Val test1 = obj [ "imports" =: Arr [ c "java.com", c "java.class" ], "name" =: c "TestClasS", "parent" =: c "ParrenatS", "members" =: Arr [ "field" :@ obj [ "visibility" =: c "private", "type" =: c "int", "name" =: c "myvara\n- 2" ], "method" :@ obj [ "visibility" =: c "public", "type" =: c "int", "name" =: c "getMyvara", "args" =: Arr [], -- TODO: body as Doc "body" =: c "return myvara;" ], "method" :@ obj [ "visibility" =: c "public", "type" =: c "void", "name" =: c "setMyvara", "args" =: Arr [ obj [ "type" =: c "int", "name" =: c "v" ] ], "body" =: c "myvara = v;" ] ] ] -} main :: IO () main = outputTemplateError (T.putStrLn =<< applyFileTemplate "test1.pt" test1)
1,834
main :: IO () main = outputTemplateError (T.putStrLn =<< applyFileTemplate "test1.pt" test1)
92
main = outputTemplateError (T.putStrLn =<< applyFileTemplate "test1.pt" test1)
78
true
true
1
8
1,278
37
17
20
null
null
siddhanathan/yi
yi-language/src/Yi/Utils.hs
gpl-2.0
mapAdjust' :: (Ord k) => (a -> a) -> k -> Map.Map k a -> Map.Map k a mapAdjust' f = Map.alter f' where f' Nothing = Nothing f' (Just x) = let x' = f x in x' `seq` Just x' -- This works because Map is structure-strict, and alter needs to force f' to compute -- the structure. -- | Generalisation of 'Map.fromList' to arbitrary foldables.
353
mapAdjust' :: (Ord k) => (a -> a) -> k -> Map.Map k a -> Map.Map k a mapAdjust' f = Map.alter f' where f' Nothing = Nothing f' (Just x) = let x' = f x in x' `seq` Just x' -- This works because Map is structure-strict, and alter needs to force f' to compute -- the structure. -- | Generalisation of 'Map.fromList' to arbitrary foldables.
353
mapAdjust' f = Map.alter f' where f' Nothing = Nothing f' (Just x) = let x' = f x in x' `seq` Just x' -- This works because Map is structure-strict, and alter needs to force f' to compute -- the structure. -- | Generalisation of 'Map.fromList' to arbitrary foldables.
284
false
true
0
11
84
115
57
58
null
null
cbaatz/hamu8080
src/Hamu8080/Compute.hs
mit
doOp 0xEB = do -- XCHG HL, DE hl <- getRegPair HL getRegPair DE >>= setRegPair HL setRegPair DE hl -- Return, Call, and Jump instructions
144
doOp 0xEB = do -- XCHG HL, DE hl <- getRegPair HL getRegPair DE >>= setRegPair HL setRegPair DE hl -- Return, Call, and Jump instructions
144
doOp 0xEB = do -- XCHG HL, DE hl <- getRegPair HL getRegPair DE >>= setRegPair HL setRegPair DE hl -- Return, Call, and Jump instructions
144
false
false
0
8
32
42
18
24
null
null
atsukotakahashi/wi
src/library/Yi/UI/SimpleLayout.hs
gpl-2.0
coordsOfCharacterB (Size2D w h) (Point topLeft) (Point char) = savingPointB $ do ts <- fmap tabSize indentSettingsB text <- fmap (R.toString . R.take (w * h)) (streamB Forward (Point topLeft)) let go !x !y n t | x >= w = go (x - w) (y + 1) n t go _ !y _ _ | y >= h = Nothing go !x !y 0 _ = Just (Point2D x y) go !x !y !n (c : t) = case c of '\t' -> go (x + ts) y (n - 1) t '\n' -> go 0 (y + 1) (n - 1) t _ -> go (x + 1) y (n - 1) t go !x !y _ _ = Just (Point2D x y) return (go 0 0 (char - topLeft) text)
612
coordsOfCharacterB (Size2D w h) (Point topLeft) (Point char) = savingPointB $ do ts <- fmap tabSize indentSettingsB text <- fmap (R.toString . R.take (w * h)) (streamB Forward (Point topLeft)) let go !x !y n t | x >= w = go (x - w) (y + 1) n t go _ !y _ _ | y >= h = Nothing go !x !y 0 _ = Just (Point2D x y) go !x !y !n (c : t) = case c of '\t' -> go (x + ts) y (n - 1) t '\n' -> go 0 (y + 1) (n - 1) t _ -> go (x + 1) y (n - 1) t go !x !y _ _ = Just (Point2D x y) return (go 0 0 (char - topLeft) text)
612
coordsOfCharacterB (Size2D w h) (Point topLeft) (Point char) = savingPointB $ do ts <- fmap tabSize indentSettingsB text <- fmap (R.toString . R.take (w * h)) (streamB Forward (Point topLeft)) let go !x !y n t | x >= w = go (x - w) (y + 1) n t go _ !y _ _ | y >= h = Nothing go !x !y 0 _ = Just (Point2D x y) go !x !y !n (c : t) = case c of '\t' -> go (x + ts) y (n - 1) t '\n' -> go 0 (y + 1) (n - 1) t _ -> go (x + 1) y (n - 1) t go !x !y _ _ = Just (Point2D x y) return (go 0 0 (char - topLeft) text)
612
false
false
1
17
241
372
175
197
null
null
konn/presburger-dfa
src/Arithmetic/Presburger/Solver/DFA.hs
bsd-3-clause
liftFormula :: Formula e -> Formula 'Extended liftFormula = unsafeCoerce
72
liftFormula :: Formula e -> Formula 'Extended liftFormula = unsafeCoerce
72
liftFormula = unsafeCoerce
26
false
true
0
8
9
29
12
17
null
null
shlevy/ghc
compiler/prelude/TysWiredIn.hs
bsd-3-clause
unitTy :: Type unitTy = mkTupleTy Boxed []
42
unitTy :: Type unitTy = mkTupleTy Boxed []
42
unitTy = mkTupleTy Boxed []
27
false
true
0
6
7
18
9
9
null
null
tjakway/ghcjvm
includes/CodeGen.Platform.hs
bsd-3-clause
globalRegMaybe (LongReg 2) = Just (RealRegSingle REG_Lng2)
71
globalRegMaybe (LongReg 2) = Just (RealRegSingle REG_Lng2)
71
globalRegMaybe (LongReg 2) = Just (RealRegSingle REG_Lng2)
71
false
false
0
7
19
24
11
13
null
null
abramhindle/haskell-sand-game
Sand2.hs
lgpl-3.0
drawElm s None screen i j = return True
40
drawElm s None screen i j = return True
40
drawElm s None screen i j = return True
40
false
false
0
5
9
21
9
12
null
null
BarrelfishOS/barrelfish
tools/mackerel/CSyntax.hs
mit
s >: (x:xs) = (s ++ " " ++ x) : xs
34
s >: (x:xs) = (s ++ " " ++ x) : xs
34
s >: (x:xs) = (s ++ " " ++ x) : xs
34
false
false
2
8
11
35
17
18
null
null
yesodweb/css-text
src/Text/CSS/Parse.hs
mit
attrParser :: Parser (Text, Text) attrParser = do skipWS key <- takeWhile1 (\c -> c /= ':' && c /= '{' && c /= '}') _ <- char ':' <|> fail "Missing colon in attribute" value <- valueParser return (strip key, strip value)
240
attrParser :: Parser (Text, Text) attrParser = do skipWS key <- takeWhile1 (\c -> c /= ':' && c /= '{' && c /= '}') _ <- char ':' <|> fail "Missing colon in attribute" value <- valueParser return (strip key, strip value)
240
attrParser = do skipWS key <- takeWhile1 (\c -> c /= ':' && c /= '{' && c /= '}') _ <- char ':' <|> fail "Missing colon in attribute" value <- valueParser return (strip key, strip value)
206
false
true
0
15
62
103
49
54
null
null
mainland/nikola
src/Data/Vector/UnboxedForeign.hs
bsd-3-clause
maximumBy = G.maximumBy
23
maximumBy = G.maximumBy
23
maximumBy = G.maximumBy
23
false
false
0
5
2
8
4
4
null
null
Bodigrim/katas
src/haskell/5-Where-my-anagrams-at.hs
bsd-2-clause
anagrams :: String -> [String] -> [String] anagrams w = filter ((== w') . sort) where w' = sort w
97
anagrams :: String -> [String] -> [String] anagrams w = filter ((== w') . sort) where w' = sort w
97
anagrams w = filter ((== w') . sort) where w' = sort w
54
false
true
0
8
19
52
28
24
null
null
rueshyna/gogol
gogol-slides/gen/Network/Google/Slides/Types/Product.hs
mpl-2.0
-- | If set, this request will replace all of the shapes that contain the -- given text. raswirContainsText :: Lens' ReplaceAllShapesWithImageRequest (Maybe SubstringMatchCriteria) raswirContainsText = lens _raswirContainsText (\ s a -> s{_raswirContainsText = a})
272
raswirContainsText :: Lens' ReplaceAllShapesWithImageRequest (Maybe SubstringMatchCriteria) raswirContainsText = lens _raswirContainsText (\ s a -> s{_raswirContainsText = a})
183
raswirContainsText = lens _raswirContainsText (\ s a -> s{_raswirContainsText = a})
91
true
true
0
9
42
49
26
23
null
null
conal/reify-core
src/ReifyCore/Reify.hs
bsd-3-clause
nowatchR :: InCoreTC a => String -> RewriteH a -> RewriteH a nowatchR _ = id
76
nowatchR :: InCoreTC a => String -> RewriteH a -> RewriteH a nowatchR _ = id
76
nowatchR _ = id
15
false
true
0
8
15
39
17
22
null
null
DanielOberg/case-in-point
CaseInPoint.hs
bsd-3-clause
test :: FilePath -> IO [Maybe String] test f = do contents <- readFile f let regex = "(?sx) [\\s]* -- [\\s]+ >+ (.+?) -- [\\s]* \\n" let matches = (contents =~ regex) :: [[String]] mapM (tryTestCase f . breakIntoTestCase . last) matches -- | Tries to run the test case -- -- f - filepath to the module in which the example will run -- (example, expected_result) - tuple with the string to be run and its expected value -- -- Returns Nothing if correct otherwise it returns a descriptive string with the error.
518
test :: FilePath -> IO [Maybe String] test f = do contents <- readFile f let regex = "(?sx) [\\s]* -- [\\s]+ >+ (.+?) -- [\\s]* \\n" let matches = (contents =~ regex) :: [[String]] mapM (tryTestCase f . breakIntoTestCase . last) matches -- | Tries to run the test case -- -- f - filepath to the module in which the example will run -- (example, expected_result) - tuple with the string to be run and its expected value -- -- Returns Nothing if correct otherwise it returns a descriptive string with the error.
518
test f = do contents <- readFile f let regex = "(?sx) [\\s]* -- [\\s]+ >+ (.+?) -- [\\s]* \\n" let matches = (contents =~ regex) :: [[String]] mapM (tryTestCase f . breakIntoTestCase . last) matches -- | Tries to run the test case -- -- f - filepath to the module in which the example will run -- (example, expected_result) - tuple with the string to be run and its expected value -- -- Returns Nothing if correct otherwise it returns a descriptive string with the error.
480
false
true
0
11
103
99
51
48
null
null
jtapolczai/Hephaestos
Crawling/Hephaestos/Transform.hs
apache-2.0
structureByKey' :: Transformation structureByKey' = structureByKey "title"
74
structureByKey' :: Transformation structureByKey' = structureByKey "title"
74
structureByKey' = structureByKey "title"
40
false
true
0
5
6
14
7
7
null
null
keera-studios/hsQt
Qtc/Enums/Core/QAbstractFileEngine.hs
bsd-2-clause
eExistsFlag :: FileFlag eExistsFlag = ieFileFlag $ 4194304
60
eExistsFlag :: FileFlag eExistsFlag = ieFileFlag $ 4194304
60
eExistsFlag = ieFileFlag $ 4194304
36
false
true
0
6
9
18
8
10
null
null
bgamari/pandoc
src/Text/Pandoc/Writers/FB2.hs
gpl-2.0
fetchURL :: String -> IO (Maybe (String, String)) fetchURL url = do flip catchIO_ (return Nothing) $ do r <- browse $ do setOutHandler (const (return ())) setAllowRedirects True liftM snd . request . getRequest $ url let content_type = lookupHeader HdrContentType (getHeaders r) content <- liftM (Just . toStr . encode . toBS) . getResponseBody $ Right r return $ liftM2 (,) content_type content
450
fetchURL :: String -> IO (Maybe (String, String)) fetchURL url = do flip catchIO_ (return Nothing) $ do r <- browse $ do setOutHandler (const (return ())) setAllowRedirects True liftM snd . request . getRequest $ url let content_type = lookupHeader HdrContentType (getHeaders r) content <- liftM (Just . toStr . encode . toBS) . getResponseBody $ Right r return $ liftM2 (,) content_type content
450
fetchURL url = do flip catchIO_ (return Nothing) $ do r <- browse $ do setOutHandler (const (return ())) setAllowRedirects True liftM snd . request . getRequest $ url let content_type = lookupHeader HdrContentType (getHeaders r) content <- liftM (Just . toStr . encode . toBS) . getResponseBody $ Right r return $ liftM2 (,) content_type content
400
false
true
0
21
119
180
83
97
null
null
rvion/ride
web-playground/src/Forms.hs
bsd-3-clause
minMaxLen :: (Int, Int) -> Text -> Result HTML Text minMaxLen (minLen, maxLen) t = if len >= minLen && len <= maxLen then Success stripped else Error $ toHtml $ "Must be longer than " ++ show minLen ++ " and shorter than " ++ show maxLen ++ " characters" where stripped = T.strip t len = T.length stripped
321
minMaxLen :: (Int, Int) -> Text -> Result HTML Text minMaxLen (minLen, maxLen) t = if len >= minLen && len <= maxLen then Success stripped else Error $ toHtml $ "Must be longer than " ++ show minLen ++ " and shorter than " ++ show maxLen ++ " characters" where stripped = T.strip t len = T.length stripped
321
minMaxLen (minLen, maxLen) t = if len >= minLen && len <= maxLen then Success stripped else Error $ toHtml $ "Must be longer than " ++ show minLen ++ " and shorter than " ++ show maxLen ++ " characters" where stripped = T.strip t len = T.length stripped
269
false
true
6
9
75
130
60
70
null
null
rahulmutt/ghcvm
compiler/Eta/StrAnal/DmdAnal.hs
bsd-3-clause
unpackTrivial :: CoreExpr -> Maybe Id -- Returns (Just v) if the arg is really equal to v, modulo -- casts, type applications etc -- See Note [Demand analysis for trivial right-hand sides] unpackTrivial (Var v) = Just v
235
unpackTrivial :: CoreExpr -> Maybe Id unpackTrivial (Var v) = Just v
84
unpackTrivial (Var v) = Just v
46
true
true
0
7
54
33
17
16
null
null
frantisekfarka/ghc-dsi
ghc/Main.hs
bsd-3-clause
dumpFastStringStats :: DynFlags -> IO () dumpFastStringStats dflags = do buckets <- getFastStringTable let (entries, longest, has_z) = countFS 0 0 0 buckets msg = text "FastString stats:" $$ nest 4 (vcat [text "size: " <+> int (length buckets), text "entries: " <+> int entries, text "longest chain: " <+> int longest, text "has z-encoding: " <+> (has_z `pcntOf` entries) ]) -- we usually get more "has z-encoding" than "z-encoded", because -- when we z-encode a string it might hash to the exact same string, -- which will is not counted as "z-encoded". Only strings whose -- Z-encoding is different from the original string are counted in -- the "z-encoded" total. putMsg dflags msg where x `pcntOf` y = int ((x * 100) `quot` y) <> char '%'
933
dumpFastStringStats :: DynFlags -> IO () dumpFastStringStats dflags = do buckets <- getFastStringTable let (entries, longest, has_z) = countFS 0 0 0 buckets msg = text "FastString stats:" $$ nest 4 (vcat [text "size: " <+> int (length buckets), text "entries: " <+> int entries, text "longest chain: " <+> int longest, text "has z-encoding: " <+> (has_z `pcntOf` entries) ]) -- we usually get more "has z-encoding" than "z-encoded", because -- when we z-encode a string it might hash to the exact same string, -- which will is not counted as "z-encoded". Only strings whose -- Z-encoding is different from the original string are counted in -- the "z-encoded" total. putMsg dflags msg where x `pcntOf` y = int ((x * 100) `quot` y) <> char '%'
933
dumpFastStringStats dflags = do buckets <- getFastStringTable let (entries, longest, has_z) = countFS 0 0 0 buckets msg = text "FastString stats:" $$ nest 4 (vcat [text "size: " <+> int (length buckets), text "entries: " <+> int entries, text "longest chain: " <+> int longest, text "has z-encoding: " <+> (has_z `pcntOf` entries) ]) -- we usually get more "has z-encoding" than "z-encoded", because -- when we z-encode a string it might hash to the exact same string, -- which will is not counted as "z-encoded". Only strings whose -- Z-encoding is different from the original string are counted in -- the "z-encoded" total. putMsg dflags msg where x `pcntOf` y = int ((x * 100) `quot` y) <> char '%'
892
false
true
0
18
318
200
101
99
null
null
danr/hipspec
examples/Challenges/Integers.hs
gpl-3.0
P m +. N n = m - S n
20
P m +. N n = m - S n
20
P m +. N n = m - S n
20
false
false
0
6
9
25
10
15
null
null
PierreR/vCloudApi
src/VCloud/Namespace.hs
bsd-3-clause
nsName :: Text -> Text -> XML.Name nsName ns n = XML.Name n (Just ns) Nothing
77
nsName :: Text -> Text -> XML.Name nsName ns n = XML.Name n (Just ns) Nothing
77
nsName ns n = XML.Name n (Just ns) Nothing
42
false
true
0
7
15
41
20
21
null
null
QuickChick/Luck
luck/src/Core/Optimizations.hs
mit
origInlinerState :: Map VarId String -> Map ConId String -> Int -> Int -> FMap -> R origInlinerState vrev crev step rolls fmap = R { _fenv = Map.map (rolls,) fmap , _step = step , _pred = \fid -> do (cnt, _) <- lookupFun fid return (cnt > 0) , _localAdjust = decreaseCnt , _vrev = vrev , _crev = crev , _nesting = 0 }
388
origInlinerState :: Map VarId String -> Map ConId String -> Int -> Int -> FMap -> R origInlinerState vrev crev step rolls fmap = R { _fenv = Map.map (rolls,) fmap , _step = step , _pred = \fid -> do (cnt, _) <- lookupFun fid return (cnt > 0) , _localAdjust = decreaseCnt , _vrev = vrev , _crev = crev , _nesting = 0 }
387
origInlinerState vrev crev step rolls fmap = R { _fenv = Map.map (rolls,) fmap , _step = step , _pred = \fid -> do (cnt, _) <- lookupFun fid return (cnt > 0) , _localAdjust = decreaseCnt , _vrev = vrev , _crev = crev , _nesting = 0 }
303
false
true
0
12
137
141
77
64
null
null
osa1/Idris-dev
src/Idris/Core/ProofState.hs
bsd-3-clause
regret :: RunTactic regret ctxt env (Bind x (Hole t) sc) | noOccurrence x sc = do action (\ps -> let hs = holes ps in ps { holes = hs \\ [x] }) return sc
190
regret :: RunTactic regret ctxt env (Bind x (Hole t) sc) | noOccurrence x sc = do action (\ps -> let hs = holes ps in ps { holes = hs \\ [x] }) return sc
190
regret ctxt env (Bind x (Hole t) sc) | noOccurrence x sc = do action (\ps -> let hs = holes ps in ps { holes = hs \\ [x] }) return sc
170
false
true
1
17
72
101
45
56
null
null
vinnymac/glot-www
Widget/Pagination.hs
mit
paginationWidget :: Route App -> Pagination -> Int -> [(Text, Text)] -> Widget paginationWidget route pagination currentPage queryExtra = $(widgetFile "widgets/pagination")
176
paginationWidget :: Route App -> Pagination -> Int -> [(Text, Text)] -> Widget paginationWidget route pagination currentPage queryExtra = $(widgetFile "widgets/pagination")
176
paginationWidget route pagination currentPage queryExtra = $(widgetFile "widgets/pagination")
97
false
true
0
10
24
55
28
27
null
null
alekar/hugs
packages/base/Data/IntSet.hs
bsd-3-clause
intersection t (Tip x) = case lookup x t of Just y -> Tip y Nothing -> Nil
90
intersection t (Tip x) = case lookup x t of Just y -> Tip y Nothing -> Nil
90
intersection t (Tip x) = case lookup x t of Just y -> Tip y Nothing -> Nil
90
false
false
0
8
33
46
20
26
null
null
dylex/wai
warp/Network/Wai/Handler/Warp/HTTP2/Receiver.hs
mit
stream FrameWindowUpdate header@FrameHeader{streamId} bs _ s Stream{streamWindow} = do WindowUpdateFrame n <- guardIt $ decodeWindowUpdateFrame header bs w <- (n +) <$> atomically (readTVar streamWindow) when (isWindowOverflow w) $ E.throwIO $ StreamError FlowControlError streamId atomically $ writeTVar streamWindow w return s
356
stream FrameWindowUpdate header@FrameHeader{streamId} bs _ s Stream{streamWindow} = do WindowUpdateFrame n <- guardIt $ decodeWindowUpdateFrame header bs w <- (n +) <$> atomically (readTVar streamWindow) when (isWindowOverflow w) $ E.throwIO $ StreamError FlowControlError streamId atomically $ writeTVar streamWindow w return s
356
stream FrameWindowUpdate header@FrameHeader{streamId} bs _ s Stream{streamWindow} = do WindowUpdateFrame n <- guardIt $ decodeWindowUpdateFrame header bs w <- (n +) <$> atomically (readTVar streamWindow) when (isWindowOverflow w) $ E.throwIO $ StreamError FlowControlError streamId atomically $ writeTVar streamWindow w return s
356
false
false
0
11
68
122
56
66
null
null
GaloisInc/halvm-ghc
compiler/coreSyn/CoreUnfold.hs
bsd-3-clause
-- If size could be 0 then @f "x"@ might be too small -- [Sept03: make literal strings a bit bigger to avoid fruitless -- duplication of little strings] litSize _other = 0
188
litSize _other = 0
18
litSize _other = 0
18
true
false
0
4
49
12
7
5
null
null
siddhanathan/yi
yi-core/src/Yi/Buffer/Misc.hs
gpl-2.0
writeB :: Char -> BufferM () writeB c = do deleteN 1 insertB c -- | Write the list into the buffer at current point.
121
writeB :: Char -> BufferM () writeB c = do deleteN 1 insertB c -- | Write the list into the buffer at current point.
121
writeB c = do deleteN 1 insertB c -- | Write the list into the buffer at current point.
92
false
true
0
7
29
36
16
20
null
null
Heather/Idris-dev
src/IRTS/Defunctionalise.hs
bsd-3-clause
groupsOf :: Int -> [DAlt] -> [[DAlt]] groupsOf x [] = []
56
groupsOf :: Int -> [DAlt] -> [[DAlt]] groupsOf x [] = []
56
groupsOf x [] = []
18
false
true
0
10
11
43
21
22
null
null
gitpan/SMOP
m0ld/M0ld/Yeast.hs
artistic-2.0
indent depth code = unlines $ map indentLine $ lines code where indentLine "" = "" indentLine line = (take depth $ repeat ' ') ++ line
142
indent depth code = unlines $ map indentLine $ lines code where indentLine "" = "" indentLine line = (take depth $ repeat ' ') ++ line
142
indent depth code = unlines $ map indentLine $ lines code where indentLine "" = "" indentLine line = (take depth $ repeat ' ') ++ line
142
false
false
0
10
34
60
28
32
null
null
tgdavies/codeworld
codeworld-base/src/Internal/Prelude.hs
apache-2.0
-- For some reason, randoms numbers seem to give conspicuously similar -- results early in the sequence, so we throw away a few to get better -- mixing. numToStdGen :: Number -> StdGen numToStdGen r = mkStdGen (a `xor` P.fromIntegral b `xor` P.fromIntegral c) where (sig, a) = P.decodeFloat (P.realToFrac r) (b, c) = sig `P.divMod` (2 P.^ 31)
352
numToStdGen :: Number -> StdGen numToStdGen r = mkStdGen (a `xor` P.fromIntegral b `xor` P.fromIntegral c) where (sig, a) = P.decodeFloat (P.realToFrac r) (b, c) = sig `P.divMod` (2 P.^ 31)
199
numToStdGen r = mkStdGen (a `xor` P.fromIntegral b `xor` P.fromIntegral c) where (sig, a) = P.decodeFloat (P.realToFrac r) (b, c) = sig `P.divMod` (2 P.^ 31)
167
true
true
0
10
68
112
59
53
null
null
ideas-edu/ideas
src/Ideas/Common/ExerciseTests.hs
apache-2.0
-- check combination of parser and pretty-printer checkParserPretty :: (a -> a -> Bool) -> (String -> Either String a) -> (a -> String) -> a -> Bool checkParserPretty eq p pretty a = either (const False) (eq a) (p (pretty a))
231
checkParserPretty :: (a -> a -> Bool) -> (String -> Either String a) -> (a -> String) -> a -> Bool checkParserPretty eq p pretty a = either (const False) (eq a) (p (pretty a))
179
checkParserPretty eq p pretty a = either (const False) (eq a) (p (pretty a))
80
true
true
0
9
47
98
50
48
null
null
jbracker/supermonad-plugin
examples/monad/hmtc/original/Diagnostics.hs
bsd-3-clause
unDF :: DF a -> DFT D a unDF (DF dfta) = dfta
45
unDF :: DF a -> DFT D a unDF (DF dfta) = dfta
45
unDF (DF dfta) = dfta
21
false
true
0
6
12
36
16
20
null
null
mbakke/ganeti
src/Ganeti/Runtime.hs
bsd-2-clause
daemonGroup (DaemonGroup GanetiNoded) = AutoConf.nodedGroup
61
daemonGroup (DaemonGroup GanetiNoded) = AutoConf.nodedGroup
61
daemonGroup (DaemonGroup GanetiNoded) = AutoConf.nodedGroup
61
false
false
0
7
6
17
8
9
null
null
ekmett/MonadicRP
src/RPListIntTest.hs
gpl-3.0
testList :: RP s (SRef s (RPList s Int)) testList = do tail <- newSRef Nil c1 <- newSRef $ Cons (- 1) tail c2 <- newSRef $ Cons 1 c1 newSRef $ Cons 1 c2
168
testList :: RP s (SRef s (RPList s Int)) testList = do tail <- newSRef Nil c1 <- newSRef $ Cons (- 1) tail c2 <- newSRef $ Cons 1 c1 newSRef $ Cons 1 c2
168
testList = do tail <- newSRef Nil c1 <- newSRef $ Cons (- 1) tail c2 <- newSRef $ Cons 1 c1 newSRef $ Cons 1 c2
127
false
true
2
12
51
99
42
57
null
null
DavidAlphaFox/ghc
compiler/basicTypes/Id.hs
bsd-3-clause
lazySetIdInfo :: Id -> IdInfo -> Id lazySetIdInfo = Var.lazySetIdInfo
69
lazySetIdInfo :: Id -> IdInfo -> Id lazySetIdInfo = Var.lazySetIdInfo
69
lazySetIdInfo = Var.lazySetIdInfo
33
false
true
0
6
9
21
11
10
null
null
AlexeyRaga/eta
libraries/base/GHC/IO/Handle/Internals.hs
bsd-3-clause
initBufferState :: HandleType -> BufferState initBufferState ReadHandle = ReadBuffer
84
initBufferState :: HandleType -> BufferState initBufferState ReadHandle = ReadBuffer
84
initBufferState ReadHandle = ReadBuffer
39
false
true
0
5
8
18
9
9
null
null
jtojnar/haste-compiler
libraries/ghc-7.10/base/GHC/Natural.hs
bsd-3-clause
powModNatural (NatS# 1##) _ _ = NatS# 1##
61
powModNatural (NatS# 1##) _ _ = NatS# 1##
61
powModNatural (NatS# 1##) _ _ = NatS# 1##
61
false
false
0
7
27
22
10
12
null
null
mzero/plush
src/Plush/Run/Command.hs
apache-2.0
-- | Use the command name to find a command. Returns information about where -- the command was found, and a @'ShellUtility' m@ to run it. Implements the -- search algorithm in §2.9.1 "Command Search and Execution". commandSearch :: (PosixLike m) => String -> ShellExec m (FoundCommand, CommandAction m, CommandAnnotate m) commandSearch cmd | '/' `elem` cmd = external cmd | otherwise = -- step 1.a.: special built-ins search special setShellVars SpecialCommand $ -- step 1.b.: functions searchFun $ -- step 1.c.: direct utilities search direct withEnvVars DirectCommand $ -- step 1.d.: search on PATH findOnPath where findOnPath = do getVarDefault "PATH" "" >>= go . map (</> cmd) . splitSearchPath where go (fp:fps) = do b <- doesFileExist fp -- TODO: check if it can be executed if b then -- step 1.d.i.a.: regular built-ins search builtin withEnvVars (BuiltInCommand fp) $ -- step 1.d.i.b.: exec from file system external fp else go fps go [] = -- step 1.d.ii.: not found on PATH unknown search lkup processBindings fc alt = maybe alt (\util -> return (fc, UtilityAction (processBindings $ utilExecute util), utilAnnotate util)) $ lkup cmd searchFun alt = do maybeFun <- getFun cmd maybe alt (\fb -> return (FunctionCall, FunctionAction $ functionExec fb, emptyAnnotate)) $ maybeFun external fp = return (ExecutableCommand fp, UtilityAction $ externalExec fp, emptyAnnotate) externalExec fp = withEnvVars $ \args -> do env <- getEnv StStatus <$> execProcess fp env cmd args functionExec fb ef = setShellVars (\args -> withFunContext args $ ef fb) -- §2.9.5 states that when executed, functions have the assignment -- properties of special built-ins. unknown = return (UnknownCommand, UtilityAction unknownExec, emptyAnnotate) unknownExec _ _ = exitMsg 127 ("Unknown command: " ++ cmd) -- TODO: unsure if emptyAnnotate is correct here, or perhaps defaultAnnotate
2,390
commandSearch :: (PosixLike m) => String -> ShellExec m (FoundCommand, CommandAction m, CommandAnnotate m) commandSearch cmd | '/' `elem` cmd = external cmd | otherwise = -- step 1.a.: special built-ins search special setShellVars SpecialCommand $ -- step 1.b.: functions searchFun $ -- step 1.c.: direct utilities search direct withEnvVars DirectCommand $ -- step 1.d.: search on PATH findOnPath where findOnPath = do getVarDefault "PATH" "" >>= go . map (</> cmd) . splitSearchPath where go (fp:fps) = do b <- doesFileExist fp -- TODO: check if it can be executed if b then -- step 1.d.i.a.: regular built-ins search builtin withEnvVars (BuiltInCommand fp) $ -- step 1.d.i.b.: exec from file system external fp else go fps go [] = -- step 1.d.ii.: not found on PATH unknown search lkup processBindings fc alt = maybe alt (\util -> return (fc, UtilityAction (processBindings $ utilExecute util), utilAnnotate util)) $ lkup cmd searchFun alt = do maybeFun <- getFun cmd maybe alt (\fb -> return (FunctionCall, FunctionAction $ functionExec fb, emptyAnnotate)) $ maybeFun external fp = return (ExecutableCommand fp, UtilityAction $ externalExec fp, emptyAnnotate) externalExec fp = withEnvVars $ \args -> do env <- getEnv StStatus <$> execProcess fp env cmd args functionExec fb ef = setShellVars (\args -> withFunContext args $ ef fb) -- §2.9.5 states that when executed, functions have the assignment -- properties of special built-ins. unknown = return (UnknownCommand, UtilityAction unknownExec, emptyAnnotate) unknownExec _ _ = exitMsg 127 ("Unknown command: " ++ cmd) -- TODO: unsure if emptyAnnotate is correct here, or perhaps defaultAnnotate
2,174
commandSearch cmd | '/' `elem` cmd = external cmd | otherwise = -- step 1.a.: special built-ins search special setShellVars SpecialCommand $ -- step 1.b.: functions searchFun $ -- step 1.c.: direct utilities search direct withEnvVars DirectCommand $ -- step 1.d.: search on PATH findOnPath where findOnPath = do getVarDefault "PATH" "" >>= go . map (</> cmd) . splitSearchPath where go (fp:fps) = do b <- doesFileExist fp -- TODO: check if it can be executed if b then -- step 1.d.i.a.: regular built-ins search builtin withEnvVars (BuiltInCommand fp) $ -- step 1.d.i.b.: exec from file system external fp else go fps go [] = -- step 1.d.ii.: not found on PATH unknown search lkup processBindings fc alt = maybe alt (\util -> return (fc, UtilityAction (processBindings $ utilExecute util), utilAnnotate util)) $ lkup cmd searchFun alt = do maybeFun <- getFun cmd maybe alt (\fb -> return (FunctionCall, FunctionAction $ functionExec fb, emptyAnnotate)) $ maybeFun external fp = return (ExecutableCommand fp, UtilityAction $ externalExec fp, emptyAnnotate) externalExec fp = withEnvVars $ \args -> do env <- getEnv StStatus <$> execProcess fp env cmd args functionExec fb ef = setShellVars (\args -> withFunContext args $ ef fb) -- §2.9.5 states that when executed, functions have the assignment -- properties of special built-ins. unknown = return (UnknownCommand, UtilityAction unknownExec, emptyAnnotate) unknownExec _ _ = exitMsg 127 ("Unknown command: " ++ cmd) -- TODO: unsure if emptyAnnotate is correct here, or perhaps defaultAnnotate
2,063
true
true
1
14
817
478
242
236
null
null