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
Alexander-Ignatyev/morpheus
hmatrix-morpheus/test/Numeric/Morpheus/StatisticsTest.hs
bsd-3-clause
columnMeansRM = fromList [64.33333, 46, 122.33333, 48]
54
columnMeansRM = fromList [64.33333, 46, 122.33333, 48]
54
columnMeansRM = fromList [64.33333, 46, 122.33333, 48]
54
false
false
1
5
6
24
12
12
null
null
tjakway/ghcjvm
compiler/hsSyn/HsPat.hs
bsd-3-clause
pprPat (LazyPat pat) = char '~' <> pprParendLPat pat
61
pprPat (LazyPat pat) = char '~' <> pprParendLPat pat
61
pprPat (LazyPat pat) = char '~' <> pprParendLPat pat
61
false
false
0
7
17
25
11
14
null
null
ggkitsas/HaLVM
src/HALVMCore/Communication/Rendezvous.hs
bsd-3-clause
removePath :: XenStore -> String -> IO () removePath xs str = do catch remSubItems onECContinue catch remItem onECContinue where remSubItems = mapM_ (removePath xs) =<< xsDirectory xs str remItem = xsRemove xs str
249
removePath :: XenStore -> String -> IO () removePath xs str = do catch remSubItems onECContinue catch remItem onECContinue where remSubItems = mapM_ (removePath xs) =<< xsDirectory xs str remItem = xsRemove xs str
249
removePath xs str = do catch remSubItems onECContinue catch remItem onECContinue where remSubItems = mapM_ (removePath xs) =<< xsDirectory xs str remItem = xsRemove xs str
207
false
true
0
8
69
81
37
44
null
null
input-output-hk/pos-haskell-prototype
wallet/src/Cardano/Wallet/API/Response/Sort/IxSet.hs
mit
-- | Sort the data, stopping at the first encountered sort operation. This is because -- sorting on multiple fields doesn't make sense with the current data model. sortData :: S.SortOperations a -> IxSet a -> [a] sortData S.NoSorts iset = toList iset
255
sortData :: S.SortOperations a -> IxSet a -> [a] sortData S.NoSorts iset = toList iset
91
sortData S.NoSorts iset = toList iset
42
true
true
0
7
47
42
21
21
null
null
spechub/Hets
HasCASL/AsToLe.hs
gpl-2.0
idsOfOpItem :: OpBrand -> OpItem -> Ids idsOfOpItem b oi = let stripCompound (PolyId (Id ts _ ps) _ _) = Id ts [] ps getPolyId (PolyId i _ _) = i in case oi of OpDecl os _ _ _ -> case b of Pred -> Set.union (Set.fromList $ map getPolyId os) $ Set.fromList $ map stripCompound os _ -> Set.empty OpDefn p _ _ _ _ -> case b of Pred -> Set.fromList [getPolyId p, stripCompound p] _ -> Set.empty -- * basic analysis -- | basic analysis
500
idsOfOpItem :: OpBrand -> OpItem -> Ids idsOfOpItem b oi = let stripCompound (PolyId (Id ts _ ps) _ _) = Id ts [] ps getPolyId (PolyId i _ _) = i in case oi of OpDecl os _ _ _ -> case b of Pred -> Set.union (Set.fromList $ map getPolyId os) $ Set.fromList $ map stripCompound os _ -> Set.empty OpDefn p _ _ _ _ -> case b of Pred -> Set.fromList [getPolyId p, stripCompound p] _ -> Set.empty -- * basic analysis -- | basic analysis
500
idsOfOpItem b oi = let stripCompound (PolyId (Id ts _ ps) _ _) = Id ts [] ps getPolyId (PolyId i _ _) = i in case oi of OpDecl os _ _ _ -> case b of Pred -> Set.union (Set.fromList $ map getPolyId os) $ Set.fromList $ map stripCompound os _ -> Set.empty OpDefn p _ _ _ _ -> case b of Pred -> Set.fromList [getPolyId p, stripCompound p] _ -> Set.empty -- * basic analysis -- | basic analysis
460
false
true
0
18
159
216
103
113
null
null
dysinger/hmac
src/Network/HMAC/Parse.hs
mit
nonceP :: Parser AuthAttribute nonceP = (,) <$> pure NonceKey <*> (NonceVal <$> (attrP "nonce" plainTextP))
107
nonceP :: Parser AuthAttribute nonceP = (,) <$> pure NonceKey <*> (NonceVal <$> (attrP "nonce" plainTextP))
107
nonceP = (,) <$> pure NonceKey <*> (NonceVal <$> (attrP "nonce" plainTextP))
76
false
true
2
10
15
50
23
27
null
null
diminishedprime/.org
programmey_stuff/write_yourself_a_scheme/ch_06/wyas/app/LispVal.hs
mit
showError (NotFunction message func) = message ++ ": " ++ show func
70
showError (NotFunction message func) = message ++ ": " ++ show func
70
showError (NotFunction message func) = message ++ ": " ++ show func
70
false
false
0
7
14
28
13
15
null
null
TomMD/llvm-pretty
src/Text/LLVM/AST.hs
bsd-3-clause
ppFCmpOp Fugt = text "ugt"
28
ppFCmpOp Fugt = text "ugt"
28
ppFCmpOp Fugt = text "ugt"
28
false
false
0
5
6
12
5
7
null
null
mmarx/jebediah
cli/spaceplane-hangar/Main.hs
gpl-3.0
lead1B = toLead1 offbeat $ c1
29
lead1B = toLead1 offbeat $ c1
29
lead1B = toLead1 offbeat $ c1
29
false
false
0
6
5
13
6
7
null
null
SumAll/haskell-eureka-client
src/Network/Eureka/Types.hs
apache-2.0
fromNetworkName "STARTING" = return Starting
44
fromNetworkName "STARTING" = return Starting
44
fromNetworkName "STARTING" = return Starting
44
false
false
1
5
4
15
5
10
null
null
felixsch/moonbase-ng
src/Moonbase/Theme.hs
lgpl-2.1
checkHex :: String -> Maybe String checkHex [] = Just []
56
checkHex :: String -> Maybe String checkHex [] = Just []
56
checkHex [] = Just []
21
false
true
0
6
10
28
13
15
null
null
AlexanderPankiv/ghc
libraries/template-haskell/Language/Haskell/TH/Lib.hs
bsd-3-clause
conE :: Name -> ExpQ conE s = return (ConE s)
46
conE :: Name -> ExpQ conE s = return (ConE s)
46
conE s = return (ConE s)
25
false
true
0
7
11
32
14
18
null
null
edsko/cabal
cabal-install/Distribution/Client/Dependency/TopDown.hs
bsd-3-clause
addTopLevelConstraints (PackageConstraintInstalled pkg:deps) cs = case addTopLevelInstalledConstraint pkg cs of Satisfiable cs' pkgids -> Step (AppliedInstalledConstraint pkg InstalledConstraint pkgids) (addTopLevelConstraints deps cs') Unsatisfiable -> Fail (TopLevelInstallConstraintUnsatisfiable pkg InstalledConstraint) ConflictsWith conflicts -> Fail (TopLevelInstallConstraintConflict pkg InstalledConstraint conflicts)
481
addTopLevelConstraints (PackageConstraintInstalled pkg:deps) cs = case addTopLevelInstalledConstraint pkg cs of Satisfiable cs' pkgids -> Step (AppliedInstalledConstraint pkg InstalledConstraint pkgids) (addTopLevelConstraints deps cs') Unsatisfiable -> Fail (TopLevelInstallConstraintUnsatisfiable pkg InstalledConstraint) ConflictsWith conflicts -> Fail (TopLevelInstallConstraintConflict pkg InstalledConstraint conflicts)
481
addTopLevelConstraints (PackageConstraintInstalled pkg:deps) cs = case addTopLevelInstalledConstraint pkg cs of Satisfiable cs' pkgids -> Step (AppliedInstalledConstraint pkg InstalledConstraint pkgids) (addTopLevelConstraints deps cs') Unsatisfiable -> Fail (TopLevelInstallConstraintUnsatisfiable pkg InstalledConstraint) ConflictsWith conflicts -> Fail (TopLevelInstallConstraintConflict pkg InstalledConstraint conflicts)
481
false
false
0
10
91
103
48
55
null
null
thumphries/HaLVM
examples/Core/ExitTest/ExitTest.hs
bsd-3-clause
tickThread :: IO () tickThread = do writeDebugConsole "Tick!\n" threadDelay 1000000
87
tickThread :: IO () tickThread = do writeDebugConsole "Tick!\n" threadDelay 1000000
87
tickThread = do writeDebugConsole "Tick!\n" threadDelay 1000000
67
false
true
0
7
14
28
12
16
null
null
massysett/tsparse
TsParse.hs
bsd-3-clause
columnSpaceOne :: Gen String columnSpaceOne = fmap (f . abs) Q.arbitrarySizedIntegral where f i = " " ++ replicate i ' '
126
columnSpaceOne :: Gen String columnSpaceOne = fmap (f . abs) Q.arbitrarySizedIntegral where f i = " " ++ replicate i ' '
126
columnSpaceOne = fmap (f . abs) Q.arbitrarySizedIntegral where f i = " " ++ replicate i ' '
97
false
true
0
7
27
47
23
24
null
null
Chobbes/Haithon
src/Text/Haithon/Parser.hs
mit
pyBreak :: PyParser PyStmt pyBreak = reserved "break" >> return PyBreak
71
pyBreak :: PyParser PyStmt pyBreak = reserved "break" >> return PyBreak
71
pyBreak = reserved "break" >> return PyBreak
44
false
true
2
6
10
30
12
18
null
null
mariefarrell/Hets
Comorphisms/ExtModal2HasCASL.hs
gpl-2.0
flatOrElse :: MODALITY -> [MODALITY] flatOrElse md = case md of ModOp OrElse m1 m2 -> flatOrElse m1 ++ flatOrElse m2 _ -> [md]
130
flatOrElse :: MODALITY -> [MODALITY] flatOrElse md = case md of ModOp OrElse m1 m2 -> flatOrElse m1 ++ flatOrElse m2 _ -> [md]
130
flatOrElse md = case md of ModOp OrElse m1 m2 -> flatOrElse m1 ++ flatOrElse m2 _ -> [md]
93
false
true
3
6
27
54
27
27
null
null
leohahn/learning-with-texts-clone
src/Config.hs
bsd-3-clause
envPool Production = 8
22
envPool Production = 8
22
envPool Production = 8
22
false
false
1
5
3
13
4
9
null
null
itsbruce/hackerrank
alg/implementation/nyChaos.hs
unlicense
cost (n, b) | b - n > 2 = Nothing | otherwise = Just (b - n)
68
cost (n, b) | b - n > 2 = Nothing | otherwise = Just (b - n)
68
cost (n, b) | b - n > 2 = Nothing | otherwise = Just (b - n)
68
false
false
1
9
25
47
23
24
null
null
jwiegley/ghc-release
utils/haddock/src/Haddock/Backends/Xhtml/Decl.hs
gpl-3.0
ppr_mono_ty _ (HsTyLit n) _ _ = ppr_tylit n
43
ppr_mono_ty _ (HsTyLit n) _ _ = ppr_tylit n
43
ppr_mono_ty _ (HsTyLit n) _ _ = ppr_tylit n
43
false
false
0
7
8
24
11
13
null
null
jfischoff/LambdaPrettyQuote
tests/UntypedTests.hs
bsd-3-clause
test_antivar_5 = actual @?= expected where actual = [lam| (x *y) |] y = "hey" expected = [lam| (x hey) |]
117
test_antivar_5 = actual @?= expected where actual = [lam| (x *y) |] y = "hey" expected = [lam| (x hey) |]
117
test_antivar_5 = actual @?= expected where actual = [lam| (x *y) |] y = "hey" expected = [lam| (x hey) |]
117
false
false
0
7
32
39
24
15
null
null
wxwxwwxxx/ghc
libraries/base/System/IO.hs
bsd-3-clause
-- build large digit-alike number rand_string :: IO String rand_string = do r1 <- c_rand r2 <- c_rand return $ show r1 ++ show r2
135
rand_string :: IO String rand_string = do r1 <- c_rand r2 <- c_rand return $ show r1 ++ show r2
101
rand_string = do r1 <- c_rand r2 <- c_rand return $ show r1 ++ show r2
76
true
true
0
9
30
46
21
25
null
null
Zigazou/containers
Data/Sequence.hs
bsd-3-clause
reverseDigit :: (a -> a) -> Digit a -> Digit a reverseDigit f (One a) = One (f a)
81
reverseDigit :: (a -> a) -> Digit a -> Digit a reverseDigit f (One a) = One (f a)
81
reverseDigit f (One a) = One (f a)
34
false
true
0
10
18
57
26
31
null
null
SuperDrew/sql-server-gen
src/Database/SqlServer/Definition/DataType.hs
bsd-2-clause
renderDataType Image {} = text "image"
38
renderDataType Image {} = text "image"
38
renderDataType Image {} = text "image"
38
false
false
1
5
5
17
7
10
null
null
opentower/carnap
Carnap-Server/Handler/Instuctor.hs
gpl-3.0
sanatizeForJS ('\'':xs) = '\\' : '\'' : sanatizeForJS xs
56
sanatizeForJS ('\'':xs) = '\\' : '\'' : sanatizeForJS xs
56
sanatizeForJS ('\'':xs) = '\\' : '\'' : sanatizeForJS xs
56
false
false
0
7
8
27
13
14
null
null
gdetrez/haskell-wot
Codec/Archive/Ar.hs
gpl-3.0
getEntry :: Get Entry getEntry = do -- entry are aligned on even byte boundary pos <- bytesRead when (odd pos) (skip 1) name <- getArName time <- getAsciiInt 12 owner <- getAsciiInt 6 group <- getAsciiInt 6 mode <- getAsciiInt 8 content <- getContent return (name, time, owner, group, mode, content)
352
getEntry :: Get Entry getEntry = do -- entry are aligned on even byte boundary pos <- bytesRead when (odd pos) (skip 1) name <- getArName time <- getAsciiInt 12 owner <- getAsciiInt 6 group <- getAsciiInt 6 mode <- getAsciiInt 8 content <- getContent return (name, time, owner, group, mode, content)
352
getEntry = do -- entry are aligned on even byte boundary pos <- bytesRead when (odd pos) (skip 1) name <- getArName time <- getAsciiInt 12 owner <- getAsciiInt 6 group <- getAsciiInt 6 mode <- getAsciiInt 8 content <- getContent return (name, time, owner, group, mode, content)
330
false
true
0
9
104
120
56
64
null
null
aaronc/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
showDeclImp o (PData _ _ _ _ _ d) = showDImp o { ppopt_impl = True } d
70
showDeclImp o (PData _ _ _ _ _ d) = showDImp o { ppopt_impl = True } d
70
showDeclImp o (PData _ _ _ _ _ d) = showDImp o { ppopt_impl = True } d
70
false
false
0
7
17
40
20
20
null
null
fpco/primitive
Data/Primitive/Array.hs
bsd-3-clause
unsafeThawArray (Array arr#) = primitive (\s# -> case unsafeThawArray# arr# s# of (# s'#, arr'# #) -> (# s'#, MutableArray arr'# #))
158
unsafeThawArray (Array arr#) = primitive (\s# -> case unsafeThawArray# arr# s# of (# s'#, arr'# #) -> (# s'#, MutableArray arr'# #))
158
unsafeThawArray (Array arr#) = primitive (\s# -> case unsafeThawArray# arr# s# of (# s'#, arr'# #) -> (# s'#, MutableArray arr'# #))
158
false
false
0
12
47
54
27
27
null
null
olsner/ghc
compiler/nativeGen/X86/Ppr.hs
bsd-3-clause
pprInstr (NOT format op) = pprFormatOp (sLit "not") format op
61
pprInstr (NOT format op) = pprFormatOp (sLit "not") format op
61
pprInstr (NOT format op) = pprFormatOp (sLit "not") format op
61
false
false
0
7
9
30
14
16
null
null
adarqui/Abstract-Impl-Redis
src/Abstract/Impl/Redis/Stack/Internal.hs
bsd-3-clause
mkStack'Redis :: StackRedis t -> IO (Stack IO t) mkStack'Redis srw = do conn <- H.open $ _info srw return $ buildStack $ srw { _conn = conn }
143
mkStack'Redis :: StackRedis t -> IO (Stack IO t) mkStack'Redis srw = do conn <- H.open $ _info srw return $ buildStack $ srw { _conn = conn }
143
mkStack'Redis srw = do conn <- H.open $ _info srw return $ buildStack $ srw { _conn = conn }
94
false
true
0
10
30
71
33
38
null
null
chemouna/99Haskell
src/Problem4.hs
bsd-3-clause
-- solution 7 myLength7 :: [a] -> Int myLength7 = foldr (const (+ 1)) 0
71
myLength7 :: [a] -> Int myLength7 = foldr (const (+ 1)) 0
57
myLength7 = foldr (const (+ 1)) 0
33
true
true
0
8
14
41
20
21
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F31.hs
bsd-3-clause
ptr_glVertexAttribL4i64NV :: FunPtr (GLuint -> GLint64EXT -> GLint64EXT -> GLint64EXT -> GLint64EXT -> IO ()) ptr_glVertexAttribL4i64NV = unsafePerformIO $ getCommand "glVertexAttribL4i64NV"
190
ptr_glVertexAttribL4i64NV :: FunPtr (GLuint -> GLint64EXT -> GLint64EXT -> GLint64EXT -> GLint64EXT -> IO ()) ptr_glVertexAttribL4i64NV = unsafePerformIO $ getCommand "glVertexAttribL4i64NV"
190
ptr_glVertexAttribL4i64NV = unsafePerformIO $ getCommand "glVertexAttribL4i64NV"
80
false
true
0
13
20
49
24
25
null
null
DominikDitoIvosevic/Uni
IRG/src/Irg/Lab2/Geometry/Shapes.hs
mit
polygonFromLists :: [[Number]] -> Polygon polygonFromLists = Polygon . V.fromList . map dotFromList
99
polygonFromLists :: [[Number]] -> Polygon polygonFromLists = Polygon . V.fromList . map dotFromList
99
polygonFromLists = Polygon . V.fromList . map dotFromList
57
false
true
1
8
12
41
19
22
null
null
rscprof/kalium
src/Kalium/Nucleus/Vector/Template.hs
bsd-3-clause
metaSubst :: (GetMetaTable m) => Meta Expression -> m Expression metaSubst = \case Primary l -> pure (Primary l) Access n -> pure (Access n) Lambda p a -> Lambda <$> metaPSubst p <*> metaSubst a Beta f a -> Beta <$> metaSubst f <*> metaSubst a Ext metaname -> viewMetaObject metaname
305
metaSubst :: (GetMetaTable m) => Meta Expression -> m Expression metaSubst = \case Primary l -> pure (Primary l) Access n -> pure (Access n) Lambda p a -> Lambda <$> metaPSubst p <*> metaSubst a Beta f a -> Beta <$> metaSubst f <*> metaSubst a Ext metaname -> viewMetaObject metaname
305
metaSubst = \case Primary l -> pure (Primary l) Access n -> pure (Access n) Lambda p a -> Lambda <$> metaPSubst p <*> metaSubst a Beta f a -> Beta <$> metaSubst f <*> metaSubst a Ext metaname -> viewMetaObject metaname
240
false
true
0
11
73
136
60
76
null
null
nushio3/ghc
compiler/basicTypes/OccName.hs
bsd-3-clause
mkGenR = mk_simple_deriv tcName "Rep_"
40
mkGenR = mk_simple_deriv tcName "Rep_"
40
mkGenR = mk_simple_deriv tcName "Rep_"
40
false
false
0
5
6
11
5
6
null
null
purcell/adventofcode2016
src/Day12.hs
bsd-3-clause
parseInstr :: Parser Instr parseInstr = (Dec <$> (string "dec " *> reg)) <|> (Inc <$> (string "inc " *> reg)) <|> (JumpNotZero <$> (string "jnz " *> val) <*> (string " " *> step)) <|> (Copy <$> (string "cpy " *> val) <*> (string " " *> reg)) where reg = Reg <$> letter val = (RegVal <$> reg) <|> (LitVal <$> num) step = num num = do sign <- option '+' (char '-') digits <- many1 digit return $ (if sign == '-' then -1 else 1) * read digits
519
parseInstr :: Parser Instr parseInstr = (Dec <$> (string "dec " *> reg)) <|> (Inc <$> (string "inc " *> reg)) <|> (JumpNotZero <$> (string "jnz " *> val) <*> (string " " *> step)) <|> (Copy <$> (string "cpy " *> val) <*> (string " " *> reg)) where reg = Reg <$> letter val = (RegVal <$> reg) <|> (LitVal <$> num) step = num num = do sign <- option '+' (char '-') digits <- many1 digit return $ (if sign == '-' then -1 else 1) * read digits
519
parseInstr = (Dec <$> (string "dec " *> reg)) <|> (Inc <$> (string "inc " *> reg)) <|> (JumpNotZero <$> (string "jnz " *> val) <*> (string " " *> step)) <|> (Copy <$> (string "cpy " *> val) <*> (string " " *> reg)) where reg = Reg <$> letter val = (RegVal <$> reg) <|> (LitVal <$> num) step = num num = do sign <- option '+' (char '-') digits <- many1 digit return $ (if sign == '-' then -1 else 1) * read digits
492
false
true
0
12
172
226
116
110
null
null
oldmanmike/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
typeNatAddTyFamNameKey = mkPreludeTyConUnique 166
52
typeNatAddTyFamNameKey = mkPreludeTyConUnique 166
52
typeNatAddTyFamNameKey = mkPreludeTyConUnique 166
52
false
false
0
5
6
9
4
5
null
null
castaway/pandoc
src/Text/Pandoc/Writers/Markdown.hs
gpl-2.0
inlineToMarkdown _ (Str str) = do st <- get if stPlain st then return $ text str else return $ text $ escapeString str
132
inlineToMarkdown _ (Str str) = do st <- get if stPlain st then return $ text str else return $ text $ escapeString str
132
inlineToMarkdown _ (Str str) = do st <- get if stPlain st then return $ text str else return $ text $ escapeString str
132
false
false
0
9
37
56
26
30
null
null
eelcoh/cryptochallenge
src/Crypto/Xor.hs
bsd-3-clause
attemptFromChars :: [Char] -> Match attemptFromChars hexString = Bytes.hexStringToByteString hexString |> attempt
117
attemptFromChars :: [Char] -> Match attemptFromChars hexString = Bytes.hexStringToByteString hexString |> attempt
117
attemptFromChars hexString = Bytes.hexStringToByteString hexString |> attempt
81
false
true
1
6
15
37
17
20
null
null
sinelaw/infernu
src/Infernu/Pretty.hs
gpl-2.0
prettyType (TRow label rl) = hsep [ case label of Just l' -> string l' <> string "=" Nothing -> empty , encloseSep (string "{ ") space (string ", ") body' <> case r of FlatRowEndTVar r' -> maybe empty ((text "|" <+>) . pretty) r' FlatRowEndRec tid ts -> comma <+> indent 4 (pretty (Fix $ TCons (TName tid) ts)) -- TODO <> rbrace ] where (props, r) = flattenRow rl isGet (TPropGetName _) = True isGet _ = False isSet (TPropSetName _) = True isSet _ = False propKeysByName = map (\ps -> let name = tpropName . fst $ head ps keys = map fst ps in (name, snd $ head ps, (any isGet keys, any isSet keys))) $ List.groupBy (\(x,xv) (y,yv) -> tpropName x == tpropName y && xv == yv) $ Map.toList props printProp' (n,v,getSet) = pn <> string ":" <+> align (pretty v) where pn = case getSet of (True, True) -> pretty n (True, False) -> string "get" <+> pretty n (False, True) -> string "set" <+> pretty n _ -> error "Expected at least one of get or set" body' = map printProp' propKeysByName
1,384
prettyType (TRow label rl) = hsep [ case label of Just l' -> string l' <> string "=" Nothing -> empty , encloseSep (string "{ ") space (string ", ") body' <> case r of FlatRowEndTVar r' -> maybe empty ((text "|" <+>) . pretty) r' FlatRowEndRec tid ts -> comma <+> indent 4 (pretty (Fix $ TCons (TName tid) ts)) -- TODO <> rbrace ] where (props, r) = flattenRow rl isGet (TPropGetName _) = True isGet _ = False isSet (TPropSetName _) = True isSet _ = False propKeysByName = map (\ps -> let name = tpropName . fst $ head ps keys = map fst ps in (name, snd $ head ps, (any isGet keys, any isSet keys))) $ List.groupBy (\(x,xv) (y,yv) -> tpropName x == tpropName y && xv == yv) $ Map.toList props printProp' (n,v,getSet) = pn <> string ":" <+> align (pretty v) where pn = case getSet of (True, True) -> pretty n (True, False) -> string "get" <+> pretty n (False, True) -> string "set" <+> pretty n _ -> error "Expected at least one of get or set" body' = map printProp' propKeysByName
1,384
prettyType (TRow label rl) = hsep [ case label of Just l' -> string l' <> string "=" Nothing -> empty , encloseSep (string "{ ") space (string ", ") body' <> case r of FlatRowEndTVar r' -> maybe empty ((text "|" <+>) . pretty) r' FlatRowEndRec tid ts -> comma <+> indent 4 (pretty (Fix $ TCons (TName tid) ts)) -- TODO <> rbrace ] where (props, r) = flattenRow rl isGet (TPropGetName _) = True isGet _ = False isSet (TPropSetName _) = True isSet _ = False propKeysByName = map (\ps -> let name = tpropName . fst $ head ps keys = map fst ps in (name, snd $ head ps, (any isGet keys, any isSet keys))) $ List.groupBy (\(x,xv) (y,yv) -> tpropName x == tpropName y && xv == yv) $ Map.toList props printProp' (n,v,getSet) = pn <> string ":" <+> align (pretty v) where pn = case getSet of (True, True) -> pretty n (True, False) -> string "get" <+> pretty n (False, True) -> string "set" <+> pretty n _ -> error "Expected at least one of get or set" body' = map printProp' propKeysByName
1,384
false
false
7
19
595
509
245
264
null
null
akhileshs/stack
src/Stack/Types/Config.hs
bsd-3-clause
flagCacheLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) flagCacheLocal = do root <- installationRootLocal return $ root </> $(mkRelDir "flag-cache") -- | Where to store mini build plan caches
234
flagCacheLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) flagCacheLocal = do root <- installationRootLocal return $ root </> $(mkRelDir "flag-cache") -- | Where to store mini build plan caches
234
flagCacheLocal = do root <- installationRootLocal return $ root </> $(mkRelDir "flag-cache") -- | Where to store mini build plan caches
144
false
true
0
10
43
71
35
36
null
null
alanz/haskell-transformations-play
Main.hs
unlicense
relation = (reservedOp ">" >> return Greater)
47
relation = (reservedOp ">" >> return Greater)
47
relation = (reservedOp ">" >> return Greater)
47
false
false
1
8
8
23
9
14
null
null
uuhan/Idris-dev
src/Idris/DSL.hs
bsd-3-clause
expandSugar dsl (PDisamb ns t) = PDisamb ns (expandSugar dsl t)
63
expandSugar dsl (PDisamb ns t) = PDisamb ns (expandSugar dsl t)
63
expandSugar dsl (PDisamb ns t) = PDisamb ns (expandSugar dsl t)
63
false
false
0
7
10
34
15
19
null
null
noteed/mojito
mojito.hs
bsd-3-clause
usage :: IO () usage = do me <- getProgName putStr . unlines $ concat [ "Usage: ", me, " [OPTION]"] : "Options:" : " --help Print this message" : " --run-tests Run the test suite" : " --sexpr <string> Parse the string as an s-expression" : " and print it" : " --expr <string> Parse the string as an abstract syntax" : " tree and print it." : " --milner <string> Parse the string as an abstract syntax" : " tree, infer the types, and p-print it." : " --system-ct <string> Parse the string as an abstract syntax" : " tree, infer the types, and p-print it." : []
824
usage :: IO () usage = do me <- getProgName putStr . unlines $ concat [ "Usage: ", me, " [OPTION]"] : "Options:" : " --help Print this message" : " --run-tests Run the test suite" : " --sexpr <string> Parse the string as an s-expression" : " and print it" : " --expr <string> Parse the string as an abstract syntax" : " tree and print it." : " --milner <string> Parse the string as an abstract syntax" : " tree, infer the types, and p-print it." : " --system-ct <string> Parse the string as an abstract syntax" : " tree, infer the types, and p-print it." : []
824
usage = do me <- getProgName putStr . unlines $ concat [ "Usage: ", me, " [OPTION]"] : "Options:" : " --help Print this message" : " --run-tests Run the test suite" : " --sexpr <string> Parse the string as an s-expression" : " and print it" : " --expr <string> Parse the string as an abstract syntax" : " tree and print it." : " --milner <string> Parse the string as an abstract syntax" : " tree, infer the types, and p-print it." : " --system-ct <string> Parse the string as an abstract syntax" : " tree, infer the types, and p-print it." : []
809
false
true
0
21
374
96
48
48
null
null
nikolaspapirniywork/99_problems
haskell/src/P5.hs
apache-2.0
myReverse'' [x] = [x]
21
myReverse'' [x] = [x]
21
myReverse'' [x] = [x]
21
false
false
0
6
3
15
8
7
null
null
adamse/hindent
src/HIndent/Styles/ChrisDone.hs
bsd-3-clause
-- | I want field updates to be dependent or newline. fieldupdate :: FieldUpdate NodeInfo -> Printer t () fieldupdate e = case e of FieldUpdate _ n e' -> dependOrNewline (do pretty n write " = ") e' pretty _ -> prettyNoExt e -- | Right-hand sides are dependent.
314
fieldupdate :: FieldUpdate NodeInfo -> Printer t () fieldupdate e = case e of FieldUpdate _ n e' -> dependOrNewline (do pretty n write " = ") e' pretty _ -> prettyNoExt e -- | Right-hand sides are dependent.
260
fieldupdate e = case e of FieldUpdate _ n e' -> dependOrNewline (do pretty n write " = ") e' pretty _ -> prettyNoExt e -- | Right-hand sides are dependent.
208
true
true
0
12
102
82
37
45
null
null
plcplc/hie
hie-js/app/Main.hs
agpl-3.0
mainReactiveSum :: IO () mainReactiveSum = hieJsMain $ do let txt1 = valueMaybeCaps pcaps (MDHeading "A sampling of features in a HIE document") (Just uiRichText) txt1Ref = HieRef 0 txt2 = valueMaybeCaps pcaps (MDParagraph "Two constant Int values, and a derived value. Changing\ \ the input updates the derived value.") (Just uiRichText) txt2Ref = HieRef 0 x = valueMaybeCaps pcaps (32 :: Int) (Just uiShowString) xRef = HieRef 1 y = valueMaybeCaps pcaps (12 :: Int) (Just uiShowString) yRef = HieRef 2 -- Would it ever be possible to actually support '(Num a) => a -> a -> a' ? -- -> Yes, with "Num" in capabilities, together with wrapped "+" that -- -> somehow lifts or selects the "Num" constraint for the Ui instance to -- -> satisfy when executing function application. sum' = valueMaybeCaps pcaps ((+) :: Int -> Int -> Int) (Just $ uiReactiveFunc xRef (uiReactiveFunc yRef uiShowString)) sum'Ref = HieRef 3 doc = documentContainer uiFlowingBoxes [ (txt1Ref, txt1), (txt2Ref, txt2), (xRef, x), (yRef, y), (sum'Ref, sum') ] doc
1,285
mainReactiveSum :: IO () mainReactiveSum = hieJsMain $ do let txt1 = valueMaybeCaps pcaps (MDHeading "A sampling of features in a HIE document") (Just uiRichText) txt1Ref = HieRef 0 txt2 = valueMaybeCaps pcaps (MDParagraph "Two constant Int values, and a derived value. Changing\ \ the input updates the derived value.") (Just uiRichText) txt2Ref = HieRef 0 x = valueMaybeCaps pcaps (32 :: Int) (Just uiShowString) xRef = HieRef 1 y = valueMaybeCaps pcaps (12 :: Int) (Just uiShowString) yRef = HieRef 2 -- Would it ever be possible to actually support '(Num a) => a -> a -> a' ? -- -> Yes, with "Num" in capabilities, together with wrapped "+" that -- -> somehow lifts or selects the "Num" constraint for the Ui instance to -- -> satisfy when executing function application. sum' = valueMaybeCaps pcaps ((+) :: Int -> Int -> Int) (Just $ uiReactiveFunc xRef (uiReactiveFunc yRef uiShowString)) sum'Ref = HieRef 3 doc = documentContainer uiFlowingBoxes [ (txt1Ref, txt1), (txt2Ref, txt2), (xRef, x), (yRef, y), (sum'Ref, sum') ] doc
1,285
mainReactiveSum = hieJsMain $ do let txt1 = valueMaybeCaps pcaps (MDHeading "A sampling of features in a HIE document") (Just uiRichText) txt1Ref = HieRef 0 txt2 = valueMaybeCaps pcaps (MDParagraph "Two constant Int values, and a derived value. Changing\ \ the input updates the derived value.") (Just uiRichText) txt2Ref = HieRef 0 x = valueMaybeCaps pcaps (32 :: Int) (Just uiShowString) xRef = HieRef 1 y = valueMaybeCaps pcaps (12 :: Int) (Just uiShowString) yRef = HieRef 2 -- Would it ever be possible to actually support '(Num a) => a -> a -> a' ? -- -> Yes, with "Num" in capabilities, together with wrapped "+" that -- -> somehow lifts or selects the "Num" constraint for the Ui instance to -- -> satisfy when executing function application. sum' = valueMaybeCaps pcaps ((+) :: Int -> Int -> Int) (Just $ uiReactiveFunc xRef (uiReactiveFunc yRef uiShowString)) sum'Ref = HieRef 3 doc = documentContainer uiFlowingBoxes [ (txt1Ref, txt1), (txt2Ref, txt2), (xRef, x), (yRef, y), (sum'Ref, sum') ] doc
1,260
false
true
0
16
424
270
147
123
null
null
7ocb/fuse_adb_fs
lib/Adb.hs
gpl-3.0
callForDevice :: (MonadAdb m) => Device -> [String] -> m String callForDevice device command = callAdb $ ["-s", serialNo device] ++ command
144
callForDevice :: (MonadAdb m) => Device -> [String] -> m String callForDevice device command = callAdb $ ["-s", serialNo device] ++ command
144
callForDevice device command = callAdb $ ["-s", serialNo device] ++ command
80
false
true
0
8
26
56
29
27
null
null
tjunier/mlgsc
src/FastA.hs
mit
idToTaxonMap :: [FastA] -> Map LT.Text LT.Text idToTaxonMap records = fromList $ zip ids taxa where ids = map fastAId records taxa = map fastAOTU records -- Returns the taxonomy part of a Fasta record with Utax-formatted header
253
idToTaxonMap :: [FastA] -> Map LT.Text LT.Text idToTaxonMap records = fromList $ zip ids taxa where ids = map fastAId records taxa = map fastAOTU records -- Returns the taxonomy part of a Fasta record with Utax-formatted header
253
idToTaxonMap records = fromList $ zip ids taxa where ids = map fastAId records taxa = map fastAOTU records -- Returns the taxonomy part of a Fasta record with Utax-formatted header
206
false
true
1
7
63
68
32
36
null
null
dmbarbour/Sirea
src/Sirea/Internal/B0Impl.hs
bsd-3-clause
lnDeepDup :: (Monad m) => LnkM m x -> LnkM m x -> LnkM m x lnDeepDup x LnkDead = x
82
lnDeepDup :: (Monad m) => LnkM m x -> LnkM m x -> LnkM m x lnDeepDup x LnkDead = x
82
lnDeepDup x LnkDead = x
23
false
true
0
8
20
48
23
25
null
null
adamse/haddock
haddock-api/src/Haddock/InterfaceFile.hs
bsd-2-clause
putFastString :: BinDictionary -> BinHandle -> FastString -> IO () putFastString BinDictionary { bin_dict_next = j_r, bin_dict_map = out_r} bh f = do out <- readIORef out_r let unique = getUnique f case lookupUFM out unique of Just (j, _) -> put_ bh (fromIntegral j :: Word32) Nothing -> do j <- readFastMutInt j_r put_ bh (fromIntegral j :: Word32) writeFastMutInt j_r (j + 1) writeIORef out_r $! addToUFM out unique (j, f)
531
putFastString :: BinDictionary -> BinHandle -> FastString -> IO () putFastString BinDictionary { bin_dict_next = j_r, bin_dict_map = out_r} bh f = do out <- readIORef out_r let unique = getUnique f case lookupUFM out unique of Just (j, _) -> put_ bh (fromIntegral j :: Word32) Nothing -> do j <- readFastMutInt j_r put_ bh (fromIntegral j :: Word32) writeFastMutInt j_r (j + 1) writeIORef out_r $! addToUFM out unique (j, f)
531
putFastString BinDictionary { bin_dict_next = j_r, bin_dict_map = out_r} bh f = do out <- readIORef out_r let unique = getUnique f case lookupUFM out unique of Just (j, _) -> put_ bh (fromIntegral j :: Word32) Nothing -> do j <- readFastMutInt j_r put_ bh (fromIntegral j :: Word32) writeFastMutInt j_r (j + 1) writeIORef out_r $! addToUFM out unique (j, f)
464
false
true
1
16
179
192
89
103
null
null
ocharles/hackage-server
Distribution/Client/Mirror/Config.hs
bsd-3-clause
parsePreRepoField :: Parser (PreRepo -> PreRepo) parsePreRepoField = choice [ field "uri" parseURI $ \x r -> r {preRepoURI = Just x} , field "type" parseArg $ \x r -> r {preRepoType = Just x} , field "threshold" parseThreshold $ \x r -> r {preRepoThreshold = Just x} , field "keys" (many1 parseKeyId) $ \x r -> r {preRepoKeys = Just x} ] where field :: String -> Parser a -> (a -> PreRepo -> PreRepo) -> Parser (PreRepo -> PreRepo) field nm p f = f <$> (reserved nm *> reservedOp ":" *> p) {------------------------------------------------------------------------------- Auxiliary parsec definitions -------------------------------------------------------------------------------}
806
parsePreRepoField :: Parser (PreRepo -> PreRepo) parsePreRepoField = choice [ field "uri" parseURI $ \x r -> r {preRepoURI = Just x} , field "type" parseArg $ \x r -> r {preRepoType = Just x} , field "threshold" parseThreshold $ \x r -> r {preRepoThreshold = Just x} , field "keys" (many1 parseKeyId) $ \x r -> r {preRepoKeys = Just x} ] where field :: String -> Parser a -> (a -> PreRepo -> PreRepo) -> Parser (PreRepo -> PreRepo) field nm p f = f <$> (reserved nm *> reservedOp ":" *> p) {------------------------------------------------------------------------------- Auxiliary parsec definitions -------------------------------------------------------------------------------}
806
parsePreRepoField = choice [ field "uri" parseURI $ \x r -> r {preRepoURI = Just x} , field "type" parseArg $ \x r -> r {preRepoType = Just x} , field "threshold" parseThreshold $ \x r -> r {preRepoThreshold = Just x} , field "keys" (many1 parseKeyId) $ \x r -> r {preRepoKeys = Just x} ] where field :: String -> Parser a -> (a -> PreRepo -> PreRepo) -> Parser (PreRepo -> PreRepo) field nm p f = f <$> (reserved nm *> reservedOp ":" *> p) {------------------------------------------------------------------------------- Auxiliary parsec definitions -------------------------------------------------------------------------------}
757
false
true
0
11
225
228
118
110
null
null
keera-studios/hsQt
Qtc/ClassTypes/Gui.hs
bsd-2-clause
qCast_QTextListFormat :: Object a -> IO (QTextListFormat ()) qCast_QTextListFormat _qobj = return (objectCast _qobj)
118
qCast_QTextListFormat :: Object a -> IO (QTextListFormat ()) qCast_QTextListFormat _qobj = return (objectCast _qobj)
118
qCast_QTextListFormat _qobj = return (objectCast _qobj)
57
false
true
0
9
15
41
19
22
null
null
uduki/hsQt
Qtc/Enums/Gui/QSystemTrayIcon.hs
bsd-2-clause
eUnknown :: ActivationReason eUnknown = ieActivationReason $ 0
64
eUnknown :: ActivationReason eUnknown = ieActivationReason $ 0
64
eUnknown = ieActivationReason $ 0
35
false
true
0
6
9
18
8
10
null
null
sgillespie/ghc
compiler/basicTypes/Literal.hs
bsd-3-clause
isZeroLit (MachWord64 0) = True
31
isZeroLit (MachWord64 0) = True
31
isZeroLit (MachWord64 0) = True
31
false
false
0
7
4
15
7
8
null
null
emwap/feldspar-language
src/Feldspar/Core/Middleend/FromTyped.hs
bsd-3-clause
untypeType (FunType a b) (sa, sz) = Ut.FunType (untypeType a sa) (untypeType b sz)
84
untypeType (FunType a b) (sa, sz) = Ut.FunType (untypeType a sa) (untypeType b sz)
84
untypeType (FunType a b) (sa, sz) = Ut.FunType (untypeType a sa) (untypeType b sz)
84
false
false
0
7
15
50
24
26
null
null
gnn/Hets
Adl/Sign.hs
gpl-2.0
symOf :: Sign -> Set.Set Symbol symOf = Set.unions . map (\ (i, l) -> Set.fromList . concatMap (\ y -> let s = relSrc y t = relTrg y in [Con s, Con t, Rel $ Sgn (idToSimpleId i) y]) $ Set.toList l) . Map.toList . rels
330
symOf :: Sign -> Set.Set Symbol symOf = Set.unions . map (\ (i, l) -> Set.fromList . concatMap (\ y -> let s = relSrc y t = relTrg y in [Con s, Con t, Rel $ Sgn (idToSimpleId i) y]) $ Set.toList l) . Map.toList . rels
330
symOf = Set.unions . map (\ (i, l) -> Set.fromList . concatMap (\ y -> let s = relSrc y t = relTrg y in [Con s, Con t, Rel $ Sgn (idToSimpleId i) y]) $ Set.toList l) . Map.toList . rels
298
false
true
2
19
160
139
67
72
null
null
abakst/liquidhaskell
benchmarks/vector-0.10.0.1/Data/Vector/Generic.hs
bsd-3-clause
freeze mv = unsafeFreeze =<< M.clone mv
39
freeze mv = unsafeFreeze =<< M.clone mv
39
freeze mv = unsafeFreeze =<< M.clone mv
39
false
false
1
7
6
21
8
13
null
null
z0isch/lambda-hive
src/LambdaHive/Types.hs
bsd-3-clause
unsafePlacePiece :: GameState -> PieceCoordinate -> PieceType -> GameState unsafePlacePiece gs c@(x,y,_) t = GameState { gsCurrPlayer = nextPlayer gs , gsTurn = gsTurn gs + 1 , gsBoard = newBoardState , gsHand1 = hand1 , gsHand2 = hand2 , gsStatus = newStatus } where bs = gsBoard gs pcs = bsCoords bs ba = bsAdjacency bs stackHeights = bsStackHeights bs newEdges = map (IG.toEdge newPieceId . hPieceId) (Map.elems adjacents) newGraph = affectEdges IG.insertEdge newEdges ba pieceTypeNum = if t== Queen then Nothing else Just (numOfPieceType + 1) connonicalName = playerText (gsCurrPlayer gs) <> pieceText t <> if t== Queen then "" else Text.pack (show (numOfPieceType + 1)) numOfPieceType = Map.size $ Map.filter (\p-> hPieceType p == t && hPlayer p == gsCurrPlayer gs) pcs newMap = Map.insert c (HivePiece (gsCurrPlayer gs) newPieceId t connonicalName pieceTypeNum) pcs newPieceId = Map.size pcs adjacents = Map.filterWithKey (\k hp -> hPieceId hp /= newPieceId && adjacentCoords c k) newMap nextHand = delete t $ currPlayersHand gs hand1 = if gsCurrPlayer gs == Player1 then nextHand else gsHand1 gs hand2 = if gsCurrPlayer gs == Player2 then nextHand else gsHand2 gs newBoardState = BoardState newMap newGraph newIds newCIds newAps newHeights newStatus = gameStatus newBoardState newIds = Bimap.insert newPieceId c $ bsIdMap bs newCIds = Bimap.insert connonicalName c $ bsCannonicalIdMap bs newAps = Set.fromList $ IG.articulationPoints newGraph newHeights = Map.alter (Just . maybe 1 (+ 1)) (x,y) stackHeights
1,808
unsafePlacePiece :: GameState -> PieceCoordinate -> PieceType -> GameState unsafePlacePiece gs c@(x,y,_) t = GameState { gsCurrPlayer = nextPlayer gs , gsTurn = gsTurn gs + 1 , gsBoard = newBoardState , gsHand1 = hand1 , gsHand2 = hand2 , gsStatus = newStatus } where bs = gsBoard gs pcs = bsCoords bs ba = bsAdjacency bs stackHeights = bsStackHeights bs newEdges = map (IG.toEdge newPieceId . hPieceId) (Map.elems adjacents) newGraph = affectEdges IG.insertEdge newEdges ba pieceTypeNum = if t== Queen then Nothing else Just (numOfPieceType + 1) connonicalName = playerText (gsCurrPlayer gs) <> pieceText t <> if t== Queen then "" else Text.pack (show (numOfPieceType + 1)) numOfPieceType = Map.size $ Map.filter (\p-> hPieceType p == t && hPlayer p == gsCurrPlayer gs) pcs newMap = Map.insert c (HivePiece (gsCurrPlayer gs) newPieceId t connonicalName pieceTypeNum) pcs newPieceId = Map.size pcs adjacents = Map.filterWithKey (\k hp -> hPieceId hp /= newPieceId && adjacentCoords c k) newMap nextHand = delete t $ currPlayersHand gs hand1 = if gsCurrPlayer gs == Player1 then nextHand else gsHand1 gs hand2 = if gsCurrPlayer gs == Player2 then nextHand else gsHand2 gs newBoardState = BoardState newMap newGraph newIds newCIds newAps newHeights newStatus = gameStatus newBoardState newIds = Bimap.insert newPieceId c $ bsIdMap bs newCIds = Bimap.insert connonicalName c $ bsCannonicalIdMap bs newAps = Set.fromList $ IG.articulationPoints newGraph newHeights = Map.alter (Just . maybe 1 (+ 1)) (x,y) stackHeights
1,808
unsafePlacePiece gs c@(x,y,_) t = GameState { gsCurrPlayer = nextPlayer gs , gsTurn = gsTurn gs + 1 , gsBoard = newBoardState , gsHand1 = hand1 , gsHand2 = hand2 , gsStatus = newStatus } where bs = gsBoard gs pcs = bsCoords bs ba = bsAdjacency bs stackHeights = bsStackHeights bs newEdges = map (IG.toEdge newPieceId . hPieceId) (Map.elems adjacents) newGraph = affectEdges IG.insertEdge newEdges ba pieceTypeNum = if t== Queen then Nothing else Just (numOfPieceType + 1) connonicalName = playerText (gsCurrPlayer gs) <> pieceText t <> if t== Queen then "" else Text.pack (show (numOfPieceType + 1)) numOfPieceType = Map.size $ Map.filter (\p-> hPieceType p == t && hPlayer p == gsCurrPlayer gs) pcs newMap = Map.insert c (HivePiece (gsCurrPlayer gs) newPieceId t connonicalName pieceTypeNum) pcs newPieceId = Map.size pcs adjacents = Map.filterWithKey (\k hp -> hPieceId hp /= newPieceId && adjacentCoords c k) newMap nextHand = delete t $ currPlayersHand gs hand1 = if gsCurrPlayer gs == Player1 then nextHand else gsHand1 gs hand2 = if gsCurrPlayer gs == Player2 then nextHand else gsHand2 gs newBoardState = BoardState newMap newGraph newIds newCIds newAps newHeights newStatus = gameStatus newBoardState newIds = Bimap.insert newPieceId c $ bsIdMap bs newCIds = Bimap.insert connonicalName c $ bsCannonicalIdMap bs newAps = Set.fromList $ IG.articulationPoints newGraph newHeights = Map.alter (Just . maybe 1 (+ 1)) (x,y) stackHeights
1,733
false
true
20
19
526
562
288
274
null
null
EDmitry/ircbot-hs
Topic.hs
mit
consumer :: Consumer IrcBot.Message Bot () consumer = do m <- await case parseCommand "topic" m of Just (chan, body) -> lift $ write ("TOPIC " <> chan <> " :" <> body) Nothing -> return () consumer
211
consumer :: Consumer IrcBot.Message Bot () consumer = do m <- await case parseCommand "topic" m of Just (chan, body) -> lift $ write ("TOPIC " <> chan <> " :" <> body) Nothing -> return () consumer
211
consumer = do m <- await case parseCommand "topic" m of Just (chan, body) -> lift $ write ("TOPIC " <> chan <> " :" <> body) Nothing -> return () consumer
168
false
true
1
15
51
97
44
53
null
null
kmate/HaRe
old/refactorer/RefacFunDef.hs
bsd-3-clause
checkInPat (pat@(Pat (HsPList _ pat1)):pats) exp | (checkInPat pat1 exp) == False = checkInPat pats exp | otherwise = True
147
checkInPat (pat@(Pat (HsPList _ pat1)):pats) exp | (checkInPat pat1 exp) == False = checkInPat pats exp | otherwise = True
147
checkInPat (pat@(Pat (HsPList _ pat1)):pats) exp | (checkInPat pat1 exp) == False = checkInPat pats exp | otherwise = True
147
false
false
1
12
44
66
32
34
null
null
kadena-io/pact
src-tool/Pact/Analyze/Eval/Core.hs
bsd-3-clause
evalCore (StrTake n s) = evalStrTake n s
60
evalCore (StrTake n s) = evalStrTake n s
60
evalCore (StrTake n s) = evalStrTake n s
60
false
false
0
7
27
22
10
12
null
null
kazu-yamamoto/concurrent-dns-cache
Network/DNS/Cache.hs
bsd-3-clause
wait :: DNSCache -> (Int -> Bool) -> IO () wait cache cond = S.wait lvar cond where lvar = cacheConcVar cache
115
wait :: DNSCache -> (Int -> Bool) -> IO () wait cache cond = S.wait lvar cond where lvar = cacheConcVar cache
115
wait cache cond = S.wait lvar cond where lvar = cacheConcVar cache
72
false
true
0
8
27
54
26
28
null
null
ekmett/ghc
compiler/cmm/CLabel.hs
bsd-3-clause
toRednCountsLbl :: CLabel -> Maybe CLabel toRednCountsLbl = fmap mkRednCountsLabel . hasHaskellName
99
toRednCountsLbl :: CLabel -> Maybe CLabel toRednCountsLbl = fmap mkRednCountsLabel . hasHaskellName
99
toRednCountsLbl = fmap mkRednCountsLabel . hasHaskellName
57
false
true
0
6
11
25
12
13
null
null
alexander-at-github/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
primOpInfo NewJFloatArrayOp = mkGenPrimOp (fsLit "newJFloatArray#") [alphaTyVar, betaTyVar] [ intPrimTy, mkStatePrimTy alphaTy ] $ mkTupleTy UnboxedTuple [mkStatePrimTy alphaTy, mkObjectPrimTy betaTy]
206
primOpInfo NewJFloatArrayOp = mkGenPrimOp (fsLit "newJFloatArray#") [alphaTyVar, betaTyVar] [ intPrimTy, mkStatePrimTy alphaTy ] $ mkTupleTy UnboxedTuple [mkStatePrimTy alphaTy, mkObjectPrimTy betaTy]
206
primOpInfo NewJFloatArrayOp = mkGenPrimOp (fsLit "newJFloatArray#") [alphaTyVar, betaTyVar] [ intPrimTy, mkStatePrimTy alphaTy ] $ mkTupleTy UnboxedTuple [mkStatePrimTy alphaTy, mkObjectPrimTy betaTy]
206
false
false
2
7
25
60
29
31
null
null
xmonad/xmonad-contrib
XMonad/Util/Stack.hs
bsd-3-clause
-- | Swap the focused element with the next one swapDownZ :: Zipper a -> Zipper a swapDownZ Nothing = Nothing
109
swapDownZ :: Zipper a -> Zipper a swapDownZ Nothing = Nothing
61
swapDownZ Nothing = Nothing
27
true
true
0
6
20
25
12
13
null
null
raptros/respond-hmac-auth
src/Web/Respond/Auth/HMAC.hs
bsd-3-clause
-- | performs the 'Auth.authenticate' operation on the request in the -- current context. authenticate :: (R.MonadRespond m, HasSecretKey a, HashAlgorithm alg) => Auth.RequestConfig alg -> a -> m (Either Auth.AuthFailure Request) authenticate conf principal = R.getRequest >>= \req -> liftIO (Auth.authenticate conf req (getSecretKey principal))
386
authenticate :: (R.MonadRespond m, HasSecretKey a, HashAlgorithm alg) => Auth.RequestConfig alg -> a -> m (Either Auth.AuthFailure Request) authenticate conf principal = R.getRequest >>= \req -> liftIO (Auth.authenticate conf req (getSecretKey principal))
296
authenticate conf principal = R.getRequest >>= \req -> liftIO (Auth.authenticate conf req (getSecretKey principal))
115
true
true
0
12
86
103
51
52
null
null
creichert/wai
warp/Network/Wai/Handler/Warp/WithApplication.hs
mit
mkWaiter :: IO (Waiter a) mkWaiter = do mvar <- newEmptyMVar return Waiter { notify = putMVar mvar, waitFor = readMVar mvar } -- | Opens a socket on a free port and returns both port and socket. -- -- @since 3.2.4
228
mkWaiter :: IO (Waiter a) mkWaiter = do mvar <- newEmptyMVar return Waiter { notify = putMVar mvar, waitFor = readMVar mvar } -- | Opens a socket on a free port and returns both port and socket. -- -- @since 3.2.4
228
mkWaiter = do mvar <- newEmptyMVar return Waiter { notify = putMVar mvar, waitFor = readMVar mvar } -- | Opens a socket on a free port and returns both port and socket. -- -- @since 3.2.4
202
false
true
0
11
56
62
30
32
null
null
elieux/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
intDataConKey = mkPreludeDataConUnique 6
67
intDataConKey = mkPreludeDataConUnique 6
67
intDataConKey = mkPreludeDataConUnique 6
67
false
false
0
5
30
9
4
5
null
null
rumblesan/improviz
src/Gfx/OpenGL.hs
bsd-3-clause
valueToGLfloat :: Value -> Either String GLfloat valueToGLfloat (Number v ) = Right v
90
valueToGLfloat :: Value -> Either String GLfloat valueToGLfloat (Number v ) = Right v
90
valueToGLfloat (Number v ) = Right v
41
false
true
0
7
18
32
15
17
null
null
keent/stack
src/Stack/Sig.hs
bsd-3-clause
-- | Signature sign (sdist) options sigSignSdistOpts :: Parser (String, String) sigSignSdistOpts = helper <*> ((,) <$> url <*> argument str (metavar "PATH"))
166
sigSignSdistOpts :: Parser (String, String) sigSignSdistOpts = helper <*> ((,) <$> url <*> argument str (metavar "PATH"))
130
sigSignSdistOpts = helper <*> ((,) <$> url <*> argument str (metavar "PATH"))
86
true
true
0
10
31
50
27
23
null
null
m15k/hs-dtd-text
Data/XML/DTD/Render.hs
bsd-3-clause
buildDTDComponent (DTDAttList a) = buildAttList a
53
buildDTDComponent (DTDAttList a) = buildAttList a
53
buildDTDComponent (DTDAttList a) = buildAttList a
53
false
false
0
7
9
18
8
10
null
null
spechub/Hets
HasCASL/ProgEq.hs
gpl-2.0
isVar :: Env -> Term -> Bool isVar e t = case t of TypedTerm trm q _ _ -> isOfType q && isVar e trm QualVar _ -> True _ -> False
140
isVar :: Env -> Term -> Bool isVar e t = case t of TypedTerm trm q _ _ -> isOfType q && isVar e trm QualVar _ -> True _ -> False
140
isVar e t = case t of TypedTerm trm q _ _ -> isOfType q && isVar e trm QualVar _ -> True _ -> False
111
false
true
3
6
44
55
30
25
null
null
IreneKnapp/Faction
libfaction/dist/build/autogen/Paths_libfaction.hs
bsd-3-clause
bindir, libdir, datadir, libexecdir :: FilePath bindir = "/usr/local/bin"
78
bindir, libdir, datadir, libexecdir :: FilePath bindir = "/usr/local/bin"
77
bindir = "/usr/local/bin"
29
false
true
5
5
13
29
12
17
null
null
prowdsponsor/mangopay
mangopay/src/Web/MangoPay/TestUtils.hs
bsd-3-clause
startHTTPServer :: HookEndPoint -> ReceivedEvents -> IO ThreadId startHTTPServer hook revts = forkIO $ run (hepPort hook) app where app req respond = runStdoutLoggingT (checkAndPushEvent req) >> respond noop checkAndPushEvent req | dropWhile T.null (W.pathInfo req) == ["mphook"] = do liftIO $ pushReceivedEvent revts toPush $(logDebugS) src (T.pack toLog) | otherwise = $(logWarnS) src $ T.pack $ concat [ "Received HTTP request for path " , show (W.pathInfo req) , ", ignoring." ] where (toPush, toLog) = case eventFromQueryString qs of Just evt -> (Right evt, "Received event:" ++ show evt) Nothing -> ( Left $ UnhandledNotification $ show qs , "Could not parse event " ++ show qs ) where qs = W.queryString req noop = W.responseBuilder status200 [("Content-Type", "text/plain")] $ copyByteString "noop" src = "mangopay-testutils" -- | (Internal) Add a new event.
1,060
startHTTPServer :: HookEndPoint -> ReceivedEvents -> IO ThreadId startHTTPServer hook revts = forkIO $ run (hepPort hook) app where app req respond = runStdoutLoggingT (checkAndPushEvent req) >> respond noop checkAndPushEvent req | dropWhile T.null (W.pathInfo req) == ["mphook"] = do liftIO $ pushReceivedEvent revts toPush $(logDebugS) src (T.pack toLog) | otherwise = $(logWarnS) src $ T.pack $ concat [ "Received HTTP request for path " , show (W.pathInfo req) , ", ignoring." ] where (toPush, toLog) = case eventFromQueryString qs of Just evt -> (Right evt, "Received event:" ++ show evt) Nothing -> ( Left $ UnhandledNotification $ show qs , "Could not parse event " ++ show qs ) where qs = W.queryString req noop = W.responseBuilder status200 [("Content-Type", "text/plain")] $ copyByteString "noop" src = "mangopay-testutils" -- | (Internal) Add a new event.
1,060
startHTTPServer hook revts = forkIO $ run (hepPort hook) app where app req respond = runStdoutLoggingT (checkAndPushEvent req) >> respond noop checkAndPushEvent req | dropWhile T.null (W.pathInfo req) == ["mphook"] = do liftIO $ pushReceivedEvent revts toPush $(logDebugS) src (T.pack toLog) | otherwise = $(logWarnS) src $ T.pack $ concat [ "Received HTTP request for path " , show (W.pathInfo req) , ", ignoring." ] where (toPush, toLog) = case eventFromQueryString qs of Just evt -> (Right evt, "Received event:" ++ show evt) Nothing -> ( Left $ UnhandledNotification $ show qs , "Could not parse event " ++ show qs ) where qs = W.queryString req noop = W.responseBuilder status200 [("Content-Type", "text/plain")] $ copyByteString "noop" src = "mangopay-testutils" -- | (Internal) Add a new event.
995
false
true
6
13
327
293
149
144
null
null
Daniel-Diaz/rachel
Rachel/Inference.hs
bsd-3-clause
typeOf :: Context -> Exp -> Either String Type typeOf ct e = fmap renameTypeVars $ evalStateT (typeOfM e) $ TIS ct 0 0
118
typeOf :: Context -> Exp -> Either String Type typeOf ct e = fmap renameTypeVars $ evalStateT (typeOfM e) $ TIS ct 0 0
118
typeOf ct e = fmap renameTypeVars $ evalStateT (typeOfM e) $ TIS ct 0 0
71
false
true
2
8
23
61
27
34
null
null
nh2/quickcheck
Test/QuickCheck/Property.hs
bsd-3-clause
-- Wrap a rose tree in an exception handler. protectRose :: IO (Rose Result) -> IO (Rose Result) protectRose = protect (return . exception "Exception")
151
protectRose :: IO (Rose Result) -> IO (Rose Result) protectRose = protect (return . exception "Exception")
106
protectRose = protect (return . exception "Exception")
54
true
true
0
8
24
47
23
24
null
null
mckeankylej/ava
src/Data/Fin/Internal.hs
mit
last :: forall n. SingI n => Fin (Succ n) last = Fin (natToInt (sing @_ @n))
76
last :: forall n. SingI n => Fin (Succ n) last = Fin (natToInt (sing @_ @n))
76
last = Fin (natToInt (sing @_ @n))
34
false
true
0
10
16
53
26
27
null
null
lambdageek/insomnia
src/Insomnia/Unify.hs
bsd-3-clause
represent :: Monad m => UVar w u -> UnificationT w u m (Rep (UVar w u)) represent u = UnificationT $ do eqc <- use equivalenceClasses let r_ = representative' u eqc case r_ of Just r -> return r Nothing -> do let r = Rep u (equivalenceClasses . equivReps) %= M.insert u r (equivalenceClasses . equivSiblings) %= M.insert r (S.singleton u) return r
379
represent :: Monad m => UVar w u -> UnificationT w u m (Rep (UVar w u)) represent u = UnificationT $ do eqc <- use equivalenceClasses let r_ = representative' u eqc case r_ of Just r -> return r Nothing -> do let r = Rep u (equivalenceClasses . equivReps) %= M.insert u r (equivalenceClasses . equivSiblings) %= M.insert r (S.singleton u) return r
379
represent u = UnificationT $ do eqc <- use equivalenceClasses let r_ = representative' u eqc case r_ of Just r -> return r Nothing -> do let r = Rep u (equivalenceClasses . equivReps) %= M.insert u r (equivalenceClasses . equivSiblings) %= M.insert r (S.singleton u) return r
307
false
true
0
17
97
174
79
95
null
null
andrewMacmurray/haskell-book-solutions
src/ch10/db.hs
mit
filterDbNumber :: [DatabaseItem] -> [Integer] filterDbNumber = foldr getDbNumber [] where getDbNumber (DbNumber n) xs = xs ++ [n] getDbNumber _ xs = xs ++ []
167
filterDbNumber :: [DatabaseItem] -> [Integer] filterDbNumber = foldr getDbNumber [] where getDbNumber (DbNumber n) xs = xs ++ [n] getDbNumber _ xs = xs ++ []
167
filterDbNumber = foldr getDbNumber [] where getDbNumber (DbNumber n) xs = xs ++ [n] getDbNumber _ xs = xs ++ []
121
false
true
6
8
35
84
37
47
null
null
quickdudley/THSDTL
Data/Function/DecisionTree.hs
lgpl-3.0
learnDT :: forall a b t. (Ord b,Eq b,Ord t,Eq t) => (t -> ExpQ) -> [(M.Map b Name -> ExpQ, a -> b)] -> [(a,t)] -> ExpQ learnDT lq cr dp = do (rn,(_,lm)) <- runStateT (dtn (zip [0..] cr) dp) (M.empty, M.empty) lb <- forM (M.toList lm) $ \(n,e) -> valD (varP n) (normalB e) [] letE (map return lb) (varE rn) -- _ $ dtn (zip [0..] cr) dp where dtn :: (Ord b,Eq b,Ord t,Eq t) => [(Int,(M.Map b Name -> ExpQ, a -> b))] -> [(a,t)] -> StateT ( M.Map (Either t (Int,M.Map b Name)) Name, M.Map Name ExpQ ) Q Name dtn _ [] = fail "learnDT called with no training examples" dtn [] l = let t = fst $ maximumBy (compare `on` snd) $ M.toList $ M.fromListWith (+) $ map (\(_,t) -> (t,1)) l in do (ncache,ecache) <- get case M.lookup (Left t) ncache of Just n -> return n Nothing -> do n <- lift (newName "dtl") put (M.insert (Left t) n ncache, M.insert n (lq t) ecache) return n dtn c d = let l = genericLength d entr m = sum $ map (\e -> genericLength e / l * entropy (map snd e)) $ M.elems m ((nx,c',cr'),_) = minimumBy (compare `on` snd) $ map (\(c1@(_,(_,cdf)),cr1) -> let bm = M.map ($ []) $ M.fromListWith (.) $ map (\d'@(a,_) -> (cdf a,(d' :))) d in ((bm,c1,cr1),entr bm) ) $ select fc fc = filter (\(_,(_,lf)) -> not $ allSame $ map (lf . fst) d) c in case () of () | null fc -> dtn [] d () | allSame (map snd d) -> do let t = snd $ head d (ncache,ecache) <- get case M.lookup (Left t) ncache of Just n -> return n Nothing -> do n <- lift (newName "dtl") put (M.insert (Left t) n ncache, M.insert n (lq t) ecache) return n () | otherwise -> do m <- fmap M.fromList $ forM (M.toList nx) $ \(k,d') -> do bn <- dtn cr' d' return (k,bn) let m' = Right (fst c',m) (ncache,ecache) <- get case M.lookup m' ncache of Just n -> return n Nothing -> do n <- lift (newName "dtn") put (M.insert m' n ncache, M.insert n (fst (snd c') m) ecache) return n
2,256
learnDT :: forall a b t. (Ord b,Eq b,Ord t,Eq t) => (t -> ExpQ) -> [(M.Map b Name -> ExpQ, a -> b)] -> [(a,t)] -> ExpQ learnDT lq cr dp = do (rn,(_,lm)) <- runStateT (dtn (zip [0..] cr) dp) (M.empty, M.empty) lb <- forM (M.toList lm) $ \(n,e) -> valD (varP n) (normalB e) [] letE (map return lb) (varE rn) -- _ $ dtn (zip [0..] cr) dp where dtn :: (Ord b,Eq b,Ord t,Eq t) => [(Int,(M.Map b Name -> ExpQ, a -> b))] -> [(a,t)] -> StateT ( M.Map (Either t (Int,M.Map b Name)) Name, M.Map Name ExpQ ) Q Name dtn _ [] = fail "learnDT called with no training examples" dtn [] l = let t = fst $ maximumBy (compare `on` snd) $ M.toList $ M.fromListWith (+) $ map (\(_,t) -> (t,1)) l in do (ncache,ecache) <- get case M.lookup (Left t) ncache of Just n -> return n Nothing -> do n <- lift (newName "dtl") put (M.insert (Left t) n ncache, M.insert n (lq t) ecache) return n dtn c d = let l = genericLength d entr m = sum $ map (\e -> genericLength e / l * entropy (map snd e)) $ M.elems m ((nx,c',cr'),_) = minimumBy (compare `on` snd) $ map (\(c1@(_,(_,cdf)),cr1) -> let bm = M.map ($ []) $ M.fromListWith (.) $ map (\d'@(a,_) -> (cdf a,(d' :))) d in ((bm,c1,cr1),entr bm) ) $ select fc fc = filter (\(_,(_,lf)) -> not $ allSame $ map (lf . fst) d) c in case () of () | null fc -> dtn [] d () | allSame (map snd d) -> do let t = snd $ head d (ncache,ecache) <- get case M.lookup (Left t) ncache of Just n -> return n Nothing -> do n <- lift (newName "dtl") put (M.insert (Left t) n ncache, M.insert n (lq t) ecache) return n () | otherwise -> do m <- fmap M.fromList $ forM (M.toList nx) $ \(k,d') -> do bn <- dtn cr' d' return (k,bn) let m' = Right (fst c',m) (ncache,ecache) <- get case M.lookup m' ncache of Just n -> return n Nothing -> do n <- lift (newName "dtn") put (M.insert m' n ncache, M.insert n (fst (snd c') m) ecache) return n
2,256
learnDT lq cr dp = do (rn,(_,lm)) <- runStateT (dtn (zip [0..] cr) dp) (M.empty, M.empty) lb <- forM (M.toList lm) $ \(n,e) -> valD (varP n) (normalB e) [] letE (map return lb) (varE rn) -- _ $ dtn (zip [0..] cr) dp where dtn :: (Ord b,Eq b,Ord t,Eq t) => [(Int,(M.Map b Name -> ExpQ, a -> b))] -> [(a,t)] -> StateT ( M.Map (Either t (Int,M.Map b Name)) Name, M.Map Name ExpQ ) Q Name dtn _ [] = fail "learnDT called with no training examples" dtn [] l = let t = fst $ maximumBy (compare `on` snd) $ M.toList $ M.fromListWith (+) $ map (\(_,t) -> (t,1)) l in do (ncache,ecache) <- get case M.lookup (Left t) ncache of Just n -> return n Nothing -> do n <- lift (newName "dtl") put (M.insert (Left t) n ncache, M.insert n (lq t) ecache) return n dtn c d = let l = genericLength d entr m = sum $ map (\e -> genericLength e / l * entropy (map snd e)) $ M.elems m ((nx,c',cr'),_) = minimumBy (compare `on` snd) $ map (\(c1@(_,(_,cdf)),cr1) -> let bm = M.map ($ []) $ M.fromListWith (.) $ map (\d'@(a,_) -> (cdf a,(d' :))) d in ((bm,c1,cr1),entr bm) ) $ select fc fc = filter (\(_,(_,lf)) -> not $ allSame $ map (lf . fst) d) c in case () of () | null fc -> dtn [] d () | allSame (map snd d) -> do let t = snd $ head d (ncache,ecache) <- get case M.lookup (Left t) ncache of Just n -> return n Nothing -> do n <- lift (newName "dtl") put (M.insert (Left t) n ncache, M.insert n (lq t) ecache) return n () | otherwise -> do m <- fmap M.fromList $ forM (M.toList nx) $ \(k,d') -> do bn <- dtn cr' d' return (k,bn) let m' = Right (fst c',m) (ncache,ecache) <- get case M.lookup m' ncache of Just n -> return n Nothing -> do n <- lift (newName "dtn") put (M.insert m' n ncache, M.insert n (fst (snd c') m) ecache) return n
2,136
false
true
1
25
807
1,284
645
639
null
null
geophf/1HaskellADay
exercises/HAD/Y2017/M12/D27/Exercise.hs
mit
-- please make sure abstract/prologue and full_text/content are HTML-tag-free. -- hint: Y2017.M12.D22.Exercise insertArts :: Connection -> [Index] -> [DatedArticle a] -> IO [Index] insertArts conn srcIdx arts = undefined
221
insertArts :: Connection -> [Index] -> [DatedArticle a] -> IO [Index] insertArts conn srcIdx arts = undefined
109
insertArts conn srcIdx arts = undefined
39
true
true
0
9
29
47
25
22
null
null
andre-artus/handbook-of-practical-logic-and-automated-reasoning-haskell
src/ATP/Resolution.hs
gpl-3.0
positiveResolution :: Log m => Formula -> m () positiveResolution fm = let fm1 = Skolem.askolemize $ Not $ Fol.generalize fm in do mapM_ (purePositiveResolution . F.listConj) (Prop.simpdnf fm1) Log.infoM "positiveResolution" "Solution found!"
252
positiveResolution :: Log m => Formula -> m () positiveResolution fm = let fm1 = Skolem.askolemize $ Not $ Fol.generalize fm in do mapM_ (purePositiveResolution . F.listConj) (Prop.simpdnf fm1) Log.infoM "positiveResolution" "Solution found!"
252
positiveResolution fm = let fm1 = Skolem.askolemize $ Not $ Fol.generalize fm in do mapM_ (purePositiveResolution . F.listConj) (Prop.simpdnf fm1) Log.infoM "positiveResolution" "Solution found!"
205
false
true
0
12
42
91
42
49
null
null
brendanhay/gogol
gogol-logging/gen/Network/Google/Resource/Logging/Projects/Exclusions/Get.hs
mpl-2.0
-- | V1 error format. pegXgafv :: Lens' ProjectsExclusionsGet (Maybe Xgafv) pegXgafv = lens _pegXgafv (\ s a -> s{_pegXgafv = a})
129
pegXgafv :: Lens' ProjectsExclusionsGet (Maybe Xgafv) pegXgafv = lens _pegXgafv (\ s a -> s{_pegXgafv = a})
107
pegXgafv = lens _pegXgafv (\ s a -> s{_pegXgafv = a})
53
true
true
0
9
21
46
25
21
null
null
aelve/guide
back/src/Guide/Types/Edit.hs
bsd-3-clause
isVacuousEdit EditAddCon{} = False
42
isVacuousEdit EditAddCon{} = False
42
isVacuousEdit EditAddCon{} = False
42
false
false
0
6
11
13
6
7
null
null
deviant-logic/tables
src/Data/Table.hs
bsd-3-clause
-- | Insert a row into a relation, ignoring collisions. unsafeInsert :: Tabular t => t -> Table t -> Table t unsafeInsert t r = case r of EmptyTable -> singleton t Table m -> Table $ runIdentity $ forTab m $ \k i -> Identity $ case i of PrimaryMap idx -> primarily k $ PrimaryMap $ idx & at (fetch k t) ?~ t CandidateMap idx -> CandidateMap $ idx & at (fetch k t) ?~ t CandidateIntMap idx -> CandidateIntMap $ idx & at (fetch k t) ?~ t CandidateHashMap idx -> CandidateHashMap $ idx & at (fetch k t) ?~ t SupplementalMap idx -> SupplementalMap $ idx & at (fetch k t) . anon nil %~ (t:) SupplementalIntMap idx -> SupplementalIntMap $ idx & at (fetch k t) . anon nil %~ (t:) SupplementalHashMap idx -> SupplementalHashMap $ idx & at (fetch k t) . anon nil %~ (t:) InvertedMap idx -> InvertedMap $ idx & flip (F.foldr $ \ik -> at ik . anon nil %~ (t:)) (fetch k t) InvertedIntMap idx -> InvertedIntMap $ idx & flip (IS.foldr $ \ik -> at ik . anon nil %~ (t:)) (fetch k t) InvertedHashMap idx -> InvertedHashMap $ idx & flip (F.foldr $ \ik -> at ik . anon nil %~ (t:)) (fetch k t)
1,247
unsafeInsert :: Tabular t => t -> Table t -> Table t unsafeInsert t r = case r of EmptyTable -> singleton t Table m -> Table $ runIdentity $ forTab m $ \k i -> Identity $ case i of PrimaryMap idx -> primarily k $ PrimaryMap $ idx & at (fetch k t) ?~ t CandidateMap idx -> CandidateMap $ idx & at (fetch k t) ?~ t CandidateIntMap idx -> CandidateIntMap $ idx & at (fetch k t) ?~ t CandidateHashMap idx -> CandidateHashMap $ idx & at (fetch k t) ?~ t SupplementalMap idx -> SupplementalMap $ idx & at (fetch k t) . anon nil %~ (t:) SupplementalIntMap idx -> SupplementalIntMap $ idx & at (fetch k t) . anon nil %~ (t:) SupplementalHashMap idx -> SupplementalHashMap $ idx & at (fetch k t) . anon nil %~ (t:) InvertedMap idx -> InvertedMap $ idx & flip (F.foldr $ \ik -> at ik . anon nil %~ (t:)) (fetch k t) InvertedIntMap idx -> InvertedIntMap $ idx & flip (IS.foldr $ \ik -> at ik . anon nil %~ (t:)) (fetch k t) InvertedHashMap idx -> InvertedHashMap $ idx & flip (F.foldr $ \ik -> at ik . anon nil %~ (t:)) (fetch k t)
1,191
unsafeInsert t r = case r of EmptyTable -> singleton t Table m -> Table $ runIdentity $ forTab m $ \k i -> Identity $ case i of PrimaryMap idx -> primarily k $ PrimaryMap $ idx & at (fetch k t) ?~ t CandidateMap idx -> CandidateMap $ idx & at (fetch k t) ?~ t CandidateIntMap idx -> CandidateIntMap $ idx & at (fetch k t) ?~ t CandidateHashMap idx -> CandidateHashMap $ idx & at (fetch k t) ?~ t SupplementalMap idx -> SupplementalMap $ idx & at (fetch k t) . anon nil %~ (t:) SupplementalIntMap idx -> SupplementalIntMap $ idx & at (fetch k t) . anon nil %~ (t:) SupplementalHashMap idx -> SupplementalHashMap $ idx & at (fetch k t) . anon nil %~ (t:) InvertedMap idx -> InvertedMap $ idx & flip (F.foldr $ \ik -> at ik . anon nil %~ (t:)) (fetch k t) InvertedIntMap idx -> InvertedIntMap $ idx & flip (IS.foldr $ \ik -> at ik . anon nil %~ (t:)) (fetch k t) InvertedHashMap idx -> InvertedHashMap $ idx & flip (F.foldr $ \ik -> at ik . anon nil %~ (t:)) (fetch k t)
1,138
true
true
5
17
390
536
260
276
null
null
rleshchinskiy/vector
Data/Vector.hs
bsd-3-clause
unsafeIndexM = G.unsafeIndexM
29
unsafeIndexM = G.unsafeIndexM
29
unsafeIndexM = G.unsafeIndexM
29
false
false
0
5
2
8
4
4
null
null
prt2121/haskell-practice
parconc/distrib-ping/ping-tc.hs
apache-2.0
-- >> -- <<pingServer pingServer :: Process () pingServer = do Ping chan <- expect say $ printf "ping received from %s" (show chan) mypid <- getSelfPid sendChan chan mypid -- >> -- <<remotable
202
pingServer :: Process () pingServer = do Ping chan <- expect say $ printf "ping received from %s" (show chan) mypid <- getSelfPid sendChan chan mypid -- >> -- <<remotable
179
pingServer = do Ping chan <- expect say $ printf "ping received from %s" (show chan) mypid <- getSelfPid sendChan chan mypid -- >> -- <<remotable
154
true
true
0
10
43
63
30
33
null
null
frantisekfarka/ghc-dsi
includes/CodeGen.Platform.hs
bsd-3-clause
globalRegMaybe (DoubleReg 3) = # if MACHREGS_sparc Just (RealRegPair REG_D3 (REG_D3 + 1)) # else Just (RealRegSingle REG_D3)
221
globalRegMaybe (DoubleReg 3) = # if MACHREGS_sparc Just (RealRegPair REG_D3 (REG_D3 + 1)) # else Just (RealRegSingle REG_D3)
221
globalRegMaybe (DoubleReg 3) = # if MACHREGS_sparc Just (RealRegPair REG_D3 (REG_D3 + 1)) # else Just (RealRegSingle REG_D3)
221
false
false
0
9
114
45
23
22
null
null
changlinli/nikki
src/Sorts/Tiles.hs
lgpl-3.0
cacheTiles :: I.Indexable (EditorObject Sort_) -> [ShapeType] cacheTiles ixs = let tiles = catMaybes $ I.toList $ fmap unwrapTSortEditorObject ixs in mkAbsoluteShapes Nothing tiles
188
cacheTiles :: I.Indexable (EditorObject Sort_) -> [ShapeType] cacheTiles ixs = let tiles = catMaybes $ I.toList $ fmap unwrapTSortEditorObject ixs in mkAbsoluteShapes Nothing tiles
188
cacheTiles ixs = let tiles = catMaybes $ I.toList $ fmap unwrapTSortEditorObject ixs in mkAbsoluteShapes Nothing tiles
126
false
true
3
11
31
70
30
40
null
null
nevrenato/Hets_Fork
Comorphisms/SoftFOL2CommonLogic.hs
gpl-2.0
trmToNameSeq :: FOLSign.SPTerm -> [NAME_OR_SEQMARK] trmToNameSeq t = case t of FOLSign.SPComplexTerm sym [] -> [Name $ symToName sym] FOLSign.SPComplexTerm _ args -> concatMap trmToNameSeq args FOLSign.SPQuantTerm _ _ _ -> error "quantification not allowed in quantifier-argument list" -- converts an SPTerm to a TERM, i.e. for the arguments of an equation
369
trmToNameSeq :: FOLSign.SPTerm -> [NAME_OR_SEQMARK] trmToNameSeq t = case t of FOLSign.SPComplexTerm sym [] -> [Name $ symToName sym] FOLSign.SPComplexTerm _ args -> concatMap trmToNameSeq args FOLSign.SPQuantTerm _ _ _ -> error "quantification not allowed in quantifier-argument list" -- converts an SPTerm to a TERM, i.e. for the arguments of an equation
369
trmToNameSeq t = case t of FOLSign.SPComplexTerm sym [] -> [Name $ symToName sym] FOLSign.SPComplexTerm _ args -> concatMap trmToNameSeq args FOLSign.SPQuantTerm _ _ _ -> error "quantification not allowed in quantifier-argument list" -- converts an SPTerm to a TERM, i.e. for the arguments of an equation
317
false
true
0
10
64
92
44
48
null
null
psibi/persistent
persistent-mongoDB/Database/Persist/MongoDB.hs
mit
nestNe = nestedFilterOp Ne
26
nestNe = nestedFilterOp Ne
26
nestNe = nestedFilterOp Ne
26
false
false
0
5
3
9
4
5
null
null
SuperDrew/sql-server-gen
src/Database/SqlServer/Definition/Sequence.hs
bsd-2-clause
numericBounds (Just SmallInt) = Just (- 32768,32767)
53
numericBounds (Just SmallInt) = Just (- 32768,32767)
53
numericBounds (Just SmallInt) = Just (- 32768,32767)
53
false
false
0
6
7
27
13
14
null
null
upsoft/bond
compiler/tests/Main.hs
mit
tests :: TestTree tests = testGroup "Compiler tests" [ testGroup "AST" [ localOption (QuickCheckMaxSize 15) $ testProperty "roundtrip" roundtripAST , testGroup "Compare .bond and .json" [ testCase "attributes" $ compareAST "attributes" , testCase "basic types" $ compareAST "basic_types" , testCase "complex types" $ compareAST "complex_types" , testCase "default values" $ compareAST "defaults" , testCase "empty" $ compareAST "empty" , testCase "field modifiers" $ compareAST "field_modifiers" , testCase "generics" $ compareAST "generics" , testCase "inheritance" $ compareAST "inheritance" , testCase "type aliases" $ compareAST "aliases" ] ] , testGroup "Codegen" [ testGroup "C++" [ verifyCppCodegen "attributes" , verifyCppCodegen "basic_types" , verifyCppCodegen "complex_types" , verifyCppCodegen "defaults" , verifyCppCodegen "empty" , verifyCppCodegen "field_modifiers" , verifyCppCodegen "generics" , verifyCppCodegen "inheritance" , verifyCppCodegen "aliases" , verifyCppCodegen "alias_key" , verifyCodegen [ "c++" , "--allocator=arena" ] "alias_with_allocator" , verifyCodegen [ "c++" , "--allocator=arena" , "--using=List=my::list<{0}, arena>" , "--using=Vector=my::vector<{0}, arena>" , "--using=Set=my::set<{0}, arena>" , "--using=Map=my::map<{0}, {1}, arena>" , "--using=String=my::string<arena>" ] "custom_alias_with_allocator" , verifyCodegen [ "c++" , "--allocator=arena" , "--using=List=my::list<{0}>" , "--using=Vector=my::vector<{0}>" , "--using=Set=my::set<{0}>" , "--using=Map=my::map<{0}, {1}>" , "--using=String=my::string" ] "custom_alias_without_allocator" , verifyApplyCodegen [ "c++" , "--apply-attribute=DllExport" ] "basic_types" ] , testGroup "C#" [ verifyCsCodegen "attributes" , verifyCsCodegen "basic_types" , verifyCsCodegen "complex_types" , verifyCsCodegen "defaults" , verifyCsCodegen "empty" , verifyCsCodegen "field_modifiers" , verifyCsCodegen "generics" , verifyCsCodegen "inheritance" , verifyCsCodegen "aliases" , verifyCsCodegen "nullable_alias" ] ] ]
2,916
tests :: TestTree tests = testGroup "Compiler tests" [ testGroup "AST" [ localOption (QuickCheckMaxSize 15) $ testProperty "roundtrip" roundtripAST , testGroup "Compare .bond and .json" [ testCase "attributes" $ compareAST "attributes" , testCase "basic types" $ compareAST "basic_types" , testCase "complex types" $ compareAST "complex_types" , testCase "default values" $ compareAST "defaults" , testCase "empty" $ compareAST "empty" , testCase "field modifiers" $ compareAST "field_modifiers" , testCase "generics" $ compareAST "generics" , testCase "inheritance" $ compareAST "inheritance" , testCase "type aliases" $ compareAST "aliases" ] ] , testGroup "Codegen" [ testGroup "C++" [ verifyCppCodegen "attributes" , verifyCppCodegen "basic_types" , verifyCppCodegen "complex_types" , verifyCppCodegen "defaults" , verifyCppCodegen "empty" , verifyCppCodegen "field_modifiers" , verifyCppCodegen "generics" , verifyCppCodegen "inheritance" , verifyCppCodegen "aliases" , verifyCppCodegen "alias_key" , verifyCodegen [ "c++" , "--allocator=arena" ] "alias_with_allocator" , verifyCodegen [ "c++" , "--allocator=arena" , "--using=List=my::list<{0}, arena>" , "--using=Vector=my::vector<{0}, arena>" , "--using=Set=my::set<{0}, arena>" , "--using=Map=my::map<{0}, {1}, arena>" , "--using=String=my::string<arena>" ] "custom_alias_with_allocator" , verifyCodegen [ "c++" , "--allocator=arena" , "--using=List=my::list<{0}>" , "--using=Vector=my::vector<{0}>" , "--using=Set=my::set<{0}>" , "--using=Map=my::map<{0}, {1}>" , "--using=String=my::string" ] "custom_alias_without_allocator" , verifyApplyCodegen [ "c++" , "--apply-attribute=DllExport" ] "basic_types" ] , testGroup "C#" [ verifyCsCodegen "attributes" , verifyCsCodegen "basic_types" , verifyCsCodegen "complex_types" , verifyCsCodegen "defaults" , verifyCsCodegen "empty" , verifyCsCodegen "field_modifiers" , verifyCsCodegen "generics" , verifyCsCodegen "inheritance" , verifyCsCodegen "aliases" , verifyCsCodegen "nullable_alias" ] ] ]
2,916
tests = testGroup "Compiler tests" [ testGroup "AST" [ localOption (QuickCheckMaxSize 15) $ testProperty "roundtrip" roundtripAST , testGroup "Compare .bond and .json" [ testCase "attributes" $ compareAST "attributes" , testCase "basic types" $ compareAST "basic_types" , testCase "complex types" $ compareAST "complex_types" , testCase "default values" $ compareAST "defaults" , testCase "empty" $ compareAST "empty" , testCase "field modifiers" $ compareAST "field_modifiers" , testCase "generics" $ compareAST "generics" , testCase "inheritance" $ compareAST "inheritance" , testCase "type aliases" $ compareAST "aliases" ] ] , testGroup "Codegen" [ testGroup "C++" [ verifyCppCodegen "attributes" , verifyCppCodegen "basic_types" , verifyCppCodegen "complex_types" , verifyCppCodegen "defaults" , verifyCppCodegen "empty" , verifyCppCodegen "field_modifiers" , verifyCppCodegen "generics" , verifyCppCodegen "inheritance" , verifyCppCodegen "aliases" , verifyCppCodegen "alias_key" , verifyCodegen [ "c++" , "--allocator=arena" ] "alias_with_allocator" , verifyCodegen [ "c++" , "--allocator=arena" , "--using=List=my::list<{0}, arena>" , "--using=Vector=my::vector<{0}, arena>" , "--using=Set=my::set<{0}, arena>" , "--using=Map=my::map<{0}, {1}, arena>" , "--using=String=my::string<arena>" ] "custom_alias_with_allocator" , verifyCodegen [ "c++" , "--allocator=arena" , "--using=List=my::list<{0}>" , "--using=Vector=my::vector<{0}>" , "--using=Set=my::set<{0}>" , "--using=Map=my::map<{0}, {1}>" , "--using=String=my::string" ] "custom_alias_without_allocator" , verifyApplyCodegen [ "c++" , "--apply-attribute=DllExport" ] "basic_types" ] , testGroup "C#" [ verifyCsCodegen "attributes" , verifyCsCodegen "basic_types" , verifyCsCodegen "complex_types" , verifyCsCodegen "defaults" , verifyCsCodegen "empty" , verifyCsCodegen "field_modifiers" , verifyCsCodegen "generics" , verifyCsCodegen "inheritance" , verifyCsCodegen "aliases" , verifyCsCodegen "nullable_alias" ] ] ]
2,898
false
true
0
12
1,132
408
205
203
null
null
ngeiswei/opencog
opencog/nlp/lojban/HaskellLib/src/OpenCog/Lojban/Syntax/Util.hs
agpl-3.0
rmFlagIso :: Flag -> SynIso a a rmFlagIso flag = inverse $ setFlagIso flag
74
rmFlagIso :: Flag -> SynIso a a rmFlagIso flag = inverse $ setFlagIso flag
74
rmFlagIso flag = inverse $ setFlagIso flag
42
false
true
0
6
13
30
14
16
null
null
timtylin/scholdoc
src/Text/Pandoc/Writers/Custom.hs
gpl-2.0
-- | Convert list of Pandoc block elements to Custom. blockListToCustom :: LuaState -- ^ Options -> [Block] -- ^ List of block elements -> IO ByteString blockListToCustom lua xs = do blocksep <- callfunc lua "Blocksep" bs <- mapM (blockToCustom lua) xs return $ mconcat $ intersperse blocksep bs -- | Convert list of Pandoc inline elements to Custom.
399
blockListToCustom :: LuaState -- ^ Options -> [Block] -- ^ List of block elements -> IO ByteString blockListToCustom lua xs = do blocksep <- callfunc lua "Blocksep" bs <- mapM (blockToCustom lua) xs return $ mconcat $ intersperse blocksep bs -- | Convert list of Pandoc inline elements to Custom.
345
blockListToCustom lua xs = do blocksep <- callfunc lua "Blocksep" bs <- mapM (blockToCustom lua) xs return $ mconcat $ intersperse blocksep bs -- | Convert list of Pandoc inline elements to Custom.
204
true
true
0
10
108
80
39
41
null
null
dysinger/amazonka
amazonka-iam/gen/Network/AWS/IAM/Types.hs
mpl-2.0
-- | The ID for this access key. akAccessKeyId :: Lens' AccessKey Text akAccessKeyId = lens _akAccessKeyId (\s a -> s { _akAccessKeyId = a })
141
akAccessKeyId :: Lens' AccessKey Text akAccessKeyId = lens _akAccessKeyId (\s a -> s { _akAccessKeyId = a })
108
akAccessKeyId = lens _akAccessKeyId (\s a -> s { _akAccessKeyId = a })
70
true
true
0
9
25
47
23
24
null
null
I3ck/HGE2D
src/HGE2D/Colors.hs
mit
colorWater :: GlColorRGB colorWater = (0, 0, 1)
47
colorWater :: GlColorRGB colorWater = (0, 0, 1)
47
colorWater = (0, 0, 1)
22
false
true
0
6
7
27
13
14
null
null
ekmett/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_NSIS_DEFAULT :: Int wxSTC_NSIS_DEFAULT = 0
48
wxSTC_NSIS_DEFAULT :: Int wxSTC_NSIS_DEFAULT = 0
48
wxSTC_NSIS_DEFAULT = 0
22
false
true
0
6
5
18
7
11
null
null
li-zhirui/EoplLangs
src/CallByReference/Parser.hs
bsd-3-clause
beginExpr :: Parser Expression beginExpr = do keyWord "begin" exprs <- sepBy1 (try expression) semiColon keyWord "end" return $ BeginExpr exprs
151
beginExpr :: Parser Expression beginExpr = do keyWord "begin" exprs <- sepBy1 (try expression) semiColon keyWord "end" return $ BeginExpr exprs
151
beginExpr = do keyWord "begin" exprs <- sepBy1 (try expression) semiColon keyWord "end" return $ BeginExpr exprs
120
false
true
0
10
28
54
23
31
null
null