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
futufeld/eclogues
eclogues-impl/gen-hs/AuroraAdmin_Client.hs
bsd-3-clause
endMaintenance (ip,op) arg_hosts arg_session = do send_endMaintenance op arg_hosts arg_session recv_endMaintenance ip
121
endMaintenance (ip,op) arg_hosts arg_session = do send_endMaintenance op arg_hosts arg_session recv_endMaintenance ip
121
endMaintenance (ip,op) arg_hosts arg_session = do send_endMaintenance op arg_hosts arg_session recv_endMaintenance ip
121
false
false
1
8
15
38
16
22
null
null
Javran/Project-Euler
src/ProjectEuler/Problem84.hs
mit
problem :: Problem problem = pureProblem 84 Solved result
57
problem :: Problem problem = pureProblem 84 Solved result
57
problem = pureProblem 84 Solved result
38
false
true
0
5
8
18
9
9
null
null
li-zhirui/EoplLangs
src/LetRecLang/Data.hs
bsd-3-clause
apply :: Environment -> String -> Maybe DenotedValue apply = flip M.lookup
74
apply :: Environment -> String -> Maybe DenotedValue apply = flip M.lookup
74
apply = flip M.lookup
21
false
true
0
8
11
32
14
18
null
null
TomMD/ghc
compiler/utils/Outputable.hs
bsd-3-clause
semi = docToSDoc $ Pretty.semi
36
semi = docToSDoc $ Pretty.semi
36
semi = docToSDoc $ Pretty.semi
36
false
false
0
6
10
12
6
6
null
null
termite2/tsl
Frontend/NS.hs
bsd-3-clause
objLookup (ObjRelation t r) n = fmap (ObjRArg (ScopeRelation t r)) $ find ((== n) . name) (relArg r)
100
objLookup (ObjRelation t r) n = fmap (ObjRArg (ScopeRelation t r)) $ find ((== n) . name) (relArg r)
100
objLookup (ObjRelation t r) n = fmap (ObjRArg (ScopeRelation t r)) $ find ((== n) . name) (relArg r)
100
false
false
0
10
18
62
31
31
null
null
vincenthz/cryptonite
tests/KAT_Scrypt.hs
bsd-3-clause
vectors :: [ ((ByteString, ByteString, Word64, Int, Int, Int), ByteString) ] vectors = [ ( ("", "", 16, 1, 1, 64) , "\x77\xd6\x57\x62\x38\x65\x7b\x20\x3b\x19\xca\x42\xc1\x8a\x04\x97\xf1\x6b\x48\x44\xe3\x07\x4a\xe8\xdf\xdf\xfa\x3f\xed\xe2\x14\x42\xfc\xd0\x06\x9d\xed\x09\x48\xf8\x32\x6a\x75\x3a\x0f\xc8\x1f\x17\xe8\xd3\xe0\xfb\x2e\x0d\x36\x28\xcf\x35\xe2\x0c\x38\xd1\x89\x06" ) , ( ("password", "NaCl", 1024, 8, 16, 64) , "\xfd\xba\xbe\x1c\x9d\x34\x72\x00\x78\x56\xe7\x19\x0d\x01\xe9\xfe\x7c\x6a\xd7\xcb\xc8\x23\x78\x30\xe7\x73\x76\x63\x4b\x37\x31\x62\x2e\xaf\x30\xd9\x2e\x22\xa3\x88\x6f\xf1\x09\x27\x9d\x98\x30\xda\xc7\x27\xaf\xb9\x4a\x83\xee\x6d\x83\x60\xcb\xdf\xa2\xcc\x06\x40" ) , ( ("pleaseletmein", "SodiumChloride", 16384, 8, 1, 64) , "\x70\x23\xbd\xcb\x3a\xfd\x73\x48\x46\x1c\x06\xcd\x81\xfd\x38\xeb\xfd\xa8\xfb\xba\x90\x4f\x8e\x3e\xa9\xb5\x43\xf6\x54\x5d\xa1\xf2\xd5\x43\x29\x55\x61\x3f\x0f\xcf\x62\xd4\x97\x05\x24\x2a\x9a\xf9\xe6\x1e\x85\xdc\x0d\x65\x1e\x40\xdf\xcf\x01\x7b\x45\x57\x58\x87" ) , ( ("pleaseletmein", "SodiumChloride", 1048576, 8, 1, 64) , "\x21\x01\xcb\x9b\x6a\x51\x1a\xae\xad\xdb\xbe\x09\xcf\x70\xf8\x81\xec\x56\x8d\x57\x4a\x2f\xfd\x4d\xab\xe5\xee\x98\x20\xad\xaa\x47\x8e\x56\xfd\x8f\x4b\xa5\xd0\x9f\xfa\x1c\x6d\x92\x7c\x40\xf4\xc3\x37\x30\x40\x49\xe8\xa9\x52\xfb\xcb\xf4\x5c\x6f\xa7\x7a\x41\xa4" ) ]
1,423
vectors :: [ ((ByteString, ByteString, Word64, Int, Int, Int), ByteString) ] vectors = [ ( ("", "", 16, 1, 1, 64) , "\x77\xd6\x57\x62\x38\x65\x7b\x20\x3b\x19\xca\x42\xc1\x8a\x04\x97\xf1\x6b\x48\x44\xe3\x07\x4a\xe8\xdf\xdf\xfa\x3f\xed\xe2\x14\x42\xfc\xd0\x06\x9d\xed\x09\x48\xf8\x32\x6a\x75\x3a\x0f\xc8\x1f\x17\xe8\xd3\xe0\xfb\x2e\x0d\x36\x28\xcf\x35\xe2\x0c\x38\xd1\x89\x06" ) , ( ("password", "NaCl", 1024, 8, 16, 64) , "\xfd\xba\xbe\x1c\x9d\x34\x72\x00\x78\x56\xe7\x19\x0d\x01\xe9\xfe\x7c\x6a\xd7\xcb\xc8\x23\x78\x30\xe7\x73\x76\x63\x4b\x37\x31\x62\x2e\xaf\x30\xd9\x2e\x22\xa3\x88\x6f\xf1\x09\x27\x9d\x98\x30\xda\xc7\x27\xaf\xb9\x4a\x83\xee\x6d\x83\x60\xcb\xdf\xa2\xcc\x06\x40" ) , ( ("pleaseletmein", "SodiumChloride", 16384, 8, 1, 64) , "\x70\x23\xbd\xcb\x3a\xfd\x73\x48\x46\x1c\x06\xcd\x81\xfd\x38\xeb\xfd\xa8\xfb\xba\x90\x4f\x8e\x3e\xa9\xb5\x43\xf6\x54\x5d\xa1\xf2\xd5\x43\x29\x55\x61\x3f\x0f\xcf\x62\xd4\x97\x05\x24\x2a\x9a\xf9\xe6\x1e\x85\xdc\x0d\x65\x1e\x40\xdf\xcf\x01\x7b\x45\x57\x58\x87" ) , ( ("pleaseletmein", "SodiumChloride", 1048576, 8, 1, 64) , "\x21\x01\xcb\x9b\x6a\x51\x1a\xae\xad\xdb\xbe\x09\xcf\x70\xf8\x81\xec\x56\x8d\x57\x4a\x2f\xfd\x4d\xab\xe5\xee\x98\x20\xad\xaa\x47\x8e\x56\xfd\x8f\x4b\xa5\xd0\x9f\xfa\x1c\x6d\x92\x7c\x40\xf4\xc3\x37\x30\x40\x49\xe8\xa9\x52\xfb\xcb\xf4\x5c\x6f\xa7\x7a\x41\xa4" ) ]
1,423
vectors = [ ( ("", "", 16, 1, 1, 64) , "\x77\xd6\x57\x62\x38\x65\x7b\x20\x3b\x19\xca\x42\xc1\x8a\x04\x97\xf1\x6b\x48\x44\xe3\x07\x4a\xe8\xdf\xdf\xfa\x3f\xed\xe2\x14\x42\xfc\xd0\x06\x9d\xed\x09\x48\xf8\x32\x6a\x75\x3a\x0f\xc8\x1f\x17\xe8\xd3\xe0\xfb\x2e\x0d\x36\x28\xcf\x35\xe2\x0c\x38\xd1\x89\x06" ) , ( ("password", "NaCl", 1024, 8, 16, 64) , "\xfd\xba\xbe\x1c\x9d\x34\x72\x00\x78\x56\xe7\x19\x0d\x01\xe9\xfe\x7c\x6a\xd7\xcb\xc8\x23\x78\x30\xe7\x73\x76\x63\x4b\x37\x31\x62\x2e\xaf\x30\xd9\x2e\x22\xa3\x88\x6f\xf1\x09\x27\x9d\x98\x30\xda\xc7\x27\xaf\xb9\x4a\x83\xee\x6d\x83\x60\xcb\xdf\xa2\xcc\x06\x40" ) , ( ("pleaseletmein", "SodiumChloride", 16384, 8, 1, 64) , "\x70\x23\xbd\xcb\x3a\xfd\x73\x48\x46\x1c\x06\xcd\x81\xfd\x38\xeb\xfd\xa8\xfb\xba\x90\x4f\x8e\x3e\xa9\xb5\x43\xf6\x54\x5d\xa1\xf2\xd5\x43\x29\x55\x61\x3f\x0f\xcf\x62\xd4\x97\x05\x24\x2a\x9a\xf9\xe6\x1e\x85\xdc\x0d\x65\x1e\x40\xdf\xcf\x01\x7b\x45\x57\x58\x87" ) , ( ("pleaseletmein", "SodiumChloride", 1048576, 8, 1, 64) , "\x21\x01\xcb\x9b\x6a\x51\x1a\xae\xad\xdb\xbe\x09\xcf\x70\xf8\x81\xec\x56\x8d\x57\x4a\x2f\xfd\x4d\xab\xe5\xee\x98\x20\xad\xaa\x47\x8e\x56\xfd\x8f\x4b\xa5\xd0\x9f\xfa\x1c\x6d\x92\x7c\x40\xf4\xc3\x37\x30\x40\x49\xe8\xa9\x52\xfb\xcb\xf4\x5c\x6f\xa7\x7a\x41\xa4" ) ]
1,346
false
true
0
7
155
146
96
50
null
null
maque/Hate
src/Hate/Common.hs
mit
-- Assuming this doesn't change, for now -- this actually controls update rate, as the display -- rate is vsynced desiredFPS = 60.0
131
desiredFPS = 60.0
17
desiredFPS = 60.0
17
true
false
1
5
22
13
6
7
null
null
j-mueller/hldb
webapp/VirtualHom/Svg.hs
bsd-3-clause
-- | The @unicodeBidi@ attribute. unicode_bidi :: AttrTag unicode_bidi = makeAttribute "unicode-bidi"
101
unicode_bidi :: AttrTag unicode_bidi = makeAttribute "unicode-bidi"
67
unicode_bidi = makeAttribute "unicode-bidi"
43
true
true
0
5
11
15
8
7
null
null
JacquesCarette/literate-scientific-software
code/drasil-example/Drasil/GamePhysics/Unitals.hs
bsd-2-clause
perpLenB = perpParam "B" $ eqSymb contDispB
46
perpLenB = perpParam "B" $ eqSymb contDispB
46
perpLenB = perpParam "B" $ eqSymb contDispB
46
false
false
1
6
9
19
7
12
null
null
Zankoku-Okuno/octopus
Language/Octopus/Parser/Import.hs
gpl-3.0
pushExplicit :: Int -> Parser () pushExplicit n = layoutOnly $ modifyState (Explicit n :)
89
pushExplicit :: Int -> Parser () pushExplicit n = layoutOnly $ modifyState (Explicit n :)
89
pushExplicit n = layoutOnly $ modifyState (Explicit n :)
56
false
true
0
8
14
37
18
19
null
null
spencerjanssen/cabal2nix
src/Cabal2Nix/License.hs
bsd-3-clause
fromCabalLicense PublicDomain = Known "stdenv.lib.licenses.publicDomain"
98
fromCabalLicense PublicDomain = Known "stdenv.lib.licenses.publicDomain"
98
fromCabalLicense PublicDomain = Known "stdenv.lib.licenses.publicDomain"
98
false
false
0
5
30
13
5
8
null
null
leohahn/scheme-interpreter
.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/Paths_scheme_interpreter.hs
bsd-3-clause
libdir = "/home/lhahn/dev/haskell/scheme-interpreter/.stack-work/install/x86_64-linux/lts-4.2/7.10.3/lib/x86_64-linux-ghc-7.10.3/scheme-interpreter-0.1.0.0-JKJnTqsSGsY8xQJBR5BvwX"
183
libdir = "/home/lhahn/dev/haskell/scheme-interpreter/.stack-work/install/x86_64-linux/lts-4.2/7.10.3/lib/x86_64-linux-ghc-7.10.3/scheme-interpreter-0.1.0.0-JKJnTqsSGsY8xQJBR5BvwX"
183
libdir = "/home/lhahn/dev/haskell/scheme-interpreter/.stack-work/install/x86_64-linux/lts-4.2/7.10.3/lib/x86_64-linux-ghc-7.10.3/scheme-interpreter-0.1.0.0-JKJnTqsSGsY8xQJBR5BvwX"
183
false
false
1
5
6
10
3
7
null
null
diogob/postgrest
test/Feature/RangeSpec.hs
mit
emptyRange :: BL.ByteString emptyRange = [json| { "min": 2, "max": 2 } |]
73
emptyRange :: BL.ByteString emptyRange = [json| { "min": 2, "max": 2 } |]
73
emptyRange = [json| { "min": 2, "max": 2 } |]
45
false
true
0
7
12
24
12
12
null
null
kallisti-dev/portalchess
PortalChess.hs
bsd-3-clause
moveSet c (Just (Piece player piece)) = case piece of Pawn -> forwardStep `mplus` diagCapture where forwardStep = linearStep . Move c . startDirFor $ player diagCapture = (mplus `on` step captureRule . Move c) diag1 diag2 (diag1, diag2) = rotateCW &&& rotateCCW $ startDirFor player captureRule = ifBlocked `mplus` followPortal >>= localMove ifBlocked Arrow _ -> noMove `mplus` walkAll diagMoves `mplus` stepAll cardMoves Lens _ -> noMove `mplus` walkAll (cardMoves `mplus` diagMoves) Portal d _ -> noMove `mplus` stepWith (chebyshevStep 3) undefined (Move c undefined) cannon_or_king -> stepAll (cardMoves `mplus` diagMoves) where noMove = return $ Move c North cardMoves = cardinalMovesOf c diagMoves = diagonalMovesOf c
811
moveSet c (Just (Piece player piece)) = case piece of Pawn -> forwardStep `mplus` diagCapture where forwardStep = linearStep . Move c . startDirFor $ player diagCapture = (mplus `on` step captureRule . Move c) diag1 diag2 (diag1, diag2) = rotateCW &&& rotateCCW $ startDirFor player captureRule = ifBlocked `mplus` followPortal >>= localMove ifBlocked Arrow _ -> noMove `mplus` walkAll diagMoves `mplus` stepAll cardMoves Lens _ -> noMove `mplus` walkAll (cardMoves `mplus` diagMoves) Portal d _ -> noMove `mplus` stepWith (chebyshevStep 3) undefined (Move c undefined) cannon_or_king -> stepAll (cardMoves `mplus` diagMoves) where noMove = return $ Move c North cardMoves = cardinalMovesOf c diagMoves = diagonalMovesOf c
811
moveSet c (Just (Piece player piece)) = case piece of Pawn -> forwardStep `mplus` diagCapture where forwardStep = linearStep . Move c . startDirFor $ player diagCapture = (mplus `on` step captureRule . Move c) diag1 diag2 (diag1, diag2) = rotateCW &&& rotateCCW $ startDirFor player captureRule = ifBlocked `mplus` followPortal >>= localMove ifBlocked Arrow _ -> noMove `mplus` walkAll diagMoves `mplus` stepAll cardMoves Lens _ -> noMove `mplus` walkAll (cardMoves `mplus` diagMoves) Portal d _ -> noMove `mplus` stepWith (chebyshevStep 3) undefined (Move c undefined) cannon_or_king -> stepAll (cardMoves `mplus` diagMoves) where noMove = return $ Move c North cardMoves = cardinalMovesOf c diagMoves = diagonalMovesOf c
811
false
false
2
14
196
285
143
142
null
null
HaskellForCats/HaskellForCats
EstTaxQrt/estTax3rdQrt.hs
mit
taxAlbany = ( earnedQt*albanyOblig)
35
taxAlbany = ( earnedQt*albanyOblig)
35
taxAlbany = ( earnedQt*albanyOblig)
35
false
false
1
7
3
17
7
10
null
null
eklavya/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
strLogCat IIBC = "ibc"
27
strLogCat IIBC = "ibc"
27
strLogCat IIBC = "ibc"
27
false
false
0
5
8
9
4
5
null
null
travitch/llvm-analysis
src/LLVM/Analysis/CallGraph/Internal.hs
bsd-3-clause
callSiteTargets cg (InvokeInst { invokeFunction = f}) = callValueTargets cg f
79
callSiteTargets cg (InvokeInst { invokeFunction = f}) = callValueTargets cg f
79
callSiteTargets cg (InvokeInst { invokeFunction = f}) = callValueTargets cg f
79
false
false
0
8
12
31
14
17
null
null
dysinger/amazonka
amazonka-dynamodb/gen/Network/AWS/DynamoDB/Scan.hs
mpl-2.0
-- | A string that identifies one or more attributes to retrieve from the -- specified table or index. These attributes can include scalars, sets, or -- elements of a JSON document. The attributes in the expression must be -- separated by commas. -- -- If no attribute names are specified, then all attributes will be returned. -- If any of the requested attributes are not found, they will not appear in the -- result. -- -- For more information, go to <http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html Accessing Item Attributes> in the /Amazon DynamoDBDeveloper Guide/. sProjectionExpression :: Lens' Scan (Maybe Text) sProjectionExpression = lens _sProjectionExpression (\s a -> s { _sProjectionExpression = a })
775
sProjectionExpression :: Lens' Scan (Maybe Text) sProjectionExpression = lens _sProjectionExpression (\s a -> s { _sProjectionExpression = a })
147
sProjectionExpression = lens _sProjectionExpression (\s a -> s { _sProjectionExpression = a })
98
true
true
0
9
113
55
34
21
null
null
raichoo/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
reflectRawQuotePattern unq (RApp f x) = do fH <- getNameFrom (sMN 0 "f") claim fH (Var (reflm "Raw")) movelast fH xH <- getNameFrom (sMN 0 "x") claim xH (Var (reflm "Raw")) movelast xH fill $ reflCall "RApp" [Var fH, Var xH] solve focus fH; reflectRawQuotePattern unq f focus xH; reflectRawQuotePattern unq x
355
reflectRawQuotePattern unq (RApp f x) = do fH <- getNameFrom (sMN 0 "f") claim fH (Var (reflm "Raw")) movelast fH xH <- getNameFrom (sMN 0 "x") claim xH (Var (reflm "Raw")) movelast xH fill $ reflCall "RApp" [Var fH, Var xH] solve focus fH; reflectRawQuotePattern unq f focus xH; reflectRawQuotePattern unq x
355
reflectRawQuotePattern unq (RApp f x) = do fH <- getNameFrom (sMN 0 "f") claim fH (Var (reflm "Raw")) movelast fH xH <- getNameFrom (sMN 0 "x") claim xH (Var (reflm "Raw")) movelast xH fill $ reflCall "RApp" [Var fH, Var xH] solve focus fH; reflectRawQuotePattern unq f focus xH; reflectRawQuotePattern unq x
355
false
false
0
11
98
164
71
93
null
null
spwhitton/srem
src/Utility/EventCache.hs
gpl-3.0
makeEventCSV :: Reminder -> String makeEventCSV r = (show . getReminderHour $ r) ++ "," ++ (show . getReminderMinute $ r) ++ "," ++ getReminderText r
185
makeEventCSV :: Reminder -> String makeEventCSV r = (show . getReminderHour $ r) ++ "," ++ (show . getReminderMinute $ r) ++ "," ++ getReminderText r
185
makeEventCSV r = (show . getReminderHour $ r) ++ "," ++ (show . getReminderMinute $ r) ++ "," ++ getReminderText r
148
false
true
0
11
61
59
30
29
null
null
jparyani/capnproto-boostpython
compiler/src/Parser.hs
bsd-2-clause
unionDecl statements = do (name, ordinal) <- nameWithOrdinal unionKeyword annotations <- many annotation children <- parseBlock unionLine statements return (UnionDecl name ordinal annotations children)
221
unionDecl statements = do (name, ordinal) <- nameWithOrdinal unionKeyword annotations <- many annotation children <- parseBlock unionLine statements return (UnionDecl name ordinal annotations children)
221
unionDecl statements = do (name, ordinal) <- nameWithOrdinal unionKeyword annotations <- many annotation children <- parseBlock unionLine statements return (UnionDecl name ordinal annotations children)
221
false
false
0
9
43
65
29
36
null
null
leepike/copilot-c99
src/Copilot/Compile/C99/Test/Driver.hs
bsd-3-clause
-------------------------------------------------------------------------------- ppEnvDecls :: Int -> [ExtVars] -> Doc ppEnvDecls numIterations vars = vcat $ [ space , text "// External variables" , vcat $ map ppEnvDecl vars , space , text "// External values" , vcat $ map ppVals vars , space , space ] where ppEnvDecl :: (Name, DynamicF [] Type) -> Doc ppEnvDecl (name, DynamicF _ t) = cType <+> text name <> semi where cType = ppUType UType { uTypeType = t } ppVals :: (Name, DynamicF [] Type) -> Doc ppVals (name, DynamicF vals t) = cType <+> valsName name <> lbrack <> (text . show) numIterations <> rbrack <+> equals <+> lbrace <+> arrVals <+> rbrace <> semi where cType = ppUType UType { uTypeType = t } arrVals = hsep $ punctuate comma $ map text showVals showVals = map (showWithType C t) vals --------------------------------------------------------------------------------
990
ppEnvDecls :: Int -> [ExtVars] -> Doc ppEnvDecls numIterations vars = vcat $ [ space , text "// External variables" , vcat $ map ppEnvDecl vars , space , text "// External values" , vcat $ map ppVals vars , space , space ] where ppEnvDecl :: (Name, DynamicF [] Type) -> Doc ppEnvDecl (name, DynamicF _ t) = cType <+> text name <> semi where cType = ppUType UType { uTypeType = t } ppVals :: (Name, DynamicF [] Type) -> Doc ppVals (name, DynamicF vals t) = cType <+> valsName name <> lbrack <> (text . show) numIterations <> rbrack <+> equals <+> lbrace <+> arrVals <+> rbrace <> semi where cType = ppUType UType { uTypeType = t } arrVals = hsep $ punctuate comma $ map text showVals showVals = map (showWithType C t) vals --------------------------------------------------------------------------------
908
ppEnvDecls numIterations vars = vcat $ [ space , text "// External variables" , vcat $ map ppEnvDecl vars , space , text "// External values" , vcat $ map ppVals vars , space , space ] where ppEnvDecl :: (Name, DynamicF [] Type) -> Doc ppEnvDecl (name, DynamicF _ t) = cType <+> text name <> semi where cType = ppUType UType { uTypeType = t } ppVals :: (Name, DynamicF [] Type) -> Doc ppVals (name, DynamicF vals t) = cType <+> valsName name <> lbrack <> (text . show) numIterations <> rbrack <+> equals <+> lbrace <+> arrVals <+> rbrace <> semi where cType = ppUType UType { uTypeType = t } arrVals = hsep $ punctuate comma $ map text showVals showVals = map (showWithType C t) vals --------------------------------------------------------------------------------
870
true
true
0
14
247
301
157
144
null
null
urbanslug/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
toListClassOpKey = mkPreludeMiscIdUnique 501
44
toListClassOpKey = mkPreludeMiscIdUnique 501
44
toListClassOpKey = mkPreludeMiscIdUnique 501
44
false
false
0
5
3
9
4
5
null
null
corajr/adventofcode2015
8/Strings.hs
mit
main = do input <- readFile "input.txt" print $ partTwo input
65
main = do input <- readFile "input.txt" print $ partTwo input
65
main = do input <- readFile "input.txt" print $ partTwo input
65
false
false
1
9
14
30
11
19
null
null
spacekitteh/smcghc
libraries/ghc-prim/GHC/Classes.hs
bsd-3-clause
not False = True
31
not False = True
31
not False = True
31
false
false
0
4
18
10
4
6
null
null
braidchat/greeterbot
src/Data/Transit.hs
epl-1.0
bi :: (a -> b) -> (a, a) -> (b, b) bi f (x, y) = (f x, f y)
59
bi :: (a -> b) -> (a, a) -> (b, b) bi f (x, y) = (f x, f y)
59
bi f (x, y) = (f x, f y)
24
false
true
0
7
19
66
35
31
null
null
Lyapunov/haskell-programming-from-first-principles
chapter_9/my_enum_from_to.hs
mit
-- ordering is easy for Char as well eftChar :: Char -> Char -> [Char] eftChar x y | x > y = [] | otherwise = x : eftChar (succ x) y
134
eftChar :: Char -> Char -> [Char] eftChar x y | x > y = [] | otherwise = x : eftChar (succ x) y
97
eftChar x y | x > y = [] | otherwise = x : eftChar (succ x) y
63
true
true
2
9
34
74
33
41
null
null
phischu/fragnix
tests/packages/scotty/Data.Text.Lazy.Builder.RealFloat.hs
bsd-3-clause
floatToDigits 0 = ([0], 0)
26
floatToDigits 0 = ([0], 0)
26
floatToDigits 0 = ([0], 0)
26
false
false
1
6
4
21
10
11
null
null
MnO2/hindley-milner
src/HM/HigherRank.hs
bsd-3-clause
tcRho (ALam var var_ty body) (Check exp_ty) = do { (arg_ty, body_ty) <- unifyFun exp_ty ; subsCheck arg_ty var_ty ; extendVarEnv var var_ty (checkRho body body_ty) }
182
tcRho (ALam var var_ty body) (Check exp_ty) = do { (arg_ty, body_ty) <- unifyFun exp_ty ; subsCheck arg_ty var_ty ; extendVarEnv var var_ty (checkRho body body_ty) }
182
tcRho (ALam var var_ty body) (Check exp_ty) = do { (arg_ty, body_ty) <- unifyFun exp_ty ; subsCheck arg_ty var_ty ; extendVarEnv var var_ty (checkRho body body_ty) }
182
false
false
1
10
43
78
36
42
null
null
brendanhay/gogol
gogol-dns/gen/Network/Google/DNS/Types/Product.hs
mpl-2.0
-- | The managed zone resources. mzlrManagedZones :: Lens' ManagedZonesListResponse [ManagedZone] mzlrManagedZones = lens _mzlrManagedZones (\ s a -> s{_mzlrManagedZones = a}) . _Default . _Coerce
216
mzlrManagedZones :: Lens' ManagedZonesListResponse [ManagedZone] mzlrManagedZones = lens _mzlrManagedZones (\ s a -> s{_mzlrManagedZones = a}) . _Default . _Coerce
183
mzlrManagedZones = lens _mzlrManagedZones (\ s a -> s{_mzlrManagedZones = a}) . _Default . _Coerce
118
true
true
2
8
45
57
28
29
null
null
DavidAlphaFox/ghc
utils/haddock/haddock-library/src/Documentation/Haddock/Doc.hs
bsd-3-clause
emptyMetaDoc :: MetaDoc mod id emptyMetaDoc = MetaDoc { _meta = emptyMeta, _doc = DocEmpty }
92
emptyMetaDoc :: MetaDoc mod id emptyMetaDoc = MetaDoc { _meta = emptyMeta, _doc = DocEmpty }
92
emptyMetaDoc = MetaDoc { _meta = emptyMeta, _doc = DocEmpty }
61
false
true
1
7
15
37
18
19
null
null
markuspf/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v LCrash [x] = "idris_crash(GETSTR(" ++ creg x ++ "))"
59
doOp v LCrash [x] = "idris_crash(GETSTR(" ++ creg x ++ "))"
59
doOp v LCrash [x] = "idris_crash(GETSTR(" ++ creg x ++ "))"
59
false
false
0
7
10
30
13
17
null
null
merijn/parsers
src/Text/Parser/Char.hs
bsd-3-clause
-- | Parses a tab character (\'\\t\'). Returns a tab character. tab :: CharParsing m => m Char tab = char '\t' <?> "tab"
120
tab :: CharParsing m => m Char tab = char '\t' <?> "tab"
56
tab = char '\t' <?> "tab"
25
true
true
0
6
23
29
14
15
null
null
vladfi1/hs-misc
FactorGraph/FactorGraph.hs
mit
addFactor :: [VKey] -> ((VKey -> v) -> Double) -> FactorGraph v -> FactorGraph v addFactor vkeys w graph@FactorGraph{..} = FactorGraph { variables = variables', factors = Map.insert counter factor factors, counter = counter + 1 } where factor = Factor { vars = Set.fromList vkeys, weight = w, marginals = Map.fromList [(vkey, [(val, 1) | val <- values $ variables ! vkey]) | vkey <- vkeys] } adjustVar var = var { weights = Map.insert counter (const 1) (weights var) } variables' = foldr (Map.adjust adjustVar) variables vkeys
590
addFactor :: [VKey] -> ((VKey -> v) -> Double) -> FactorGraph v -> FactorGraph v addFactor vkeys w graph@FactorGraph{..} = FactorGraph { variables = variables', factors = Map.insert counter factor factors, counter = counter + 1 } where factor = Factor { vars = Set.fromList vkeys, weight = w, marginals = Map.fromList [(vkey, [(val, 1) | val <- values $ variables ! vkey]) | vkey <- vkeys] } adjustVar var = var { weights = Map.insert counter (const 1) (weights var) } variables' = foldr (Map.adjust adjustVar) variables vkeys
590
addFactor vkeys w graph@FactorGraph{..} = FactorGraph { variables = variables', factors = Map.insert counter factor factors, counter = counter + 1 } where factor = Factor { vars = Set.fromList vkeys, weight = w, marginals = Map.fromList [(vkey, [(val, 1) | val <- values $ variables ! vkey]) | vkey <- vkeys] } adjustVar var = var { weights = Map.insert counter (const 1) (weights var) } variables' = foldr (Map.adjust adjustVar) variables vkeys
509
false
true
18
12
152
223
116
107
null
null
waddlaw/TFwH
src/Ch01.hs
bsd-3-clause
-- | -- -- song n は n 人の男が登場する歌 -- song :: Int -> String song n = if n == 0 then "" else song (n-1) ++ "\n" ++ verse n
125
song :: Int -> String song n = if n == 0 then "" else song (n-1) ++ "\n" ++ verse n
90
song n = if n == 0 then "" else song (n-1) ++ "\n" ++ verse n
68
true
true
0
10
38
55
30
25
null
null
WSCU/JSEuterpea
Euterpea Examples/SimpleEuterpea.hs
gpl-3.0
etPitchNote _ = 0
18
getPitchNote _ = 0
18
getPitchNote _ = 0
18
false
false
0
5
4
9
4
5
null
null
green-haskell/ghc
compiler/cmm/CmmNode.hs
bsd-3-clause
foldExp _ (CmmBranch _) z = z
53
foldExp _ (CmmBranch _) z = z
53
foldExp _ (CmmBranch _) z = z
53
false
false
1
6
30
21
9
12
null
null
josuf107/Adverb
Adverb/Common.hs
gpl-3.0
resignedly = id
15
resignedly = id
15
resignedly = id
15
false
false
0
4
2
6
3
3
null
null
janrain/heist
src/Text/Templating/Heist/Internal.hs
bsd-3-clause
loadHook :: Monad m => TemplateState m -> (TPath, InternalTemplate) -> IO (TemplateState m) loadHook ts (tp, t) = do t' <- runHookInternal (_onLoadHook ts) t return $ insertTemplate tp t' ts ------------------------------------------------------------------------------ -- These are here until we can get them into hexpat. ------------------------------------------------------------------------------
411
loadHook :: Monad m => TemplateState m -> (TPath, InternalTemplate) -> IO (TemplateState m) loadHook ts (tp, t) = do t' <- runHookInternal (_onLoadHook ts) t return $ insertTemplate tp t' ts ------------------------------------------------------------------------------ -- These are here until we can get them into hexpat. ------------------------------------------------------------------------------
411
loadHook ts (tp, t) = do t' <- runHookInternal (_onLoadHook ts) t return $ insertTemplate tp t' ts ------------------------------------------------------------------------------ -- These are here until we can get them into hexpat. ------------------------------------------------------------------------------
319
false
true
0
11
54
95
46
49
null
null
ben-schulz/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
bcc i (RESERVE n) = indent i ++ "RESERVE(" ++ show n ++ ");\n"
62
bcc i (RESERVE n) = indent i ++ "RESERVE(" ++ show n ++ ");\n"
62
bcc i (RESERVE n) = indent i ++ "RESERVE(" ++ show n ++ ");\n"
62
false
false
2
7
13
39
16
23
null
null
simhu/cubical
CTT.hs
mit
mapOEnv :: (Val -> Val) -> OEnv -> OEnv mapOEnv f (OEnv e o) = OEnv (mapEnv f e) o
82
mapOEnv :: (Val -> Val) -> OEnv -> OEnv mapOEnv f (OEnv e o) = OEnv (mapEnv f e) o
82
mapOEnv f (OEnv e o) = OEnv (mapEnv f e) o
42
false
true
0
7
19
52
26
26
null
null
codemac/yi-editor
src/Yi/Debug.hs
gpl-2.0
-- | Like traceM, but returns (). traceM_ :: Monad m => String -> m () traceM_ x = traceM x ()
94
traceM_ :: Monad m => String -> m () traceM_ x = traceM x ()
60
traceM_ x = traceM x ()
23
true
true
0
8
21
38
18
20
null
null
flowbox-public/language-c-quote
Language/C/Parser/Monad.hs
bsd-3-clause
allowAnti :: AlexPredicate allowAnti = ifExtension antiquotationExts
68
allowAnti :: AlexPredicate allowAnti = ifExtension antiquotationExts
68
allowAnti = ifExtension antiquotationExts
41
false
true
0
6
6
20
8
12
null
null
snoyberg/ghc
compiler/utils/Pretty.hs
bsd-3-clause
-- Arg of a TextBeside is always an RDoc textBeside_ :: TextDetails -> Int -> RDoc -> RDoc textBeside_ = TextBeside
115
textBeside_ :: TextDetails -> Int -> RDoc -> RDoc textBeside_ = TextBeside
74
textBeside_ = TextBeside
24
true
true
0
7
20
24
13
11
null
null
lunaris/hdevtools
src/Stack.hs
mit
-------------------------------------------------------------------------------- -- | Generic Helpers -------------------------------------------------------------------------------- splitBy :: Char -> String -> [String] splitBy c str | null str' = [x] | otherwise = x : splitBy c (tail str') where (x, str') = span (c /=) str
337
splitBy :: Char -> String -> [String] splitBy c str | null str' = [x] | otherwise = x : splitBy c (tail str') where (x, str') = span (c /=) str
153
splitBy c str | null str' = [x] | otherwise = x : splitBy c (tail str') where (x, str') = span (c /=) str
115
true
true
1
8
48
87
46
41
null
null
8l/metafun
src/Metafun/Compiler.hs
gpl-3.0
compile :: TProgram -> Compiler () compile (Kiff.Program typeDecls defs) = do mapM_ output platformDefs mapM_ compileTypeDecl builtinTys mapM_ compileTypeDecl typeDecls mapM_ compileDef defs where platformDefs = [ MPL.Def "Int" [MPL.MetaInt] [MPL.Specialization [MPL.MetaVarDecl "x" MPL.MetaInt] Nothing [] (MPL.TyInt, MPL.VarRef "x")] , MPL.Def "Bool" [MPL.MetaBool] [MPL.Specialization [MPL.MetaVarDecl "b" MPL.MetaBool] Nothing [] (MPL.TyBool, MPL.VarRef "b")] ] builtinTys = [Kiff.DataDecl "list" ["a"] [nil, cons]] where nil = Kiff.DataCon "nil" [] cons = Kiff.DataCon "cons" [ Kiff.TyVar (Kiff.TvName "a") , Kiff.TyList $ Kiff.TyVar (Kiff.TvName "a") ]
814
compile :: TProgram -> Compiler () compile (Kiff.Program typeDecls defs) = do mapM_ output platformDefs mapM_ compileTypeDecl builtinTys mapM_ compileTypeDecl typeDecls mapM_ compileDef defs where platformDefs = [ MPL.Def "Int" [MPL.MetaInt] [MPL.Specialization [MPL.MetaVarDecl "x" MPL.MetaInt] Nothing [] (MPL.TyInt, MPL.VarRef "x")] , MPL.Def "Bool" [MPL.MetaBool] [MPL.Specialization [MPL.MetaVarDecl "b" MPL.MetaBool] Nothing [] (MPL.TyBool, MPL.VarRef "b")] ] builtinTys = [Kiff.DataDecl "list" ["a"] [nil, cons]] where nil = Kiff.DataCon "nil" [] cons = Kiff.DataCon "cons" [ Kiff.TyVar (Kiff.TvName "a") , Kiff.TyList $ Kiff.TyVar (Kiff.TvName "a") ]
814
compile (Kiff.Program typeDecls defs) = do mapM_ output platformDefs mapM_ compileTypeDecl builtinTys mapM_ compileTypeDecl typeDecls mapM_ compileDef defs where platformDefs = [ MPL.Def "Int" [MPL.MetaInt] [MPL.Specialization [MPL.MetaVarDecl "x" MPL.MetaInt] Nothing [] (MPL.TyInt, MPL.VarRef "x")] , MPL.Def "Bool" [MPL.MetaBool] [MPL.Specialization [MPL.MetaVarDecl "b" MPL.MetaBool] Nothing [] (MPL.TyBool, MPL.VarRef "b")] ] builtinTys = [Kiff.DataDecl "list" ["a"] [nil, cons]] where nil = Kiff.DataCon "nil" [] cons = Kiff.DataCon "cons" [ Kiff.TyVar (Kiff.TvName "a") , Kiff.TyList $ Kiff.TyVar (Kiff.TvName "a") ]
779
false
true
1
13
237
283
140
143
null
null
apoco/wave-machine
src/WaveMachine/Audio/Pitch.hs
unlicense
toneFrequency :: Tone -> Int -> Double toneFrequency tone octave = a4 * (2.0 ** (fromIntegral (toneIndex tone octave) / 12.0))
126
toneFrequency :: Tone -> Int -> Double toneFrequency tone octave = a4 * (2.0 ** (fromIntegral (toneIndex tone octave) / 12.0))
126
toneFrequency tone octave = a4 * (2.0 ** (fromIntegral (toneIndex tone octave) / 12.0))
87
false
true
0
13
20
58
28
30
null
null
olsner/ghc
libraries/template-haskell/Language/Haskell/TH/PprLib.hs
bsd-3-clause
hang d1 n d2 = do d1' <- d1 d2' <- d2 return (HPJ.hang d1' n d2') -- punctuate uses the same definition as Text.PrettyPrint
160
hang d1 n d2 = do d1' <- d1 d2' <- d2 return (HPJ.hang d1' n d2') -- punctuate uses the same definition as Text.PrettyPrint
160
hang d1 n d2 = do d1' <- d1 d2' <- d2 return (HPJ.hang d1' n d2') -- punctuate uses the same definition as Text.PrettyPrint
160
false
false
1
11
61
52
21
31
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/HTMLKeygenElement.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLKeygenElement.reportValidity Mozilla HTMLKeygenElement.reportValidity documentation> reportValidity_ :: (MonadDOM m) => HTMLKeygenElement -> m () reportValidity_ self = liftDOM (void (self ^. jsf "reportValidity" ()))
279
reportValidity_ :: (MonadDOM m) => HTMLKeygenElement -> m () reportValidity_ self = liftDOM (void (self ^. jsf "reportValidity" ()))
134
reportValidity_ self = liftDOM (void (self ^. jsf "reportValidity" ()))
73
true
true
0
11
27
56
28
28
null
null
dbp/hs-stripe
src/Web/Stripe/Client.hs
bsd-3-clause
errorMsg :: BL.ByteString -> Maybe StripeError errorMsg bs = join . fmap getErrorVal $ decode' bs where getErrorVal (Object o) = maybe Nothing (parseMaybe parseJSON) (HML.lookup "error" o) getErrorVal _ = Nothing -- | Attempts to parse error information provided with each error by the Stripe -- API. In the parsing, the error is classified as a specific 'StripeError' and -- any useful data, such as a message explaining the error, is extracted -- accordingly.
479
errorMsg :: BL.ByteString -> Maybe StripeError errorMsg bs = join . fmap getErrorVal $ decode' bs where getErrorVal (Object o) = maybe Nothing (parseMaybe parseJSON) (HML.lookup "error" o) getErrorVal _ = Nothing -- | Attempts to parse error information provided with each error by the Stripe -- API. In the parsing, the error is classified as a specific 'StripeError' and -- any useful data, such as a message explaining the error, is extracted -- accordingly.
479
errorMsg bs = join . fmap getErrorVal $ decode' bs where getErrorVal (Object o) = maybe Nothing (parseMaybe parseJSON) (HML.lookup "error" o) getErrorVal _ = Nothing -- | Attempts to parse error information provided with each error by the Stripe -- API. In the parsing, the error is classified as a specific 'StripeError' and -- any useful data, such as a message explaining the error, is extracted -- accordingly.
432
false
true
0
8
92
93
45
48
null
null
tomjaguarpaw/postgresql-simple
src/Database/PostgreSQL/Simple/LargeObjects.hs
bsd-3-clause
loCreat :: Connection -> IO Oid loCreat conn = liftPQ "loCreat" conn (\c -> PQ.loCreat c)
89
loCreat :: Connection -> IO Oid loCreat conn = liftPQ "loCreat" conn (\c -> PQ.loCreat c)
89
loCreat conn = liftPQ "loCreat" conn (\c -> PQ.loCreat c)
57
false
true
0
9
15
41
20
21
null
null
andrewMacmurray/haskell-book-solutions
src/ch14/VignenereSpec.hs
mit
vignereProp :: Property vignereProp = forAll keywordMessageGen (\(message, key) -> (unvignere (vignere message key) key) == message)
138
vignereProp :: Property vignereProp = forAll keywordMessageGen (\(message, key) -> (unvignere (vignere message key) key) == message)
138
vignereProp = forAll keywordMessageGen (\(message, key) -> (unvignere (vignere message key) key) == message)
114
false
true
0
12
22
58
28
30
null
null
nevrenato/Hets_Fork
CommonLogic/Tools.hs
gpl-2.0
prd_module :: MODULE -> Set.Set NAME prd_module m = case m of Mod _ t _ -> prd_text t Mod_ex _ _ t _ -> prd_text t
137
prd_module :: MODULE -> Set.Set NAME prd_module m = case m of Mod _ t _ -> prd_text t Mod_ex _ _ t _ -> prd_text t
137
prd_module m = case m of Mod _ t _ -> prd_text t Mod_ex _ _ t _ -> prd_text t
100
false
true
0
8
49
61
28
33
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
2676 = 2675
11
2676 = 2675
11
2676 = 2675
11
false
false
1
5
2
10
3
7
null
null
lennart/tidal-midi
Sound/Tidal/VolcaKeys.hs
gpl-3.0
note = makeI oscKeys "note"
27
note = makeI oscKeys "note"
27
note = makeI oscKeys "note"
27
false
false
0
5
4
11
5
6
null
null
vs-team/Papers
Before Giuseppe's PhD/Monads/ObjectiveMonad/MonadicObjects/trunk/Src/Experiments/HList.hs
mit
readonlyfield_get (ReadonlyField(get)) = get
44
readonlyfield_get (ReadonlyField(get)) = get
44
readonlyfield_get (ReadonlyField(get)) = get
44
false
false
0
8
3
18
9
9
null
null
cschneid/strawpollhs
src/server/Main.hs
mit
getPool :: IO DB.ConnectionPool getPool = do let s = "ghci.db" let n = 1 runStdoutLoggingT (DB.createSqlitePool s n)
122
getPool :: IO DB.ConnectionPool getPool = do let s = "ghci.db" let n = 1 runStdoutLoggingT (DB.createSqlitePool s n)
122
getPool = do let s = "ghci.db" let n = 1 runStdoutLoggingT (DB.createSqlitePool s n)
90
false
true
1
11
24
54
23
31
null
null
Pieterjaninfo/PP
FP/block1s1.hs
unlicense
mytake [] n = []
16
mytake [] n = []
16
mytake [] n = []
16
false
false
0
6
4
15
7
8
null
null
Soostone/bloodhound
src/Database/Bloodhound/Client.hs
bsd-3-clause
simpleAccumulator oldHits ([], _) = return (oldHits, Nothing)
61
simpleAccumulator oldHits ([], _) = return (oldHits, Nothing)
61
simpleAccumulator oldHits ([], _) = return (oldHits, Nothing)
61
false
false
0
7
7
28
15
13
null
null
Helium4Haskell/helium
lib/List.hs
gpl-3.0
isPrefixOf (x:xs) (y:ys) = x == y && isPrefixOf xs ys
53
isPrefixOf (x:xs) (y:ys) = x == y && isPrefixOf xs ys
53
isPrefixOf (x:xs) (y:ys) = x == y && isPrefixOf xs ys
53
false
false
0
6
10
40
19
21
null
null
GaloisInc/saw-script
heapster-saw/src/Verifier/SAW/Heapster/archival/JudgmentTranslation/Examples.hs
bsd-3-clause
emptyInfo :: BlocksInfo EmptyCtx emptyInfo = BlocksInfo { entryPoints = [] }
76
emptyInfo :: BlocksInfo EmptyCtx emptyInfo = BlocksInfo { entryPoints = [] }
76
emptyInfo = BlocksInfo { entryPoints = [] }
43
false
true
0
7
11
24
13
11
null
null
gnn/Hets
GUI/GtkAddSentence.hs
gpl-2.0
addSentence :: GInfo -> Int -> DGNodeLab -> G_theory -> IO () addSentence gi n lbl th = do let ln = libName gi iSt = intState gi ost <- readIORef iSt let (ost', hist) = updateNodeProof ln ost (n, lbl) th writeIORef iSt ost' runAndLock gi $ updateGraph gi hist
299
addSentence :: GInfo -> Int -> DGNodeLab -> G_theory -> IO () addSentence gi n lbl th = do let ln = libName gi iSt = intState gi ost <- readIORef iSt let (ost', hist) = updateNodeProof ln ost (n, lbl) th writeIORef iSt ost' runAndLock gi $ updateGraph gi hist
299
addSentence gi n lbl th = do let ln = libName gi iSt = intState gi ost <- readIORef iSt let (ost', hist) = updateNodeProof ln ost (n, lbl) th writeIORef iSt ost' runAndLock gi $ updateGraph gi hist
237
false
true
0
12
90
130
59
71
null
null
FranklinChen/hugs98-plus-Sep2006
packages/base/Data/ByteString.hs
bsd-3-clause
{- -- -- fuseable, but we don't want to walk the whole array. -- find k = foldl findEFL Nothing where findEFL a@(Just _) _ = a findEFL _ c | k c = Just c | otherwise = Nothing -} -- --------------------------------------------------------------------- -- Searching for substrings -- | /O(n)/ The 'isPrefixOf' function takes two ByteStrings and returns 'True' -- iff the first is a prefix of the second. isPrefixOf :: ByteString -> ByteString -> Bool isPrefixOf (PS x1 s1 l1) (PS x2 s2 l2) | l1 == 0 = True | l2 < l1 = False | otherwise = inlinePerformIO $ withForeignPtr x1 $ \p1 -> withForeignPtr x2 $ \p2 -> do i <- memcmp (p1 `plusPtr` s1) (p2 `plusPtr` s2) (fromIntegral l1) return $! i == 0 -- | /O(n)/ The 'isSuffixOf' function takes two ByteStrings and returns 'True' -- iff the first is a suffix of the second. -- -- The following holds: -- -- > isSuffixOf x y == reverse x `isPrefixOf` reverse y -- -- However, the real implemenation uses memcmp to compare the end of the -- string only, with no reverse required..
1,136
isPrefixOf :: ByteString -> ByteString -> Bool isPrefixOf (PS x1 s1 l1) (PS x2 s2 l2) | l1 == 0 = True | l2 < l1 = False | otherwise = inlinePerformIO $ withForeignPtr x1 $ \p1 -> withForeignPtr x2 $ \p2 -> do i <- memcmp (p1 `plusPtr` s1) (p2 `plusPtr` s2) (fromIntegral l1) return $! i == 0 -- | /O(n)/ The 'isSuffixOf' function takes two ByteStrings and returns 'True' -- iff the first is a suffix of the second. -- -- The following holds: -- -- > isSuffixOf x y == reverse x `isPrefixOf` reverse y -- -- However, the real implemenation uses memcmp to compare the end of the -- string only, with no reverse required..
670
isPrefixOf (PS x1 s1 l1) (PS x2 s2 l2) | l1 == 0 = True | l2 < l1 = False | otherwise = inlinePerformIO $ withForeignPtr x1 $ \p1 -> withForeignPtr x2 $ \p2 -> do i <- memcmp (p1 `plusPtr` s1) (p2 `plusPtr` s2) (fromIntegral l1) return $! i == 0 -- | /O(n)/ The 'isSuffixOf' function takes two ByteStrings and returns 'True' -- iff the first is a suffix of the second. -- -- The following holds: -- -- > isSuffixOf x y == reverse x `isPrefixOf` reverse y -- -- However, the real implemenation uses memcmp to compare the end of the -- string only, with no reverse required..
623
true
true
4
11
301
179
93
86
null
null
nevrenato/Hets_Fork
GUI/HTkUtils.hs
gpl-2.0
askFileNameAndSave :: String -- ^ default filename for saving the text -> String -- ^ text to be saved -> IO () askFileNameAndSave defFN txt = do curDir <- getCurrentDirectory selev <- newFileDialogStr "Save file" (curDir ++ '/' : defFN) mfile <- sync selev maybe done saveFile mfile where saveFile fp = writeFile fp txt {- | returns a window displaying the given theory and the given warning text. -}
474
askFileNameAndSave :: String -- ^ default filename for saving the text -> String -- ^ text to be saved -> IO () askFileNameAndSave defFN txt = do curDir <- getCurrentDirectory selev <- newFileDialogStr "Save file" (curDir ++ '/' : defFN) mfile <- sync selev maybe done saveFile mfile where saveFile fp = writeFile fp txt {- | returns a window displaying the given theory and the given warning text. -}
474
askFileNameAndSave defFN txt = do curDir <- getCurrentDirectory selev <- newFileDialogStr "Save file" (curDir ++ '/' : defFN) mfile <- sync selev maybe done saveFile mfile where saveFile fp = writeFile fp txt {- | returns a window displaying the given theory and the given warning text. -}
324
false
true
0
11
142
97
46
51
null
null
ian-ross/cabal
Cabal/Distribution/PackageDescription/Check.hs
bsd-3-clause
repoTypeDirname Monotone = ["_MTN"]
37
repoTypeDirname Monotone = ["_MTN"]
37
repoTypeDirname Monotone = ["_MTN"]
37
false
false
0
5
5
12
6
6
null
null
apyrgio/ganeti
src/Ganeti/Locking/Allocation.hs
bsd-2-clause
-- | Compute the state after an onwer releases all its locks. freeLocks :: (Lock a, Ord b) => LockAllocation a b -> b -> LockAllocation a b freeLocks = freeLocksPredicate (const True)
183
freeLocks :: (Lock a, Ord b) => LockAllocation a b -> b -> LockAllocation a b freeLocks = freeLocksPredicate (const True)
121
freeLocks = freeLocksPredicate (const True)
43
true
true
0
8
32
54
27
27
null
null
Numberartificial/workflow
haskell-first-principles/haskell-programming-from-first-principles-master/src/Chapter9.hs
mit
{- Ciphers We’ll still be using Data.Char for this next exercise. You should save these exercises in a module called Cipher because we’ll be coming back to them in later chapters. You’ll be writing a Caesar cipher for now, but we’ll suggest some variations on the basic program in later chapters. A Caesar cipher is a simple substitution cipher, in which each letter is replaced by the letter that is a fixed number of places down the alphabet from it. You will find variations on this all over the place — you can shift leftward or rightward, for any number of spaces. A rightward shift of 3 means that ’A’ will become ’D’ and ’B’ will become ’E,’ for example. If you did a leftward shift of 5, then ’a’ would become ’v’ and so forth. Your goal in this exercise is to write a basic Caesar cipher that shifts rightward. You can start by having the number of spaces to shift fixed, but it’s more challenging to write a cipher that allows you to vary the number of shifts so that you can encode your secret messages differently each time. There are Caesar ciphers written in Haskell all over the internet, but to maxmize the likelihood that you can write yours without peeking at those, we’ll provide a couple of tips. When yours is working the way you want it to, we would encourage you to then look around and compare your solution to others out there. The first lines of your text file should look like this: module Cipher where import Data.Char Data.Char includes two functions called ord and chr that can be used to associate a Char with its Int representation in the Unicode system and vice versa: *Cipher> :t chr chr :: Int -> Char *Cipher> :t ord ord :: Char -> Int Using these functions is optional; there are other ways you can proceed with shifting, but using chr and ord might simplify the process a bit. You want your shift to wrap back around to the beginning of the alphabet, so that if you have a rightward shift of 3 from ’z,’ you end up back at ’c’ and not somewhere in the vast Unicode hinterlands. Depending on how you’ve set things up, this might be a bit tricky. Consider starting from a base character (e.g., ’a’) and using mod to ensure you’re only shifting over the 26 standard characters of the English alphabet. You should include an unCaesar function that will decipher your text as well. In a later chapter, we will test it. => see Cipher.hs Writing your own standard functions Below are the outlines of some standard functions. The goal here is to write your own versions of these to gain a deeper understanding of recursion over lists and how to make functions flexible enough to accept a variety of inputs. You could figure out how to look up the answers, but you won’t do that because you know you’d only be cheating yourself out of the knowledge. Right? Let’s look at an example of what we’re after here. The and 1 function can take a list of Bool values and returns True if and only if no values in the list are False. Here’s how you might write your own version of it: -- direct recursion, not using (&&) myAnd :: [Bool] -> Bool myAnd [] = True myAnd (x:xs) = if x == False then False else myAnd xs -- direct recursion, using (&&) myAnd :: [Bool] -> Bool myAnd [] = True myAnd (x:xs) = x && myAnd xs And now the fun begins: 1. myOr returns True if any Bool in the list is True. myOr :: [Bool] -> Bool myOr = undefined -} myOr :: [Bool] -> Bool myOr [] = False
3,422
myOr :: [Bool] -> Bool myOr [] = False
44
myOr [] = False
21
true
true
0
6
664
24
13
11
null
null
gorkinovich/Haskell
Checkers/src/Console/Console.hs
mit
printSquare (SquarePiece (Black, King)) = putStr "| B "
55
printSquare (SquarePiece (Black, King)) = putStr "| B "
55
printSquare (SquarePiece (Black, King)) = putStr "| B "
55
false
false
0
7
8
25
12
13
null
null
agrafix/highjson
highjson/src/Data/HighJson/Types.hs
mit
jsonParserRecord :: forall a as. AllHave FromJSON as => RecordSpec a as -> Object -> Parser a jsonParserRecord (RecordSpec mk rflds) obj = mk <$> loop rflds where loop :: forall fs. AllHave FromJSON fs => RecordFields a fs -> Parser (HVect fs) loop flds = case flds of RFEmpty -> pure HNil f :+: fs -> let parse = rf_jsonLoader f obj (rf_jsonKey f) in do x <- parse xs <- loop fs pure (x :&: xs)
549
jsonParserRecord :: forall a as. AllHave FromJSON as => RecordSpec a as -> Object -> Parser a jsonParserRecord (RecordSpec mk rflds) obj = mk <$> loop rflds where loop :: forall fs. AllHave FromJSON fs => RecordFields a fs -> Parser (HVect fs) loop flds = case flds of RFEmpty -> pure HNil f :+: fs -> let parse = rf_jsonLoader f obj (rf_jsonKey f) in do x <- parse xs <- loop fs pure (x :&: xs)
549
jsonParserRecord (RecordSpec mk rflds) obj = mk <$> loop rflds where loop :: forall fs. AllHave FromJSON fs => RecordFields a fs -> Parser (HVect fs) loop flds = case flds of RFEmpty -> pure HNil f :+: fs -> let parse = rf_jsonLoader f obj (rf_jsonKey f) in do x <- parse xs <- loop fs pure (x :&: xs)
455
false
true
0
14
231
187
88
99
null
null
dosenfrucht/beagle
src/Codegen.hs
gpl-2.0
mangle s = "b_" ++ concatMap mangleChar s ++ "_b"
49
mangle s = "b_" ++ concatMap mangleChar s ++ "_b"
49
mangle s = "b_" ++ concatMap mangleChar s ++ "_b"
49
false
false
0
7
9
22
10
12
null
null
termite2/tsl
Frontend/ExprOps.hs
bsd-3-clause
exprCallees s (ETernOp _ e1 e2 e3) = exprCallees s e1 ++ exprCallees s e2 ++ exprCallees s e3
98
exprCallees s (ETernOp _ e1 e2 e3) = exprCallees s e1 ++ exprCallees s e2 ++ exprCallees s e3
98
exprCallees s (ETernOp _ e1 e2 e3) = exprCallees s e1 ++ exprCallees s e2 ++ exprCallees s e3
98
false
false
0
7
23
46
21
25
null
null
jvilar/hrows
lib/GUI/DialogManager/Actions.hs
gpl-2.0
isResponse :: Int32 -> ResponseType -> Bool isResponse r = (== r) . fromIntegral . fromEnum
91
isResponse :: Int32 -> ResponseType -> Bool isResponse r = (== r) . fromIntegral . fromEnum
91
isResponse r = (== r) . fromIntegral . fromEnum
47
false
true
1
8
15
40
19
21
null
null
dsorokin/aivika-experiment
Simulation/Aivika/Experiment/Base/FinalTableView.hs
bsd-3-clause
requireFinalTableResults :: FinalTableViewState -> [String] -> IO FinalTableResults requireFinalTableResults st names = maybePutMVar (finalTableResults st) (newFinalTableResults names (finalTableExperiment st)) $ \results -> if (names /= finalTableNames results) then error "Series with different names are returned for different runs: requireFinalTableResults" else return results
391
requireFinalTableResults :: FinalTableViewState -> [String] -> IO FinalTableResults requireFinalTableResults st names = maybePutMVar (finalTableResults st) (newFinalTableResults names (finalTableExperiment st)) $ \results -> if (names /= finalTableNames results) then error "Series with different names are returned for different runs: requireFinalTableResults" else return results
391
requireFinalTableResults st names = maybePutMVar (finalTableResults st) (newFinalTableResults names (finalTableExperiment st)) $ \results -> if (names /= finalTableNames results) then error "Series with different names are returned for different runs: requireFinalTableResults" else return results
307
false
true
0
10
51
89
44
45
null
null
plaimi/blubber-server
src/Blubber/Server/ViewPort.hs
agpl-3.0
viewPort :: World -> String -> ViewPort viewPort w p = w `mkViewPort` p
71
viewPort :: World -> String -> ViewPort viewPort w p = w `mkViewPort` p
71
viewPort w p = w `mkViewPort` p
31
false
true
0
6
13
30
16
14
null
null
everyevery/programming_study
lgecodejam/2014-mar/a/a.hs
mit
x1 :: (Int,Int,Int,Int) -> Int x1 (x,_,_,_) = x
47
x1 :: (Int,Int,Int,Int) -> Int x1 (x,_,_,_) = x
47
x1 (x,_,_,_) = x
16
false
true
0
6
8
42
25
17
null
null
chwthewke/passman-hs
src/Passman/Engine/Generator/Defaults.hs
bsd-3-clause
complex :: CharSpace complex = makeCharSpace "alphanum-symbols" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&\"'(-_)=#{[|\\@]}$%*<>,?;.:/!^`"
168
complex :: CharSpace complex = makeCharSpace "alphanum-symbols" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&\"'(-_)=#{[|\\@]}$%*<>,?;.:/!^`"
168
complex = makeCharSpace "alphanum-symbols" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&\"'(-_)=#{[|\\@]}$%*<>,?;.:/!^`"
147
false
true
0
5
15
16
8
8
null
null
choener/fgl-extras-decompositions
Data/Graph/Inductive/Query/Ear.hs
bsd-3-clause
- tree edges treeToEdges :: Tree Node -> [Edge] treeToEdges (Node _ []) = []
78
treeToEdges :: Tree Node -> [Edge] treeToEdges (Node _ []) = []
63
treeToEdges (Node _ []) = []
28
true
true
0
10
16
49
22
27
null
null
myuon/haste-jQuery
Haste/JQuery.hs
mit
parentsUntil :: JQuery -> IO JQuery parentsUntil (JQuery q) = JQuery <$> chain "parentsUntil" q
95
parentsUntil :: JQuery -> IO JQuery parentsUntil (JQuery q) = JQuery <$> chain "parentsUntil" q
95
parentsUntil (JQuery q) = JQuery <$> chain "parentsUntil" q
59
false
true
0
7
14
36
17
19
null
null
revnull/fixfile
src/Data/FixFile/BTree/Light.hs
lgpl-3.0
treeNodeSize :: KnownNat n => g (BTree n k v) -> Integer treeNodeSize = validate . natVal . p where p :: g (BTree n k v) -> Proxy n p _ = Proxy validate n = if n < 2 then error "BTree branch size must be > 1." else n
244
treeNodeSize :: KnownNat n => g (BTree n k v) -> Integer treeNodeSize = validate . natVal . p where p :: g (BTree n k v) -> Proxy n p _ = Proxy validate n = if n < 2 then error "BTree branch size must be > 1." else n
244
treeNodeSize = validate . natVal . p where p :: g (BTree n k v) -> Proxy n p _ = Proxy validate n = if n < 2 then error "BTree branch size must be > 1." else n
187
false
true
2
10
79
117
52
65
null
null
JustusAdam/haxl-local-test
src/DataSources/Actors.hs
bsd-3-clause
storeFetch :: State StoreReq -> Flags -> u -> [BlockedFetch StoreReq] -> PerformFetch storeFetch _ _ _ reqs = SyncFetch $ do logLine "Doing actor round" threadDelay 100000 for_ reqs $ \(BlockedFetch fetch result) -> storeValFromFetch fetch >>= putSuccess result logLine "Finished"
315
storeFetch :: State StoreReq -> Flags -> u -> [BlockedFetch StoreReq] -> PerformFetch storeFetch _ _ _ reqs = SyncFetch $ do logLine "Doing actor round" threadDelay 100000 for_ reqs $ \(BlockedFetch fetch result) -> storeValFromFetch fetch >>= putSuccess result logLine "Finished"
314
storeFetch _ _ _ reqs = SyncFetch $ do logLine "Doing actor round" threadDelay 100000 for_ reqs $ \(BlockedFetch fetch result) -> storeValFromFetch fetch >>= putSuccess result logLine "Finished"
218
false
true
0
12
76
106
46
60
null
null
madmaw/grunt-haste-compiler
test/fixtures/HelloWorld.hs
mit
main::IO() main = test "Hello World"
36
main::IO() main = test "Hello World"
36
main = test "Hello World"
25
false
true
0
6
5
19
9
10
null
null
Gabriel439/fficxx
lib/FFICXX/Generate/Type/Class.hs
bsd-2-clause
ctypToHsTyp _c (CT CTString _) = "CString"
42
ctypToHsTyp _c (CT CTString _) = "CString"
42
ctypToHsTyp _c (CT CTString _) = "CString"
42
false
false
0
7
6
19
9
10
null
null
sherwoodwang/wxHaskell
wxc/Setup.hs
lgpl-2.1
ppDefinition :: Show a => String -> a -> String cppDefinition name value = "#define " ++ name ++ " " ++ show value ++ "\n"
127
cppDefinition :: Show a => String -> a -> String cppDefinition name value = "#define " ++ name ++ " " ++ show value ++ "\n"
126
cppDefinition name value = "#define " ++ name ++ " " ++ show value ++ "\n"
77
false
true
0
8
30
50
24
26
null
null
DominikDitoIvosevic/Uni
IRG/src/Irg/Lab4/Shading/Shading.hs
mit
getPolyNormal :: [V4 Float] -> V4 Float getPolyNormal [d1, d2, d3] = normalize $ vector $ (normP d1 - normP d2) `cross` (normP d1 - normP d3) where normP = normalizePoint
172
getPolyNormal :: [V4 Float] -> V4 Float getPolyNormal [d1, d2, d3] = normalize $ vector $ (normP d1 - normP d2) `cross` (normP d1 - normP d3) where normP = normalizePoint
172
getPolyNormal [d1, d2, d3] = normalize $ vector $ (normP d1 - normP d2) `cross` (normP d1 - normP d3) where normP = normalizePoint
132
false
true
1
9
32
92
44
48
null
null
rbonifacio/hephaestus-pl
src/meta-hephaestus/HplProducts/Hephaestus.hs
lgpl-3.0
xml2Configuration :: XmlConfiguration -> ParserResult (ConfigurationItem TransformationModel) xml2Configuration c = let pe = parse parseExpression "" (xmlExpression c) ts = [xml2Transformation (tName t) (splitAndTrim ',' (tArgs t)) | t <- (xmlTransformations c)] pr = parseConstraint (xmlRequired c) pp = parseConstraint (xmlProvided c) pl = [pe, pr, pp] in if and [isSuccess t | t <- ts] then let pts = [a | (Success a) <- ts] in case pl of [Right exp, Right req, Right prov] -> Success (ConstrainedConfigurationItem{expression = exp, transformations = pts, required = req, provided = prov}) [Right exp, _, _] -> Success (ConfigurationItem{expression = exp, transformations = pts}) otherwise -> Fail ("Error parsing configuration item with " ++ " expression " ++ (show $ xmlExpression c) ++ ", required " ++ (show $ xmlRequired c) ++ ", provided " ++ (show $ xmlProvided c) ++ ". ") else Fail (unwords [showError e | e <- ts, isSuccess e == False]) where parseConstraint :: Maybe String -> Either ParseError FeatureExpression parseConstraint (Nothing) = parse pzero "" "" parseConstraint (Just s) = parse parseExpression "" s
1,716
xml2Configuration :: XmlConfiguration -> ParserResult (ConfigurationItem TransformationModel) xml2Configuration c = let pe = parse parseExpression "" (xmlExpression c) ts = [xml2Transformation (tName t) (splitAndTrim ',' (tArgs t)) | t <- (xmlTransformations c)] pr = parseConstraint (xmlRequired c) pp = parseConstraint (xmlProvided c) pl = [pe, pr, pp] in if and [isSuccess t | t <- ts] then let pts = [a | (Success a) <- ts] in case pl of [Right exp, Right req, Right prov] -> Success (ConstrainedConfigurationItem{expression = exp, transformations = pts, required = req, provided = prov}) [Right exp, _, _] -> Success (ConfigurationItem{expression = exp, transformations = pts}) otherwise -> Fail ("Error parsing configuration item with " ++ " expression " ++ (show $ xmlExpression c) ++ ", required " ++ (show $ xmlRequired c) ++ ", provided " ++ (show $ xmlProvided c) ++ ". ") else Fail (unwords [showError e | e <- ts, isSuccess e == False]) where parseConstraint :: Maybe String -> Either ParseError FeatureExpression parseConstraint (Nothing) = parse pzero "" "" parseConstraint (Just s) = parse parseExpression "" s
1,716
xml2Configuration c = let pe = parse parseExpression "" (xmlExpression c) ts = [xml2Transformation (tName t) (splitAndTrim ',' (tArgs t)) | t <- (xmlTransformations c)] pr = parseConstraint (xmlRequired c) pp = parseConstraint (xmlProvided c) pl = [pe, pr, pp] in if and [isSuccess t | t <- ts] then let pts = [a | (Success a) <- ts] in case pl of [Right exp, Right req, Right prov] -> Success (ConstrainedConfigurationItem{expression = exp, transformations = pts, required = req, provided = prov}) [Right exp, _, _] -> Success (ConfigurationItem{expression = exp, transformations = pts}) otherwise -> Fail ("Error parsing configuration item with " ++ " expression " ++ (show $ xmlExpression c) ++ ", required " ++ (show $ xmlRequired c) ++ ", provided " ++ (show $ xmlProvided c) ++ ". ") else Fail (unwords [showError e | e <- ts, isSuccess e == False]) where parseConstraint :: Maybe String -> Either ParseError FeatureExpression parseConstraint (Nothing) = parse pzero "" "" parseConstraint (Just s) = parse parseExpression "" s
1,580
false
true
0
23
767
454
233
221
null
null
TomMD/statsd-client
src/Network/Statsd/Client.hs
bsd-3-clause
showRailed :: (Bounded i, Show i, Integral i) => i -> String showRailed i | fromIntegral minI > high && high > fromIntegral i = show high | fromIntegral maxI < low && low < fromIntegral i = show low | otherwise = show i where low = negate 2^64 high = 2^64 - 1 minI = minBound `asTypeOf` i maxI = maxBound `asTypeOf` i
392
showRailed :: (Bounded i, Show i, Integral i) => i -> String showRailed i | fromIntegral minI > high && high > fromIntegral i = show high | fromIntegral maxI < low && low < fromIntegral i = show low | otherwise = show i where low = negate 2^64 high = 2^64 - 1 minI = minBound `asTypeOf` i maxI = maxBound `asTypeOf` i
392
showRailed i | fromIntegral minI > high && high > fromIntegral i = show high | fromIntegral maxI < low && low < fromIntegral i = show low | otherwise = show i where low = negate 2^64 high = 2^64 - 1 minI = minBound `asTypeOf` i maxI = maxBound `asTypeOf` i
331
false
true
4
11
139
165
78
87
null
null
nh2/quickcheck
examples/Heap_ProgramAlgebraic.hs
bsd-3-clause
Nil `merge` h2 = h2
20
Nil `merge` h2 = h2
20
Nil `merge` h2 = h2
20
false
false
0
5
5
18
8
10
null
null
snoyberg/ghc
compiler/nativeGen/PPC/CodeGen.hs
bsd-3-clause
getRegister' _ (CmmLit (CmmInt i rep)) | Just imm <- makeImmediate rep True i = let code dst = unitOL (LI dst imm) in return (Any (intFormat rep) code)
175
getRegister' _ (CmmLit (CmmInt i rep)) | Just imm <- makeImmediate rep True i = let code dst = unitOL (LI dst imm) in return (Any (intFormat rep) code)
175
getRegister' _ (CmmLit (CmmInt i rep)) | Just imm <- makeImmediate rep True i = let code dst = unitOL (LI dst imm) in return (Any (intFormat rep) code)
175
false
false
1
12
52
90
39
51
null
null
alexbaluta/courseography
dependencies/HaXml-1.25.3/src/Text/XML/HaXml/ByteStringPP.hs
gpl-3.0
cp (Choice cs m) = parens (hcat (intersperse (text "|") (Prelude.map cp cs))) <> modifier m
124
cp (Choice cs m) = parens (hcat (intersperse (text "|") (Prelude.map cp cs))) <> modifier m
124
cp (Choice cs m) = parens (hcat (intersperse (text "|") (Prelude.map cp cs))) <> modifier m
124
false
false
0
13
48
58
27
31
null
null
li-zhirui/EoplLangs
src/ImplicitRefs/Evaluator.hs
bsd-3-clause
valueOf :: Expression -> Environment -> Store -> EvaluateResult valueOf (ConstExpr x) _ _ = evalConstExpr x
122
valueOf :: Expression -> Environment -> Store -> EvaluateResult valueOf (ConstExpr x) _ _ = evalConstExpr x
122
valueOf (ConstExpr x) _ _ = evalConstExpr x
58
false
true
0
11
31
44
20
24
null
null
wjt/bustle
Bustle/StatisticsPane.hs
lgpl-2.1
newTimeView :: IO (ListStore TimeInfo, TreeView) newTimeView = do timeStore <- listStoreNew [] timeView <- treeViewNewWithModel timeStore set timeView [ treeViewHeadersVisible := True ] nameColumn <- treeViewColumnNew treeViewColumnSetTitle nameColumn (__ "Method") set nameColumn [ treeViewColumnResizable := True , treeViewColumnExpand := True ] addMemberRenderer nameColumn timeStore True $ \ti -> Marquee.formatMember (tiInterface ti) (tiMethodName ti) treeViewAppendColumn timeView nameColumn addTextStatColumn timeView timeStore (__ "Total") (printf (__ "%.1f ms") . tiTotalTime) addTextStatColumn timeView timeStore (__ "Calls") (show . tiCallFrequency) addTextStatColumn timeView timeStore (__ "Mean") (printf (__ "%.1f ms") . tiMeanCallTime) return (timeStore, timeView)
880
newTimeView :: IO (ListStore TimeInfo, TreeView) newTimeView = do timeStore <- listStoreNew [] timeView <- treeViewNewWithModel timeStore set timeView [ treeViewHeadersVisible := True ] nameColumn <- treeViewColumnNew treeViewColumnSetTitle nameColumn (__ "Method") set nameColumn [ treeViewColumnResizable := True , treeViewColumnExpand := True ] addMemberRenderer nameColumn timeStore True $ \ti -> Marquee.formatMember (tiInterface ti) (tiMethodName ti) treeViewAppendColumn timeView nameColumn addTextStatColumn timeView timeStore (__ "Total") (printf (__ "%.1f ms") . tiTotalTime) addTextStatColumn timeView timeStore (__ "Calls") (show . tiCallFrequency) addTextStatColumn timeView timeStore (__ "Mean") (printf (__ "%.1f ms") . tiMeanCallTime) return (timeStore, timeView)
880
newTimeView = do timeStore <- listStoreNew [] timeView <- treeViewNewWithModel timeStore set timeView [ treeViewHeadersVisible := True ] nameColumn <- treeViewColumnNew treeViewColumnSetTitle nameColumn (__ "Method") set nameColumn [ treeViewColumnResizable := True , treeViewColumnExpand := True ] addMemberRenderer nameColumn timeStore True $ \ti -> Marquee.formatMember (tiInterface ti) (tiMethodName ti) treeViewAppendColumn timeView nameColumn addTextStatColumn timeView timeStore (__ "Total") (printf (__ "%.1f ms") . tiTotalTime) addTextStatColumn timeView timeStore (__ "Calls") (show . tiCallFrequency) addTextStatColumn timeView timeStore (__ "Mean") (printf (__ "%.1f ms") . tiMeanCallTime) return (timeStore, timeView)
831
false
true
0
12
190
254
119
135
null
null
oldmanmike/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
exprCtOrigin (RecordCon {}) = Shouldn'tHappenOrigin "record construction"
77
exprCtOrigin (RecordCon {}) = Shouldn'tHappenOrigin "record construction"
77
exprCtOrigin (RecordCon {}) = Shouldn'tHappenOrigin "record construction"
77
false
false
0
6
10
20
9
11
null
null
ryantrinkle/ghcjs
src/Gen2/Prim.hs
mit
genPrim _ _ CopySmallArrayOp [] [s,si,d,di,n] = PrimInline [j| for(var i=`n`-1;i>=0;i--) { `d`[`di`+i] = `s`[`si`+i]; } |]
135
genPrim _ _ CopySmallArrayOp [] [s,si,d,di,n] = PrimInline [j| for(var i=`n`-1;i>=0;i--) { `d`[`di`+i] = `s`[`si`+i]; } |]
135
genPrim _ _ CopySmallArrayOp [] [s,si,d,di,n] = PrimInline [j| for(var i=`n`-1;i>=0;i--) { `d`[`di`+i] = `s`[`si`+i]; } |]
135
false
false
3
6
29
42
24
18
null
null
green-haskell/ghc
compiler/stgSyn/CoreToStg.hs
bsd-3-clause
coreToTopStgRhs :: DynFlags -> Module -> FreeVarsInfo -- Free var info for the scope of the binding -> (Id,CoreExpr) -> LneM (StgRhs, FreeVarsInfo) coreToTopStgRhs dflags this_mod scope_fv_info (bndr, rhs) = do { (new_rhs, rhs_fvs, _) <- coreToStgExpr rhs ; lv_info <- freeVarsToLiveVars rhs_fvs ; let stg_rhs = mkTopStgRhs dflags this_mod rhs_fvs (mkSRT lv_info) bndr bndr_info new_rhs stg_arity = stgRhsArity stg_rhs ; return (ASSERT2( arity_ok stg_arity, mk_arity_msg stg_arity) stg_rhs, rhs_fvs) } where bndr_info = lookupFVInfo scope_fv_info bndr -- It's vital that the arity on a top-level Id matches -- the arity of the generated STG binding, else an importing -- module will use the wrong calling convention -- (Trac #2844 was an example where this happened) -- NB1: we can't move the assertion further out without -- blocking the "knot" tied in coreTopBindsToStg -- NB2: the arity check is only needed for Ids with External -- Names, because they are externally visible. The CorePrep -- pass introduces "sat" things with Local Names and does -- not bother to set their Arity info, so don't fail for those arity_ok stg_arity | isExternalName (idName bndr) = id_arity == stg_arity | otherwise = True id_arity = idArity bndr mk_arity_msg stg_arity = vcat [ppr bndr, ptext (sLit "Id arity:") <+> ppr id_arity, ptext (sLit "STG arity:") <+> ppr stg_arity]
1,663
coreToTopStgRhs :: DynFlags -> Module -> FreeVarsInfo -- Free var info for the scope of the binding -> (Id,CoreExpr) -> LneM (StgRhs, FreeVarsInfo) coreToTopStgRhs dflags this_mod scope_fv_info (bndr, rhs) = do { (new_rhs, rhs_fvs, _) <- coreToStgExpr rhs ; lv_info <- freeVarsToLiveVars rhs_fvs ; let stg_rhs = mkTopStgRhs dflags this_mod rhs_fvs (mkSRT lv_info) bndr bndr_info new_rhs stg_arity = stgRhsArity stg_rhs ; return (ASSERT2( arity_ok stg_arity, mk_arity_msg stg_arity) stg_rhs, rhs_fvs) } where bndr_info = lookupFVInfo scope_fv_info bndr -- It's vital that the arity on a top-level Id matches -- the arity of the generated STG binding, else an importing -- module will use the wrong calling convention -- (Trac #2844 was an example where this happened) -- NB1: we can't move the assertion further out without -- blocking the "knot" tied in coreTopBindsToStg -- NB2: the arity check is only needed for Ids with External -- Names, because they are externally visible. The CorePrep -- pass introduces "sat" things with Local Names and does -- not bother to set their Arity info, so don't fail for those arity_ok stg_arity | isExternalName (idName bndr) = id_arity == stg_arity | otherwise = True id_arity = idArity bndr mk_arity_msg stg_arity = vcat [ppr bndr, ptext (sLit "Id arity:") <+> ppr id_arity, ptext (sLit "STG arity:") <+> ppr stg_arity]
1,662
coreToTopStgRhs dflags this_mod scope_fv_info (bndr, rhs) = do { (new_rhs, rhs_fvs, _) <- coreToStgExpr rhs ; lv_info <- freeVarsToLiveVars rhs_fvs ; let stg_rhs = mkTopStgRhs dflags this_mod rhs_fvs (mkSRT lv_info) bndr bndr_info new_rhs stg_arity = stgRhsArity stg_rhs ; return (ASSERT2( arity_ok stg_arity, mk_arity_msg stg_arity) stg_rhs, rhs_fvs) } where bndr_info = lookupFVInfo scope_fv_info bndr -- It's vital that the arity on a top-level Id matches -- the arity of the generated STG binding, else an importing -- module will use the wrong calling convention -- (Trac #2844 was an example where this happened) -- NB1: we can't move the assertion further out without -- blocking the "knot" tied in coreTopBindsToStg -- NB2: the arity check is only needed for Ids with External -- Names, because they are externally visible. The CorePrep -- pass introduces "sat" things with Local Names and does -- not bother to set their Arity info, so don't fail for those arity_ok stg_arity | isExternalName (idName bndr) = id_arity == stg_arity | otherwise = True id_arity = idArity bndr mk_arity_msg stg_arity = vcat [ppr bndr, ptext (sLit "Id arity:") <+> ppr id_arity, ptext (sLit "STG arity:") <+> ppr stg_arity]
1,466
false
true
6
12
517
277
145
132
null
null
ryzhyk/cocoon
cocoon/Statement.hs
apache-2.0
statFold :: (a -> Statement -> a) -> a -> Statement -> a statFold f acc s = case s of SSeq _ l r -> statFold f (statFold f acc' l) r SPar _ l r -> statFold f (statFold f acc' l) r SITE _ _ t e -> maybe (statFold f acc' t) (statFold f (statFold f acc' t)) e STest _ _ -> acc' SSet _ _ _ -> acc' SSend _ _ -> acc' SSendND _ _ _ -> acc' SHavoc _ _ -> acc' SAssume _ _ -> acc' SLet _ _ _ _ -> acc' SFork _ _ _ b -> statFold f acc' b where acc' = f acc s
591
statFold :: (a -> Statement -> a) -> a -> Statement -> a statFold f acc s = case s of SSeq _ l r -> statFold f (statFold f acc' l) r SPar _ l r -> statFold f (statFold f acc' l) r SITE _ _ t e -> maybe (statFold f acc' t) (statFold f (statFold f acc' t)) e STest _ _ -> acc' SSet _ _ _ -> acc' SSend _ _ -> acc' SSendND _ _ _ -> acc' SHavoc _ _ -> acc' SAssume _ _ -> acc' SLet _ _ _ _ -> acc' SFork _ _ _ b -> statFold f acc' b where acc' = f acc s
591
statFold f acc s = case s of SSeq _ l r -> statFold f (statFold f acc' l) r SPar _ l r -> statFold f (statFold f acc' l) r SITE _ _ t e -> maybe (statFold f acc' t) (statFold f (statFold f acc' t)) e STest _ _ -> acc' SSet _ _ _ -> acc' SSend _ _ -> acc' SSendND _ _ _ -> acc' SHavoc _ _ -> acc' SAssume _ _ -> acc' SLet _ _ _ _ -> acc' SFork _ _ _ b -> statFold f acc' b where acc' = f acc s
534
false
true
1
12
259
285
131
154
null
null
amosr/limp-cbc
src/Numeric/Limp/Solvers/Cbc.hs
mit
solve :: (Ord z, Ord r) => Program z r IntDouble -> Either Error (Assignment z r IntDouble) solve p = let pc = C.program p in S.solve pc
141
solve :: (Ord z, Ord r) => Program z r IntDouble -> Either Error (Assignment z r IntDouble) solve p = let pc = C.program p in S.solve pc
141
solve p = let pc = C.program p in S.solve pc
49
false
true
0
10
33
76
36
40
null
null
kazu-yamamoto/dns
internal/Network/DNS/Decode/Parsers.hs
bsd-3-clause
-- XXX: Include the class when implemented, or otherwise perhaps check the -- implicit assumption that the class is classIN. -- getQuery :: SGet Question getQuery = Question <$> getDomain <*> getTYPE <* ignoreClass where ignoreClass = get16
287
getQuery :: SGet Question getQuery = Question <$> getDomain <*> getTYPE <* ignoreClass where ignoreClass = get16
159
getQuery = Question <$> getDomain <*> getTYPE <* ignoreClass where ignoreClass = get16
133
true
true
8
6
84
52
24
28
null
null
LukaHorvat/Flow
src/Pong/Main.hs
mit
update :: Game State Update () update = do withCgs_ $ BallPos . Main.advance withCgs_ $ BallVel . bounceWall withCgs_ $ BallVel . bouncePaddle return ()
168
update :: Game State Update () update = do withCgs_ $ BallPos . Main.advance withCgs_ $ BallVel . bounceWall withCgs_ $ BallVel . bouncePaddle return ()
168
update = do withCgs_ $ BallPos . Main.advance withCgs_ $ BallVel . bounceWall withCgs_ $ BallVel . bouncePaddle return ()
137
false
true
0
8
41
63
29
34
null
null
JacquesCarette/literate-scientific-software
code/drasil-data/Data/Drasil/Concepts/Software.hs
bsd-2-clause
reusability = dcc "reusability" (nounPhraseSP "reusability") "the use of existing assets in some form within the software product development process"
164
reusability = dcc "reusability" (nounPhraseSP "reusability") "the use of existing assets in some form within the software product development process"
164
reusability = dcc "reusability" (nounPhraseSP "reusability") "the use of existing assets in some form within the software product development process"
164
false
false
1
7
33
25
9
16
null
null
bergmark/http2
Network/HTTP2/RandomSkewHeap.hs
bsd-3-clause
empty :: Heap a empty = Leaf
28
empty :: Heap a empty = Leaf
28
empty = Leaf
12
false
true
0
5
6
14
7
7
null
null