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
spechub/Hets
ExtModal/ExtModal2Ship.hs
gpl-2.0
extModalToFoltlt :: EM_FORMULA -> Result Foltl extModalToFoltlt emf = case emf of PrefixForm p pf _ -> do f <- toFoltl pf case p of NextY True -> return $ PreOp X f StateQuantification True b -> return $ PreOp (if b then G else F) f _ -> fail "extModalToFoltl.PrefixForm" UntilSince True f1 f2 _ -> do u1 <- toFoltl f1 u2 <- toFoltl f2 return $ BinOp u1 Until u2 _ -> fail "extModalToFoltl"
434
extModalToFoltlt :: EM_FORMULA -> Result Foltl extModalToFoltlt emf = case emf of PrefixForm p pf _ -> do f <- toFoltl pf case p of NextY True -> return $ PreOp X f StateQuantification True b -> return $ PreOp (if b then G else F) f _ -> fail "extModalToFoltl.PrefixForm" UntilSince True f1 f2 _ -> do u1 <- toFoltl f1 u2 <- toFoltl f2 return $ BinOp u1 Until u2 _ -> fail "extModalToFoltl"
434
extModalToFoltlt emf = case emf of PrefixForm p pf _ -> do f <- toFoltl pf case p of NextY True -> return $ PreOp X f StateQuantification True b -> return $ PreOp (if b then G else F) f _ -> fail "extModalToFoltl.PrefixForm" UntilSince True f1 f2 _ -> do u1 <- toFoltl f1 u2 <- toFoltl f2 return $ BinOp u1 Until u2 _ -> fail "extModalToFoltl"
387
false
true
0
16
119
175
79
96
null
null
avh4/elm-compiler
src/AST/Type.hs
bsd-3-clause
fieldMap :: [(String,a)] -> Map.Map String [a] fieldMap fields = foldl (\r (x,t) -> Map.insertWith (++) x [t] r) Map.empty fields
133
fieldMap :: [(String,a)] -> Map.Map String [a] fieldMap fields = foldl (\r (x,t) -> Map.insertWith (++) x [t] r) Map.empty fields
133
fieldMap fields = foldl (\r (x,t) -> Map.insertWith (++) x [t] r) Map.empty fields
86
false
true
0
9
24
83
44
39
null
null
vladimir-ipatov/ganeti
src/Ganeti/HTools/Program/Hspace.hs
gpl-2.0
-- | Function to print stats for a given phase. printStats :: Phase -> Cluster.CStats -> [(String, String)] printStats ph cs = map (\(s, fn) -> (printf "%s_%s" kind s, fn cs)) statsData where kind = case ph of PInitial -> "INI" PFinal -> "FIN" PTiered -> "TRL" -- | Print failure reason and scores
353
printStats :: Phase -> Cluster.CStats -> [(String, String)] printStats ph cs = map (\(s, fn) -> (printf "%s_%s" kind s, fn cs)) statsData where kind = case ph of PInitial -> "INI" PFinal -> "FIN" PTiered -> "TRL" -- | Print failure reason and scores
305
printStats ph cs = map (\(s, fn) -> (printf "%s_%s" kind s, fn cs)) statsData where kind = case ph of PInitial -> "INI" PFinal -> "FIN" PTiered -> "TRL" -- | Print failure reason and scores
245
true
true
1
10
110
112
56
56
null
null
pxqr/utp
tests/Network/UTP/PacketSpec.hs
bsd-3-clause
spec :: Spec spec = do describe "header" $ do it "properly encoded (iso)" $ property $ \ pkt -> decode (encode pkt) `shouldBe` Right (pkt :: Packet) it "properly serialized" $ do encode (Packet ST_FIN def [] 1 2 3 4 5 6) `shouldBe` "\x11\x00\x00\x01\ \\x00\x00\x00\x02\ \\x00\x00\x00\x03\ \\x00\x00\x00\x04\ \\x00\x05\x00\x06" pendingWith "serialize payload" it "properly deserialized" $ do pendingWith "fail to decode invalid packet type" pendingWith "fail to decode invalid version" pendingWith "fail to decode invalid extension" describe "packet" $ do it "properly encoded" $ property $ \ hdr -> decode (encode hdr) `shouldBe` Right (hdr :: Packet)
806
spec :: Spec spec = do describe "header" $ do it "properly encoded (iso)" $ property $ \ pkt -> decode (encode pkt) `shouldBe` Right (pkt :: Packet) it "properly serialized" $ do encode (Packet ST_FIN def [] 1 2 3 4 5 6) `shouldBe` "\x11\x00\x00\x01\ \\x00\x00\x00\x02\ \\x00\x00\x00\x03\ \\x00\x00\x00\x04\ \\x00\x05\x00\x06" pendingWith "serialize payload" it "properly deserialized" $ do pendingWith "fail to decode invalid packet type" pendingWith "fail to decode invalid version" pendingWith "fail to decode invalid extension" describe "packet" $ do it "properly encoded" $ property $ \ hdr -> decode (encode hdr) `shouldBe` Right (hdr :: Packet)
806
spec = do describe "header" $ do it "properly encoded (iso)" $ property $ \ pkt -> decode (encode pkt) `shouldBe` Right (pkt :: Packet) it "properly serialized" $ do encode (Packet ST_FIN def [] 1 2 3 4 5 6) `shouldBe` "\x11\x00\x00\x01\ \\x00\x00\x00\x02\ \\x00\x00\x00\x03\ \\x00\x00\x00\x04\ \\x00\x05\x00\x06" pendingWith "serialize payload" it "properly deserialized" $ do pendingWith "fail to decode invalid packet type" pendingWith "fail to decode invalid version" pendingWith "fail to decode invalid extension" describe "packet" $ do it "properly encoded" $ property $ \ hdr -> decode (encode hdr) `shouldBe` Right (hdr :: Packet)
793
false
true
0
18
252
198
92
106
null
null
henryhallam/libswiftnav
plover/AmbiguityTest.hs
lgpl-3.0
helloPlover :: FunctionDefinition helloPlover = ("hello_world", FnT [] [] IntType, body) where body :: CExpr body = seqList $ [ Ref "printf" :$ StrLit "hello world\n", Return 0 ]
206
helloPlover :: FunctionDefinition helloPlover = ("hello_world", FnT [] [] IntType, body) where body :: CExpr body = seqList $ [ Ref "printf" :$ StrLit "hello world\n", Return 0 ]
206
helloPlover = ("hello_world", FnT [] [] IntType, body) where body :: CExpr body = seqList $ [ Ref "printf" :$ StrLit "hello world\n", Return 0 ]
172
false
true
0
8
56
67
35
32
null
null
kaoskorobase/mescaline
lib/mescaline/Mescaline/EngineSF.hs
gpl-3.0
mkDebugEngine :: Double -> IO ([Input] -> IO ()) mkDebugEngine dt = do (i, o) <- mkEngine dt forkIO $ forever $ do os <- o case os of [] -> return () _ -> print os return i
224
mkDebugEngine :: Double -> IO ([Input] -> IO ()) mkDebugEngine dt = do (i, o) <- mkEngine dt forkIO $ forever $ do os <- o case os of [] -> return () _ -> print os return i
224
mkDebugEngine dt = do (i, o) <- mkEngine dt forkIO $ forever $ do os <- o case os of [] -> return () _ -> print os return i
175
false
true
0
14
90
105
49
56
null
null
akiomik/dtx2midi
src/DTX2MIDI/DTX/Parser.hs
bsd-3-clause
parseInlineComment :: Parser Comment parseInlineComment = do skipMany spaceWithoutEOL char ';' takeTill isEndOfLine
121
parseInlineComment :: Parser Comment parseInlineComment = do skipMany spaceWithoutEOL char ';' takeTill isEndOfLine
121
parseInlineComment = do skipMany spaceWithoutEOL char ';' takeTill isEndOfLine
84
false
true
0
8
18
38
14
24
null
null
jyurek/d20
src/Main.hs
mit
main = forever $ do input <- prompt case (parse expression "error" input) of Left _ -> print "Error" Right ts -> mapM evaluateTerm ts >>= printResults
174
main = forever $ do input <- prompt case (parse expression "error" input) of Left _ -> print "Error" Right ts -> mapM evaluateTerm ts >>= printResults
174
main = forever $ do input <- prompt case (parse expression "error" input) of Left _ -> print "Error" Right ts -> mapM evaluateTerm ts >>= printResults
174
false
false
0
12
50
64
29
35
null
null
bjpop/berp
libs/src/Berp/Base/Builtins/Exceptions.hs
bsd-3-clause
valueError :: Object valueError = constantEval $ mkExceptionType "ValueError" [exception]
89
valueError :: Object valueError = constantEval $ mkExceptionType "ValueError" [exception]
89
valueError = constantEval $ mkExceptionType "ValueError" [exception]
68
false
true
0
7
9
23
12
11
null
null
dogweather/nevada-revised-statutes-parser
test/SectionParserSpec.hs
bsd-3-clause
spec :: SpecWith () spec = parallel $ describe "isTOCEntry" $ do it "recognizes a valid TOC entry" $ do let html = "<p class=\"COLeadline\"><a href=\"#NRS002ASec130\">NRS&#8194;2A.130</a> Benefits for surviving child." :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` True it "rejects a same-length list of incorrect tags" $ do let html = "<i class=\"COLeadline\"><a href=\"#N\">NRS</a> Hello." :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False it "rejects a same-length list of incorrect tags" $ do let html = "<p class=\"COLeadline\"><i href=\"#N\">NRS</i> Hello." :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False it "rejects a blank paragraph" $ do let html = "<p class=\"COLeadline\"><a href=\"#N\"> </a> &nbsp;" :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False it "rejects a list missing a text tag" $ do let html = "<p class=\"COLeadline\"><a href=\"#NRS002ASec130\">NRS&#8194;2A.130</a><hr>" :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False -- Helper functions -- In the app, the parser returns the paragraph tags minus the -- closing </p>.
1,172
spec :: SpecWith () spec = parallel $ describe "isTOCEntry" $ do it "recognizes a valid TOC entry" $ do let html = "<p class=\"COLeadline\"><a href=\"#NRS002ASec130\">NRS&#8194;2A.130</a> Benefits for surviving child." :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` True it "rejects a same-length list of incorrect tags" $ do let html = "<i class=\"COLeadline\"><a href=\"#N\">NRS</a> Hello." :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False it "rejects a same-length list of incorrect tags" $ do let html = "<p class=\"COLeadline\"><i href=\"#N\">NRS</i> Hello." :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False it "rejects a blank paragraph" $ do let html = "<p class=\"COLeadline\"><a href=\"#N\"> </a> &nbsp;" :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False it "rejects a list missing a text tag" $ do let html = "<p class=\"COLeadline\"><a href=\"#NRS002ASec130\">NRS&#8194;2A.130</a><hr>" :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False -- Helper functions -- In the app, the parser returns the paragraph tags minus the -- closing </p>.
1,172
spec = parallel $ describe "isTOCEntry" $ do it "recognizes a valid TOC entry" $ do let html = "<p class=\"COLeadline\"><a href=\"#NRS002ASec130\">NRS&#8194;2A.130</a> Benefits for surviving child." :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` True it "rejects a same-length list of incorrect tags" $ do let html = "<i class=\"COLeadline\"><a href=\"#N\">NRS</a> Hello." :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False it "rejects a same-length list of incorrect tags" $ do let html = "<p class=\"COLeadline\"><i href=\"#N\">NRS</i> Hello." :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False it "rejects a blank paragraph" $ do let html = "<p class=\"COLeadline\"><a href=\"#N\"> </a> &nbsp;" :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False it "rejects a list missing a text tag" $ do let html = "<p class=\"COLeadline\"><a href=\"#NRS002ASec130\">NRS&#8194;2A.130</a><hr>" :: Text isTOCEntry (tagsAsIfParsed html) `shouldBe` False -- Helper functions -- In the app, the parser returns the paragraph tags minus the -- closing </p>.
1,152
false
true
0
17
234
231
111
120
null
null
codingiam/sandbox-hs
src/Ch02a.hs
bsd-3-clause
myNot False = True
18
myNot False = True
18
myNot False = True
18
false
false
0
5
3
9
4
5
null
null
kosmikus/cabal
Cabal/Distribution/PackageDescription/Check.hs
bsd-3-clause
checkPaths :: PackageDescription -> [PackageCheck] checkPaths pkg = [ PackageBuildWarning $ quote (kind ++ ": " ++ path) ++ " is a relative path outside of the source tree. " ++ "This will not work when generating a tarball with 'sdist'." | (path, kind) <- relPaths ++ absPaths , isOutsideTree path ] ++ [ PackageDistInexcusable $ quote (kind ++ ": " ++ path) ++ " is an absolute directory." | (path, kind) <- relPaths , isAbsolute path ] ++ [ PackageDistInexcusable $ quote (kind ++ ": " ++ path) ++ " points inside the 'dist' " ++ "directory. This is not reliable because the location of this " ++ "directory is configurable by the user (or package manager). In " ++ "addition the layout of the 'dist' directory is subject to change " ++ "in future versions of Cabal." | (path, kind) <- relPaths ++ absPaths , isInsideDist path ] ++ [ PackageDistInexcusable $ "The 'ghc-options' contains the path '" ++ path ++ "' which points " ++ "inside the 'dist' directory. This is not reliable because the " ++ "location of this directory is configurable by the user (or package " ++ "manager). In addition the layout of the 'dist' directory is subject " ++ "to change in future versions of Cabal." | bi <- allBuildInfo pkg , (GHC, flags) <- options bi , path <- flags , isInsideDist path ] where isOutsideTree path = case splitDirectories path of "..":_ -> True ".":"..":_ -> True _ -> False isInsideDist path = case map lowercase (splitDirectories path) of "dist" :_ -> True ".":"dist":_ -> True _ -> False -- paths that must be relative relPaths = [ (path, "extra-src-files") | path <- extraSrcFiles pkg ] ++ [ (path, "extra-tmp-files") | path <- extraTmpFiles pkg ] ++ [ (path, "extra-doc-files") | path <- extraDocFiles pkg ] ++ [ (path, "data-files") | path <- dataFiles pkg ] ++ [ (path, "data-dir") | path <- [dataDir pkg]] ++ concat [ [ (path, "c-sources") | path <- cSources bi ] ++ [ (path, "js-sources") | path <- jsSources bi ] ++ [ (path, "install-includes") | path <- installIncludes bi ] ++ [ (path, "hs-source-dirs") | path <- hsSourceDirs bi ] | bi <- allBuildInfo pkg ] -- paths that are allowed to be absolute absPaths = concat [ [ (path, "includes") | path <- includes bi ] ++ [ (path, "include-dirs") | path <- includeDirs bi ] ++ [ (path, "extra-lib-dirs") | path <- extraLibDirs bi ] | bi <- allBuildInfo pkg ] --TODO: check sets of paths that would be interpreted differently between Unix -- and windows, ie case-sensitive or insensitive. Things that might clash, or -- conversely be distinguished. --TODO: use the tar path checks on all the above paths -- | Check that the package declares the version in the @\"cabal-version\"@ -- field correctly. --
3,091
checkPaths :: PackageDescription -> [PackageCheck] checkPaths pkg = [ PackageBuildWarning $ quote (kind ++ ": " ++ path) ++ " is a relative path outside of the source tree. " ++ "This will not work when generating a tarball with 'sdist'." | (path, kind) <- relPaths ++ absPaths , isOutsideTree path ] ++ [ PackageDistInexcusable $ quote (kind ++ ": " ++ path) ++ " is an absolute directory." | (path, kind) <- relPaths , isAbsolute path ] ++ [ PackageDistInexcusable $ quote (kind ++ ": " ++ path) ++ " points inside the 'dist' " ++ "directory. This is not reliable because the location of this " ++ "directory is configurable by the user (or package manager). In " ++ "addition the layout of the 'dist' directory is subject to change " ++ "in future versions of Cabal." | (path, kind) <- relPaths ++ absPaths , isInsideDist path ] ++ [ PackageDistInexcusable $ "The 'ghc-options' contains the path '" ++ path ++ "' which points " ++ "inside the 'dist' directory. This is not reliable because the " ++ "location of this directory is configurable by the user (or package " ++ "manager). In addition the layout of the 'dist' directory is subject " ++ "to change in future versions of Cabal." | bi <- allBuildInfo pkg , (GHC, flags) <- options bi , path <- flags , isInsideDist path ] where isOutsideTree path = case splitDirectories path of "..":_ -> True ".":"..":_ -> True _ -> False isInsideDist path = case map lowercase (splitDirectories path) of "dist" :_ -> True ".":"dist":_ -> True _ -> False -- paths that must be relative relPaths = [ (path, "extra-src-files") | path <- extraSrcFiles pkg ] ++ [ (path, "extra-tmp-files") | path <- extraTmpFiles pkg ] ++ [ (path, "extra-doc-files") | path <- extraDocFiles pkg ] ++ [ (path, "data-files") | path <- dataFiles pkg ] ++ [ (path, "data-dir") | path <- [dataDir pkg]] ++ concat [ [ (path, "c-sources") | path <- cSources bi ] ++ [ (path, "js-sources") | path <- jsSources bi ] ++ [ (path, "install-includes") | path <- installIncludes bi ] ++ [ (path, "hs-source-dirs") | path <- hsSourceDirs bi ] | bi <- allBuildInfo pkg ] -- paths that are allowed to be absolute absPaths = concat [ [ (path, "includes") | path <- includes bi ] ++ [ (path, "include-dirs") | path <- includeDirs bi ] ++ [ (path, "extra-lib-dirs") | path <- extraLibDirs bi ] | bi <- allBuildInfo pkg ] --TODO: check sets of paths that would be interpreted differently between Unix -- and windows, ie case-sensitive or insensitive. Things that might clash, or -- conversely be distinguished. --TODO: use the tar path checks on all the above paths -- | Check that the package declares the version in the @\"cabal-version\"@ -- field correctly. --
3,091
checkPaths pkg = [ PackageBuildWarning $ quote (kind ++ ": " ++ path) ++ " is a relative path outside of the source tree. " ++ "This will not work when generating a tarball with 'sdist'." | (path, kind) <- relPaths ++ absPaths , isOutsideTree path ] ++ [ PackageDistInexcusable $ quote (kind ++ ": " ++ path) ++ " is an absolute directory." | (path, kind) <- relPaths , isAbsolute path ] ++ [ PackageDistInexcusable $ quote (kind ++ ": " ++ path) ++ " points inside the 'dist' " ++ "directory. This is not reliable because the location of this " ++ "directory is configurable by the user (or package manager). In " ++ "addition the layout of the 'dist' directory is subject to change " ++ "in future versions of Cabal." | (path, kind) <- relPaths ++ absPaths , isInsideDist path ] ++ [ PackageDistInexcusable $ "The 'ghc-options' contains the path '" ++ path ++ "' which points " ++ "inside the 'dist' directory. This is not reliable because the " ++ "location of this directory is configurable by the user (or package " ++ "manager). In addition the layout of the 'dist' directory is subject " ++ "to change in future versions of Cabal." | bi <- allBuildInfo pkg , (GHC, flags) <- options bi , path <- flags , isInsideDist path ] where isOutsideTree path = case splitDirectories path of "..":_ -> True ".":"..":_ -> True _ -> False isInsideDist path = case map lowercase (splitDirectories path) of "dist" :_ -> True ".":"dist":_ -> True _ -> False -- paths that must be relative relPaths = [ (path, "extra-src-files") | path <- extraSrcFiles pkg ] ++ [ (path, "extra-tmp-files") | path <- extraTmpFiles pkg ] ++ [ (path, "extra-doc-files") | path <- extraDocFiles pkg ] ++ [ (path, "data-files") | path <- dataFiles pkg ] ++ [ (path, "data-dir") | path <- [dataDir pkg]] ++ concat [ [ (path, "c-sources") | path <- cSources bi ] ++ [ (path, "js-sources") | path <- jsSources bi ] ++ [ (path, "install-includes") | path <- installIncludes bi ] ++ [ (path, "hs-source-dirs") | path <- hsSourceDirs bi ] | bi <- allBuildInfo pkg ] -- paths that are allowed to be absolute absPaths = concat [ [ (path, "includes") | path <- includes bi ] ++ [ (path, "include-dirs") | path <- includeDirs bi ] ++ [ (path, "extra-lib-dirs") | path <- extraLibDirs bi ] | bi <- allBuildInfo pkg ] --TODO: check sets of paths that would be interpreted differently between Unix -- and windows, ie case-sensitive or insensitive. Things that might clash, or -- conversely be distinguished. --TODO: use the tar path checks on all the above paths -- | Check that the package declares the version in the @\"cabal-version\"@ -- field correctly. --
3,040
false
true
6
15
896
713
374
339
null
null
rahulmutt/ghcvm
compiler/Eta/Utils/UniqFM.hs
bsd-3-clause
-- | `plusUFM_CD f m1 d1 m2 d2` merges the maps using `f` as the -- combinding function and `d1` resp. `d2` as the default value if -- there is no entry in `m1` reps. `m2`. The domain is the union of -- the domains of `m1` and `m2`. -- -- Representative example: -- -- @ -- plusUFM_CD f {A: 1, B: 2} 23 {B: 3, C: 4} 42 -- == {A: f 1 42, B: f 2 3, C: f 23 4 } -- @ plusUFM_CD :: (elt -> elt -> elt) -> UniqFM elt -- map X -> elt -- default for X -> UniqFM elt -- map Y -> elt -- default for Y -> UniqFM elt plusUFM_CD f (UFM xm) dx (UFM ym) dy = UFM $ M.mergeWithKey (\_ x y -> Just (x `f` y)) (M.map (\x -> x `f` dy)) (M.map (\y -> dx `f` y)) xm ym
707
plusUFM_CD :: (elt -> elt -> elt) -> UniqFM elt -- map X -> elt -- default for X -> UniqFM elt -- map Y -> elt -- default for Y -> UniqFM elt plusUFM_CD f (UFM xm) dx (UFM ym) dy = UFM $ M.mergeWithKey (\_ x y -> Just (x `f` y)) (M.map (\x -> x `f` dy)) (M.map (\y -> dx `f` y)) xm ym
340
plusUFM_CD f (UFM xm) dx (UFM ym) dy = UFM $ M.mergeWithKey (\_ x y -> Just (x `f` y)) (M.map (\x -> x `f` dy)) (M.map (\y -> dx `f` y)) xm ym
168
true
true
2
13
212
184
100
84
null
null
cutsea110/aop
src/DualityOfSorts.hs
bsd-3-clause
select :: [Integer] -> Maybe (Integer, [Integer]) select [] = Nothing
69
select :: [Integer] -> Maybe (Integer, [Integer]) select [] = Nothing
69
select [] = Nothing
19
false
true
0
8
10
35
19
16
null
null
green-haskell/ghc
compiler/main/ErrUtils.hs
bsd-3-clause
mkPlainErrMsg, mkPlainWarnMsg :: DynFlags -> SrcSpan -> MsgDoc -> ErrMsg -- Variant that doesn't care about qualified/unqualified names mkLongErrMsg dflags locn unqual msg extra = mk_err_msg dflags SevError locn unqual msg extra
271
mkPlainErrMsg, mkPlainWarnMsg :: DynFlags -> SrcSpan -> MsgDoc -> ErrMsg mkLongErrMsg dflags locn unqual msg extra = mk_err_msg dflags SevError locn unqual msg extra
207
mkLongErrMsg dflags locn unqual msg extra = mk_err_msg dflags SevError locn unqual msg extra
103
true
true
0
7
74
50
26
24
null
null
vTurbine/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
tyCoFVsOfCt (CFunEqCan { cc_tyargs = tys, cc_fsk = fsk }) = tyCoFVsOfTypes tys `unionFV` FV.unitFV fsk `unionFV` tyCoFVsOfType (tyVarKind fsk)
167
tyCoFVsOfCt (CFunEqCan { cc_tyargs = tys, cc_fsk = fsk }) = tyCoFVsOfTypes tys `unionFV` FV.unitFV fsk `unionFV` tyCoFVsOfType (tyVarKind fsk)
167
tyCoFVsOfCt (CFunEqCan { cc_tyargs = tys, cc_fsk = fsk }) = tyCoFVsOfTypes tys `unionFV` FV.unitFV fsk `unionFV` tyCoFVsOfType (tyVarKind fsk)
167
false
false
0
8
44
57
30
27
null
null
vikraman/ghc
compiler/simplCore/CoreMonad.hs
bsd-3-clause
tickString (CaseIdentity _) = "CaseIdentity"
56
tickString (CaseIdentity _) = "CaseIdentity"
56
tickString (CaseIdentity _) = "CaseIdentity"
56
false
false
0
7
16
15
7
8
null
null
IreneKnapp/direct-opengl
Graphics/Rendering/OpenGL/GL/VertexArrays.hs
bsd-3-clause
noVertexArrayDescriptor :: VertexArrayDescriptor a noVertexArrayDescriptor = VertexArrayDescriptor 0 Byte 0 nullPtr
115
noVertexArrayDescriptor :: VertexArrayDescriptor a noVertexArrayDescriptor = VertexArrayDescriptor 0 Byte 0 nullPtr
115
noVertexArrayDescriptor = VertexArrayDescriptor 0 Byte 0 nullPtr
64
false
true
0
5
10
23
11
12
null
null
ben-schulz/Idris-dev
src/Idris/Parser/Helpers.hs
bsd-3-clause
-- | Gets last indentation lastIndent :: IdrisParser Int lastIndent = do ist <- get case indent_stack ist of (x : xs) -> return x _ -> return 1 -- | Applies parser in an indented position
247
lastIndent :: IdrisParser Int lastIndent = do ist <- get case indent_stack ist of (x : xs) -> return x _ -> return 1 -- | Applies parser in an indented position
220
lastIndent = do ist <- get case indent_stack ist of (x : xs) -> return x _ -> return 1 -- | Applies parser in an indented position
190
true
true
0
11
96
58
28
30
null
null
ssaavedra/liquidhaskell
src/Language/Haskell/Liquid/Types/PredType.hs
bsd-3-clause
meetListWithPSubRef _ _ (RProp _ (RHole _)) _ = panic Nothing "PredType.meetListWithPSubRef called with invalid input"
120
meetListWithPSubRef _ _ (RProp _ (RHole _)) _ = panic Nothing "PredType.meetListWithPSubRef called with invalid input"
120
meetListWithPSubRef _ _ (RProp _ (RHole _)) _ = panic Nothing "PredType.meetListWithPSubRef called with invalid input"
120
false
false
0
9
17
35
16
19
null
null
k0001/gtk2hs
docs/tutorial/Tutorial_Port/Example_Code/GtkChap5-4b.hs
gpl-3.0
main :: IO () main= do initGUI window <- windowNew set window [windowTitle := "Notebook Example 2", windowDefaultWidth := 300, windowDefaultHeight := 200 ] ntbk <- notebookNew containerAdd window ntbk set ntbk [notebookScrollable := True, notebookEnablePopup := True, notebookTabPos := PosRight ] stls <- stockListIds sequence_ (map (myNewPage ntbk) stls) onSwitchPage ntbk (putStrLn . ((++)"Page: ") . show) widgetShowAll window onDestroy window mainQuit mainGUI
559
main :: IO () main= do initGUI window <- windowNew set window [windowTitle := "Notebook Example 2", windowDefaultWidth := 300, windowDefaultHeight := 200 ] ntbk <- notebookNew containerAdd window ntbk set ntbk [notebookScrollable := True, notebookEnablePopup := True, notebookTabPos := PosRight ] stls <- stockListIds sequence_ (map (myNewPage ntbk) stls) onSwitchPage ntbk (putStrLn . ((++)"Page: ") . show) widgetShowAll window onDestroy window mainQuit mainGUI
559
main= do initGUI window <- windowNew set window [windowTitle := "Notebook Example 2", windowDefaultWidth := 300, windowDefaultHeight := 200 ] ntbk <- notebookNew containerAdd window ntbk set ntbk [notebookScrollable := True, notebookEnablePopup := True, notebookTabPos := PosRight ] stls <- stockListIds sequence_ (map (myNewPage ntbk) stls) onSwitchPage ntbk (putStrLn . ((++)"Page: ") . show) widgetShowAll window onDestroy window mainQuit mainGUI
545
false
true
0
12
159
172
80
92
null
null
cmc-haskell-2016/reversi
src/GameLogic.hs
bsd-3-clause
-- ищет клетку с состоянием: пусто или помечено, если нашла возвращает ее isExist :: Pos -> [Cell] -> [Cell] -> State -> Pos -> Maybe Pos isExist (x, y) ((Cell (x1, y1) state) : xs) w (Player turn) (kx, ky) | areal (x, y) (x1, y1) = case state of Empty -> Just (x1, y1) PossibleMove -> Just (x1, y1) Player p | not (isEqMove p turn) -> (isExist (x+kx, y+ky) w w (Player turn) (kx, ky)) | otherwise -> Nothing | otherwise = (isExist (x, y) xs w (Player turn) (kx, ky))
576
isExist :: Pos -> [Cell] -> [Cell] -> State -> Pos -> Maybe Pos isExist (x, y) ((Cell (x1, y1) state) : xs) w (Player turn) (kx, ky) | areal (x, y) (x1, y1) = case state of Empty -> Just (x1, y1) PossibleMove -> Just (x1, y1) Player p | not (isEqMove p turn) -> (isExist (x+kx, y+ky) w w (Player turn) (kx, ky)) | otherwise -> Nothing | otherwise = (isExist (x, y) xs w (Player turn) (kx, ky))
501
isExist (x, y) ((Cell (x1, y1) state) : xs) w (Player turn) (kx, ky) | areal (x, y) (x1, y1) = case state of Empty -> Just (x1, y1) PossibleMove -> Just (x1, y1) Player p | not (isEqMove p turn) -> (isExist (x+kx, y+ky) w w (Player turn) (kx, ky)) | otherwise -> Nothing | otherwise = (isExist (x, y) xs w (Player turn) (kx, ky))
437
true
true
0
14
201
264
139
125
null
null
pgj/bead
src/Bead/View/TemplateAndComponentNames.hs
bsd-3-clause
profileTable = TableName "profile-table"
40
profileTable = TableName "profile-table"
40
profileTable = TableName "profile-table"
40
false
false
0
5
3
9
4
5
null
null
ford-prefect/haskell-gi
lib/Data/GI/CodeGen/GObject.hs
lgpl-2.1
apiIsGObject :: Name -> API -> CodeGen Bool apiIsGObject = apiDoParentSearch $ Name "GObject" "Object"
102
apiIsGObject :: Name -> API -> CodeGen Bool apiIsGObject = apiDoParentSearch $ Name "GObject" "Object"
102
apiIsGObject = apiDoParentSearch $ Name "GObject" "Object"
58
false
true
0
7
14
31
15
16
null
null
cirquit/Personal-Repository
Haskell/freemonad/bf-interpreter/src/BFInterpreter.hs
mit
printT :: Tape Int -> IO (Tape Int) printT t@(ws, (x:xs)) = putChar (chr x) >> return t
87
printT :: Tape Int -> IO (Tape Int) printT t@(ws, (x:xs)) = putChar (chr x) >> return t
87
printT t@(ws, (x:xs)) = putChar (chr x) >> return t
51
false
true
0
9
17
62
31
31
null
null
lywaterman/parconc-examples
crc32/crc32_acc.hs
bsd-3-clause
find :: Acc (Vector Word32) -> Acc (Scalar Int) find arr = A.fold A.max (constant 0) (A.zipWith check arr ixs) where check :: Exp Word32 -> Exp Int -> Exp Int check x ix = x ==* password_hash ? ( ix, 0 ) ixs = generate (shape arr) unindex1
258
find :: Acc (Vector Word32) -> Acc (Scalar Int) find arr = A.fold A.max (constant 0) (A.zipWith check arr ixs) where check :: Exp Word32 -> Exp Int -> Exp Int check x ix = x ==* password_hash ? ( ix, 0 ) ixs = generate (shape arr) unindex1
258
find arr = A.fold A.max (constant 0) (A.zipWith check arr ixs) where check :: Exp Word32 -> Exp Int -> Exp Int check x ix = x ==* password_hash ? ( ix, 0 ) ixs = generate (shape arr) unindex1
210
false
true
4
8
67
128
63
65
null
null
snoyberg/ghc
compiler/rename/RnBinds.hs
bsd-3-clause
rnMatchGroup :: Outputable (body RdrName) => HsMatchContext Name -> (Located (body RdrName) -> RnM (Located (body Name), FreeVars)) -> MatchGroup RdrName (Located (body RdrName)) -> RnM (MatchGroup Name (Located (body Name)), FreeVars) rnMatchGroup ctxt rnBody (MG { mg_alts = L _ ms, mg_origin = origin }) = do { empty_case_ok <- xoptM LangExt.EmptyCase ; when (null ms && not empty_case_ok) (addErr (emptyCaseErr ctxt)) ; (new_ms, ms_fvs) <- mapFvRn (rnMatch ctxt rnBody) ms ; return (mkMatchGroup origin new_ms, ms_fvs) }
586
rnMatchGroup :: Outputable (body RdrName) => HsMatchContext Name -> (Located (body RdrName) -> RnM (Located (body Name), FreeVars)) -> MatchGroup RdrName (Located (body RdrName)) -> RnM (MatchGroup Name (Located (body Name)), FreeVars) rnMatchGroup ctxt rnBody (MG { mg_alts = L _ ms, mg_origin = origin }) = do { empty_case_ok <- xoptM LangExt.EmptyCase ; when (null ms && not empty_case_ok) (addErr (emptyCaseErr ctxt)) ; (new_ms, ms_fvs) <- mapFvRn (rnMatch ctxt rnBody) ms ; return (mkMatchGroup origin new_ms, ms_fvs) }
586
rnMatchGroup ctxt rnBody (MG { mg_alts = L _ ms, mg_origin = origin }) = do { empty_case_ok <- xoptM LangExt.EmptyCase ; when (null ms && not empty_case_ok) (addErr (emptyCaseErr ctxt)) ; (new_ms, ms_fvs) <- mapFvRn (rnMatch ctxt rnBody) ms ; return (mkMatchGroup origin new_ms, ms_fvs) }
311
false
true
0
15
140
239
119
120
null
null
nushio3/ghc
libraries/base/Data/Data.hs
bsd-3-clause
boolDataType :: DataType boolDataType = mkDataType "Prelude.Bool" [falseConstr,trueConstr]
90
boolDataType :: DataType boolDataType = mkDataType "Prelude.Bool" [falseConstr,trueConstr]
90
boolDataType = mkDataType "Prelude.Bool" [falseConstr,trueConstr]
65
false
true
0
6
7
28
13
15
null
null
dagit/mattermost-api
src/Network/Mattermost/Types.hs
bsd-3-clause
urlForFile :: FileId -> Text urlForFile fId = "/api/v3/files/" <> idString fId <> "/get"
90
urlForFile :: FileId -> Text urlForFile fId = "/api/v3/files/" <> idString fId <> "/get"
90
urlForFile fId = "/api/v3/files/" <> idString fId <> "/get"
61
false
true
0
7
15
29
14
15
null
null
deadfoxygrandpa/Elm
compiler/Transform/Check.hs
bsd-3-clause
dups :: Ord a => [a] -> [a] dups = map head . filter ((>1) . length) . List.group . List.sort
94
dups :: Ord a => [a] -> [a] dups = map head . filter ((>1) . length) . List.group . List.sort
94
dups = map head . filter ((>1) . length) . List.group . List.sort
66
false
true
0
11
21
61
32
29
null
null
spechub/Hets
Comorphisms/THFP2THF0.hs
gpl-2.0
curryConstType (ParType t) = ParType (curryConstType t)
55
curryConstType (ParType t) = ParType (curryConstType t)
55
curryConstType (ParType t) = ParType (curryConstType t)
55
false
false
0
7
6
24
11
13
null
null
icasperzen/hs-carbon-examples
examples-src/Integral.hs
mit
---------------------------------------------------------------- -- Example: Integrate sin(x) from 0 to pi ---------------- bounds :: ((Double,Double),(Double,Double)) bounds = ((0,pi),(0,1))
192
bounds :: ((Double,Double),(Double,Double)) bounds = ((0,pi),(0,1))
67
bounds = ((0,pi),(0,1))
23
true
true
0
6
16
50
33
17
null
null
baig/pandoc-csv2table
csv2table.hs
mit
main :: IO () main = toJSONFilter tablifyCsvLinks
49
main :: IO () main = toJSONFilter tablifyCsvLinks
49
main = toJSONFilter tablifyCsvLinks
35
false
true
0
7
7
24
10
14
null
null
deontologician/orbRPG
Game/OrbRPG/HAdventure/Engine.hs
gpl-3.0
ambigMsg :: [String] -> Adv () ambigMsg cmds = msg $ "Perhaps you meant: " ++ strs where strs = intercalate " " cmds -- | Visit an 'Object', and store its children in the 'Object' map if it -- hasn't already been visited before. In this way the implicit -- (static) algebraic structure of the world is loaded lazily into -- the 'Object' map so it can be modified by the player.
387
ambigMsg :: [String] -> Adv () ambigMsg cmds = msg $ "Perhaps you meant: " ++ strs where strs = intercalate " " cmds -- | Visit an 'Object', and store its children in the 'Object' map if it -- hasn't already been visited before. In this way the implicit -- (static) algebraic structure of the world is loaded lazily into -- the 'Object' map so it can be modified by the player.
387
ambigMsg cmds = msg $ "Perhaps you meant: " ++ strs where strs = intercalate " " cmds -- | Visit an 'Object', and store its children in the 'Object' map if it -- hasn't already been visited before. In this way the implicit -- (static) algebraic structure of the world is loaded lazily into -- the 'Object' map so it can be modified by the player.
356
false
true
3
8
82
59
28
31
null
null
Mathnerd314/lamdu
bottlelib/Graphics/UI/Bottle/EventMap.hs
gpl-3.0
shiftedMods ModState { modShift = False } = NotShifted
54
shiftedMods ModState { modShift = False } = NotShifted
54
shiftedMods ModState { modShift = False } = NotShifted
54
false
false
1
7
8
23
10
13
null
null
adituv/qbscript
src/Compiler/QbScript/CodeGen.hs
bsd-3-clause
putOffsetHole :: Packing OffsetHole putOffsetHole = do pos <- packGetPosition hole <- putHoleWord16LE return $ H pos hole
127
putOffsetHole :: Packing OffsetHole putOffsetHole = do pos <- packGetPosition hole <- putHoleWord16LE return $ H pos hole
127
putOffsetHole = do pos <- packGetPosition hole <- putHoleWord16LE return $ H pos hole
91
false
true
0
8
23
40
18
22
null
null
denibertovic/haskell
kubernetes/lib/Kubernetes/OpenAPI/ModelLens.hs
bsd-3-clause
-- | 'v1NodeStatusImages' Lens v1NodeStatusImagesL :: Lens_' V1NodeStatus (Maybe [V1ContainerImage]) v1NodeStatusImagesL f V1NodeStatus{..} = (\v1NodeStatusImages -> V1NodeStatus { v1NodeStatusImages, ..} ) <$> f v1NodeStatusImages
231
v1NodeStatusImagesL :: Lens_' V1NodeStatus (Maybe [V1ContainerImage]) v1NodeStatusImagesL f V1NodeStatus{..} = (\v1NodeStatusImages -> V1NodeStatus { v1NodeStatusImages, ..} ) <$> f v1NodeStatusImages
200
v1NodeStatusImagesL f V1NodeStatus{..} = (\v1NodeStatusImages -> V1NodeStatus { v1NodeStatusImages, ..} ) <$> f v1NodeStatusImages
130
true
true
1
8
23
65
32
33
null
null
ancientlanguage/haskell-analysis
grammar/src/Grammar/Common/Decompose.hs
mit
decomposeChar '\xF96A' = "\x7D22"
33
decomposeChar '\xF96A' = "\x7D22"
33
decomposeChar '\xF96A' = "\x7D22"
33
false
false
0
5
3
9
4
5
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_FIXED :: GLenum gl_FIXED = 0x140C
36
gl_FIXED :: GLenum gl_FIXED = 0x140C
36
gl_FIXED = 0x140C
17
false
true
0
4
5
11
6
5
null
null
Shimuuar/type-level-numbers
TypeLevel/Number/Nat.hs
bsd-3-clause
withNat :: forall i a. (Integral i) => (forall n. Nat n => n -> a) -> i -> a withNat f i0 | i0 < 0 = error "TypeLevel.Number.Nat.withNat: negative number" | i0 == 0 = f (undefined :: Z) | otherwise = cont (fromIntegral i0) f f where cont :: Integer -> (forall n m. (Nat n, n ~ O m) => n -> a) -> (forall n m. (Nat n, n ~ I m) => n -> a) -> a cont 1 _ k1 = k1 (undefined :: I Z) cont i k0 k1 = cont (i `quot` 2) k0' k1' where k0' :: forall n m. (Nat n, n ~ O m) => n -> a k0' _ | odd i = k1 (undefined :: I n) | otherwise = k0 (undefined :: O n) k1' :: forall n m. (Nat n, n ~ I m) => n -> a k1' _ | odd i = k1 (undefined :: I n) | otherwise = k0 (undefined :: O n) ---------------------------------------------------------------- -- Data conversion -- To Integer
886
withNat :: forall i a. (Integral i) => (forall n. Nat n => n -> a) -> i -> a withNat f i0 | i0 < 0 = error "TypeLevel.Number.Nat.withNat: negative number" | i0 == 0 = f (undefined :: Z) | otherwise = cont (fromIntegral i0) f f where cont :: Integer -> (forall n m. (Nat n, n ~ O m) => n -> a) -> (forall n m. (Nat n, n ~ I m) => n -> a) -> a cont 1 _ k1 = k1 (undefined :: I Z) cont i k0 k1 = cont (i `quot` 2) k0' k1' where k0' :: forall n m. (Nat n, n ~ O m) => n -> a k0' _ | odd i = k1 (undefined :: I n) | otherwise = k0 (undefined :: O n) k1' :: forall n m. (Nat n, n ~ I m) => n -> a k1' _ | odd i = k1 (undefined :: I n) | otherwise = k0 (undefined :: O n) ---------------------------------------------------------------- -- Data conversion -- To Integer
886
withNat f i0 | i0 < 0 = error "TypeLevel.Number.Nat.withNat: negative number" | i0 == 0 = f (undefined :: Z) | otherwise = cont (fromIntegral i0) f f where cont :: Integer -> (forall n m. (Nat n, n ~ O m) => n -> a) -> (forall n m. (Nat n, n ~ I m) => n -> a) -> a cont 1 _ k1 = k1 (undefined :: I Z) cont i k0 k1 = cont (i `quot` 2) k0' k1' where k0' :: forall n m. (Nat n, n ~ O m) => n -> a k0' _ | odd i = k1 (undefined :: I n) | otherwise = k0 (undefined :: O n) k1' :: forall n m. (Nat n, n ~ I m) => n -> a k1' _ | odd i = k1 (undefined :: I n) | otherwise = k0 (undefined :: O n) ---------------------------------------------------------------- -- Data conversion -- To Integer
809
false
true
15
11
303
435
220
215
null
null
michaelgwelch/bacnet
src/BACnet/Writer.hs
mit
writeAnyAP (Prim.DoubleAP v) = writeDoubleAP v
46
writeAnyAP (Prim.DoubleAP v) = writeDoubleAP v
46
writeAnyAP (Prim.DoubleAP v) = writeDoubleAP v
46
false
false
0
7
5
21
9
12
null
null
cryptica/slapnet
src/Solver/TrapConstraints.hs
gpl-3.0
trapInitiallyMarked :: PetriNet -> SBMap Place -> SBool trapInitiallyMarked net b = bOr $ mval b $ initials net
111
trapInitiallyMarked :: PetriNet -> SBMap Place -> SBool trapInitiallyMarked net b = bOr $ mval b $ initials net
111
trapInitiallyMarked net b = bOr $ mval b $ initials net
55
false
true
0
7
18
41
19
22
null
null
badp/ganeti
src/Ganeti/OpParams.hs
gpl-2.0
pOptDiskTemplate :: Field pOptDiskTemplate = withDoc "Instance disk template" . optionalField . renameField "OptDiskTemplate" $ simpleField "disk_template" [t| DiskTemplate |]
183
pOptDiskTemplate :: Field pOptDiskTemplate = withDoc "Instance disk template" . optionalField . renameField "OptDiskTemplate" $ simpleField "disk_template" [t| DiskTemplate |]
183
pOptDiskTemplate = withDoc "Instance disk template" . optionalField . renameField "OptDiskTemplate" $ simpleField "disk_template" [t| DiskTemplate |]
157
false
true
0
8
27
38
20
18
null
null
mdorman/couch-simple
src/lib/Database/Couch/Explicit/Configuration.hs
mit
configPath :: RequestBuilder () configPath = addPath "_config"
64
configPath :: RequestBuilder () configPath = addPath "_config"
64
configPath = addPath "_config"
32
false
true
0
6
9
19
9
10
null
null
Rotsor/factorio-module-selector
factorio-module-selector.hs
unlicense
venuesByKind NoVenueVenueKind = [NoVenue]
41
venuesByKind NoVenueVenueKind = [NoVenue]
41
venuesByKind NoVenueVenueKind = [NoVenue]
41
false
false
0
5
3
12
6
6
null
null
exclipy/pdata
Data/BitUtil.hs
bsd-3-clause
bitCount8 157 = 5
17
bitCount8 157 = 5
17
bitCount8 157 = 5
17
false
false
0
5
3
9
4
5
null
null
CarstenKoenig/Countdown
src/lib/Countdown/Expressions.hs
mit
isValidOp' Sub x y = x > y
26
isValidOp' Sub x y = x > y
26
isValidOp' Sub x y = x > y
26
false
false
0
5
7
17
8
9
null
null
fmthoma/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
orphNamesOfCoAxBranches :: BranchList CoAxBranch br -> NameSet orphNamesOfCoAxBranches = brListFoldr (unionNameSet . orphNamesOfCoAxBranch) emptyNameSet
152
orphNamesOfCoAxBranches :: BranchList CoAxBranch br -> NameSet orphNamesOfCoAxBranches = brListFoldr (unionNameSet . orphNamesOfCoAxBranch) emptyNameSet
152
orphNamesOfCoAxBranches = brListFoldr (unionNameSet . orphNamesOfCoAxBranch) emptyNameSet
89
false
true
0
7
13
38
17
21
null
null
deynekalex/Money-Haskell-Project-
src/Handlers/TreeSelection.hs
gpl-2.0
--set entry's values to selectied item values onSelectionChangedHandler :: ListStore Item -> Entry -> Entry -> TreeSelection -> IO () onSelectionChangedHandler itemList editPriceEdt editDescEdt selection = do selRows <- treeSelectionGetSelectedRows selection unless (null selRows) $ do let index = head (head selRows) --get item from treeView v <- listStoreGetValue itemList index --set entry's values entrySetText editPriceEdt (show (v^.price)) entrySetText editDescEdt (v^.description)
543
onSelectionChangedHandler :: ListStore Item -> Entry -> Entry -> TreeSelection -> IO () onSelectionChangedHandler itemList editPriceEdt editDescEdt selection = do selRows <- treeSelectionGetSelectedRows selection unless (null selRows) $ do let index = head (head selRows) --get item from treeView v <- listStoreGetValue itemList index --set entry's values entrySetText editPriceEdt (show (v^.price)) entrySetText editDescEdt (v^.description)
497
onSelectionChangedHandler itemList editPriceEdt editDescEdt selection = do selRows <- treeSelectionGetSelectedRows selection unless (null selRows) $ do let index = head (head selRows) --get item from treeView v <- listStoreGetValue itemList index --set entry's values entrySetText editPriceEdt (show (v^.price)) entrySetText editDescEdt (v^.description)
409
true
true
0
15
116
139
65
74
null
null
sdiehl/ghc
testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail09.hs
bsd-3-clause
-- This tests what happens when an ambiguous record update is used in -- a splice: since it can't be represented in TH, it should error -- cleanly, rather than panicking or silently using one field. foo = [e| (MkS 3) { x = 3 } |]
229
foo = [e| (MkS 3) { x = 3 } |]
30
foo = [e| (MkS 3) { x = 3 } |]
30
true
false
1
5
46
17
10
7
null
null
felixsch/moonbase-ng
src/Moonbase/DBus.hs
lgpl-2.1
toMethod :: Ref -> Action -> Method toMethod ref (MoonbaseAction name _ f) = dbusM ref (withInterface "Action") (memberName_ name) f
132
toMethod :: Ref -> Action -> Method toMethod ref (MoonbaseAction name _ f) = dbusM ref (withInterface "Action") (memberName_ name) f
132
toMethod ref (MoonbaseAction name _ f) = dbusM ref (withInterface "Action") (memberName_ name) f
96
false
true
0
10
20
60
28
32
null
null
spencerjanssen/cabal2nix
src/Cabal2Nix/Name.hs
bsd-3-clause
-- in glibc libNixName "ruby1.8" = return "ruby"
75
libNixName "ruby1.8" = return "ruby"
63
libNixName "ruby1.8" = return "ruby"
63
true
false
0
5
34
13
6
7
null
null
rubik/stack
src/Stack/Types/TemplateName.hs
bsd-3-clause
-- | An argument which accepts a @key:value@ pair for specifying parameters. templateParamArgument :: O.Mod O.OptionFields (Text,Text) -> O.Parser (Text,Text) templateParamArgument = O.option (do string <- O.str either O.readerError return (parsePair string)) where parsePair :: String -> Either String (Text, Text) parsePair s = case break (==':') s of (key,':':value@(_:_)) -> Right (T.pack key, T.pack value) _ -> Left ("Expected key:value format for argument: " <> s) -- | Parse a template name from a string.
602
templateParamArgument :: O.Mod O.OptionFields (Text,Text) -> O.Parser (Text,Text) templateParamArgument = O.option (do string <- O.str either O.readerError return (parsePair string)) where parsePair :: String -> Either String (Text, Text) parsePair s = case break (==':') s of (key,':':value@(_:_)) -> Right (T.pack key, T.pack value) _ -> Left ("Expected key:value format for argument: " <> s) -- | Parse a template name from a string.
525
templateParamArgument = O.option (do string <- O.str either O.readerError return (parsePair string)) where parsePair :: String -> Either String (Text, Text) parsePair s = case break (==':') s of (key,':':value@(_:_)) -> Right (T.pack key, T.pack value) _ -> Left ("Expected key:value format for argument: " <> s) -- | Parse a template name from a string.
421
true
true
2
12
164
182
95
87
null
null
mydaum/cabal
Cabal/Distribution/Simple/Command.hs
bsd-3-clause
-- | Create an option taking a single OptDescr. -- No explicit Name is given for the Option, the name is the first LFlag given. option :: SFlags -> LFlags -> Description -> get -> set -> MkOptDescr get set a -> OptionField a option sf lf@(n:_) d get set arg = OptionField n [arg sf lf d get set]
307
option :: SFlags -> LFlags -> Description -> get -> set -> MkOptDescr get set a -> OptionField a option sf lf@(n:_) d get set arg = OptionField n [arg sf lf d get set]
177
option sf lf@(n:_) d get set arg = OptionField n [arg sf lf d get set]
70
true
true
0
11
71
89
45
44
null
null
markuspf/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
vToP :: TT n -> TT n vToP = vToP' [] where vToP' env (V i) = let (n, b) = (env !! i) in P Bound n (binderTy b) vToP' env (Bind n b sc) = let b' = fmap (vToP' env) b in Bind n b' (vToP' ((n, b'):env) sc) vToP' env (App s f a) = App s (vToP' env f) (vToP' env a) vToP' env t = t -- | Replace every non-free reference to the name of a binding in -- the given term with a de Bruijn index.
461
vToP :: TT n -> TT n vToP = vToP' [] where vToP' env (V i) = let (n, b) = (env !! i) in P Bound n (binderTy b) vToP' env (Bind n b sc) = let b' = fmap (vToP' env) b in Bind n b' (vToP' ((n, b'):env) sc) vToP' env (App s f a) = App s (vToP' env f) (vToP' env a) vToP' env t = t -- | Replace every non-free reference to the name of a binding in -- the given term with a de Bruijn index.
461
vToP = vToP' [] where vToP' env (V i) = let (n, b) = (env !! i) in P Bound n (binderTy b) vToP' env (Bind n b sc) = let b' = fmap (vToP' env) b in Bind n b' (vToP' ((n, b'):env) sc) vToP' env (App s f a) = App s (vToP' env f) (vToP' env a) vToP' env t = t -- | Replace every non-free reference to the name of a binding in -- the given term with a de Bruijn index.
440
false
true
1
12
170
224
104
120
null
null
ganeti-github-testing/ganeti-test-1
src/Ganeti/HTools/Program/Hspace.hs
bsd-2-clause
printClusterEff :: Cluster.CStats -> Bool -> IO () printClusterEff cs print_spn = do let format = [("memory", memEff), ("disk", dskEff), ("vcpu", cpuEff)] ++ [("spindles", spnEff) | print_spn] len = maximum $ map (length . fst) format mapM_ (\(s, fn) -> printf " - %*s usage efficiency: %5.2f%%\n" len s (fn cs * 100)) format -- | Computes the most likely failure reason.
444
printClusterEff :: Cluster.CStats -> Bool -> IO () printClusterEff cs print_spn = do let format = [("memory", memEff), ("disk", dskEff), ("vcpu", cpuEff)] ++ [("spindles", spnEff) | print_spn] len = maximum $ map (length . fst) format mapM_ (\(s, fn) -> printf " - %*s usage efficiency: %5.2f%%\n" len s (fn cs * 100)) format -- | Computes the most likely failure reason.
444
printClusterEff cs print_spn = do let format = [("memory", memEff), ("disk", dskEff), ("vcpu", cpuEff)] ++ [("spindles", spnEff) | print_spn] len = maximum $ map (length . fst) format mapM_ (\(s, fn) -> printf " - %*s usage efficiency: %5.2f%%\n" len s (fn cs * 100)) format -- | Computes the most likely failure reason.
393
false
true
0
14
134
152
81
71
null
null
acowley/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
runMainKey = mkPreludeMiscIdUnique 102
57
runMainKey = mkPreludeMiscIdUnique 102
57
runMainKey = mkPreludeMiscIdUnique 102
57
false
false
0
5
22
9
4
5
null
null
llllllllll/Math.Diophantine
Math/Diophantine/Internal.hs
gpl-2.0
solveEliptical e = case specializeEquation e of e'@(ElipticalEquation{}) -> solveEliptical e' _ -> error "solveEliptical requires an eliptical equation" -- | Solves for 'Equation's in the form of ax^2 + bxy + cy^2 + dx + ey + f = 0 -- when b^2 - 4ac = 0 -- -- WARNING: This expects that the 'Equation' is actually a 'ParabolicEquation'; -- it is safer to just call solve unless you have already verified that the -- equation is parabolic.
461
solveEliptical e = case specializeEquation e of e'@(ElipticalEquation{}) -> solveEliptical e' _ -> error "solveEliptical requires an eliptical equation" -- | Solves for 'Equation's in the form of ax^2 + bxy + cy^2 + dx + ey + f = 0 -- when b^2 - 4ac = 0 -- -- WARNING: This expects that the 'Equation' is actually a 'ParabolicEquation'; -- it is safer to just call solve unless you have already verified that the -- equation is parabolic.
461
solveEliptical e = case specializeEquation e of e'@(ElipticalEquation{}) -> solveEliptical e' _ -> error "solveEliptical requires an eliptical equation" -- | Solves for 'Equation's in the form of ax^2 + bxy + cy^2 + dx + ey + f = 0 -- when b^2 - 4ac = 0 -- -- WARNING: This expects that the 'Equation' is actually a 'ParabolicEquation'; -- it is safer to just call solve unless you have already verified that the -- equation is parabolic.
461
false
false
0
10
101
50
27
23
null
null
vikraman/ghc
compiler/prelude/TysPrim.hs
bsd-3-clause
floatPrimTyConName = mkPrimTc (fsLit "Float#") floatPrimTyConKey floatPrimTyCon
90
floatPrimTyConName = mkPrimTc (fsLit "Float#") floatPrimTyConKey floatPrimTyCon
90
floatPrimTyConName = mkPrimTc (fsLit "Float#") floatPrimTyConKey floatPrimTyCon
90
false
false
1
7
17
22
9
13
null
null
rueshyna/gogol
gogol-analytics/gen/Network/Google/Analytics/Types/Product.hs
mpl-2.0
-- | The total number of rows for the query, regardless of the number of rows -- in the response. gdTotalResults :: Lens' GaData (Maybe Int32) gdTotalResults = lens _gdTotalResults (\ s a -> s{_gdTotalResults = a}) . mapping _Coerce
246
gdTotalResults :: Lens' GaData (Maybe Int32) gdTotalResults = lens _gdTotalResults (\ s a -> s{_gdTotalResults = a}) . mapping _Coerce
148
gdTotalResults = lens _gdTotalResults (\ s a -> s{_gdTotalResults = a}) . mapping _Coerce
103
true
true
0
10
53
56
29
27
null
null
ckaestne/CIDE
CIDE_Language_Haskell/test/WSP/Webserver/Response.hs
gpl-3.0
getFileName (FileBody _size filename) = filename
48
getFileName (FileBody _size filename) = filename
48
getFileName (FileBody _size filename) = filename
48
false
false
0
7
5
17
8
9
null
null
brendanhay/gogol
gogol-servicenetworking/gen/Network/Google/ServiceNetworking/Types/Product.hs
mpl-2.0
-- | Required. Role to apply. Only allowlisted roles can be used at the -- specified granularity. The role must be one of the following: - -- \'roles\/container.hostServiceAgentUser\' applied on the shared VPC host -- project - \'roles\/compute.securityAdmin\' applied on the shared VPC -- host project pbRole :: Lens' PolicyBinding (Maybe Text) pbRole = lens _pbRole (\ s a -> s{_pbRole = a})
393
pbRole :: Lens' PolicyBinding (Maybe Text) pbRole = lens _pbRole (\ s a -> s{_pbRole = a})
90
pbRole = lens _pbRole (\ s a -> s{_pbRole = a})
47
true
true
0
9
62
50
29
21
null
null
spire/spire
src/Spire/Canonical/InitialEnv.hs
bsd-3-clause
_ElimEnum :: Type _ElimEnum = vPi "P" (VEnum `vArr` VType) $ vArr (vApp "P" VNil) $ vArr (vPi "x" VString $ vPi "xs" VEnum $ vArr (vApp "P" (var "xs")) $ vApp "P" (VCons (var "x") (var "xs"))) $ vPi "E" VEnum $ vApp "P" (var "E")
239
_ElimEnum :: Type _ElimEnum = vPi "P" (VEnum `vArr` VType) $ vArr (vApp "P" VNil) $ vArr (vPi "x" VString $ vPi "xs" VEnum $ vArr (vApp "P" (var "xs")) $ vApp "P" (VCons (var "x") (var "xs"))) $ vPi "E" VEnum $ vApp "P" (var "E")
239
_ElimEnum = vPi "P" (VEnum `vArr` VType) $ vArr (vApp "P" VNil) $ vArr (vPi "x" VString $ vPi "xs" VEnum $ vArr (vApp "P" (var "xs")) $ vApp "P" (VCons (var "x") (var "xs"))) $ vPi "E" VEnum $ vApp "P" (var "E")
221
false
true
0
13
56
148
68
80
null
null
frontrowed/stratosphere
library-gen/Stratosphere/ResourceProperties/FSxFileSystemWindowsConfiguration.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-fsx-filesystem-windowsconfiguration.html#cfn-fsx-filesystem-windowsconfiguration-activedirectoryid fsfswcActiveDirectoryId :: Lens' FSxFileSystemWindowsConfiguration (Maybe (Val Text)) fsfswcActiveDirectoryId = lens _fSxFileSystemWindowsConfigurationActiveDirectoryId (\s a -> s { _fSxFileSystemWindowsConfigurationActiveDirectoryId = a })
421
fsfswcActiveDirectoryId :: Lens' FSxFileSystemWindowsConfiguration (Maybe (Val Text)) fsfswcActiveDirectoryId = lens _fSxFileSystemWindowsConfigurationActiveDirectoryId (\s a -> s { _fSxFileSystemWindowsConfigurationActiveDirectoryId = a })
240
fsfswcActiveDirectoryId = lens _fSxFileSystemWindowsConfigurationActiveDirectoryId (\s a -> s { _fSxFileSystemWindowsConfigurationActiveDirectoryId = a })
154
true
true
0
9
22
52
28
24
null
null
reuleaux/pire
src/Pire/Parser/Parser.hs
bsd-3-clause
- inspired by fresh from Unbound -- in Unbound.LocallyNameless.Fresh ie. -- maybe call it just fresh, but then have to rename -- the functions in ReUtils -- freshS :: (MonadState PiState m) => String -> m String -- freshS s = do -- st <- get -- let n = fresh_idx st -- put (st { fresh_idx = n+1 }) -- return $ if n == 0 then s else s++show(n) -- ! later fresh :: (MonadState PiState m) => T.Text -> m T.Text fresh s = do st <- get let n = fresh_idx st put (st { fresh_idx = n+1 }) return $ if n == 0 then s else s <> (fromString $ show n)
568
fresh :: (MonadState PiState m) => T.Text -> m T.Text fresh s = do st <- get let n = fresh_idx st put (st { fresh_idx = n+1 }) return $ if n == 0 then s else s <> (fromString $ show n)
201
fresh s = do st <- get let n = fresh_idx st put (st { fresh_idx = n+1 }) return $ if n == 0 then s else s <> (fromString $ show n)
138
true
true
0
12
147
140
71
69
null
null
parsonsmatt/lambda
src/Lambda/Untyped.hs
bsd-3-clause
parseFile :: FilePath -> IO (Either (ParseError Char Dec) [Declaration]) parseFile fp = parse declarations fp <$> T.readFile fp
127
parseFile :: FilePath -> IO (Either (ParseError Char Dec) [Declaration]) parseFile fp = parse declarations fp <$> T.readFile fp
127
parseFile fp = parse declarations fp <$> T.readFile fp
54
false
true
0
10
18
54
26
28
null
null
greydot/dns
examples/SimpleServer.hs
bsd-3-clause
proxyRequest :: Conf -> ResolvConf -> DNSMessage -> IO (Maybe DNSMessage) proxyRequest Conf{..} rc req = do let worker Resolver{..} = do let packet = mconcat . toChunks $ encode req sendAll dnsSock packet receive dnsSock rs <- makeResolvSeed rc withResolver rs $ \r -> (>>= check) <$> timeout' "proxy timeout" timeOut (worker r) where ident = identifier . header $ req check :: DNSMessage -> Maybe DNSMessage check rsp = let hdr = header rsp in if identifier hdr == ident then Just rsp else Nothing
633
proxyRequest :: Conf -> ResolvConf -> DNSMessage -> IO (Maybe DNSMessage) proxyRequest Conf{..} rc req = do let worker Resolver{..} = do let packet = mconcat . toChunks $ encode req sendAll dnsSock packet receive dnsSock rs <- makeResolvSeed rc withResolver rs $ \r -> (>>= check) <$> timeout' "proxy timeout" timeOut (worker r) where ident = identifier . header $ req check :: DNSMessage -> Maybe DNSMessage check rsp = let hdr = header rsp in if identifier hdr == ident then Just rsp else Nothing
633
proxyRequest Conf{..} rc req = do let worker Resolver{..} = do let packet = mconcat . toChunks $ encode req sendAll dnsSock packet receive dnsSock rs <- makeResolvSeed rc withResolver rs $ \r -> (>>= check) <$> timeout' "proxy timeout" timeOut (worker r) where ident = identifier . header $ req check :: DNSMessage -> Maybe DNSMessage check rsp = let hdr = header rsp in if identifier hdr == ident then Just rsp else Nothing
559
false
true
24
6
221
185
101
84
null
null
mbakke/ganeti
src/Ganeti/HTools/Backend/Luxi.hs
bsd-2-clause
-- | Construct a node from a JSON object. parseNode :: NameAssoc -> [(JSValue, JSValue)] -> Result (String, Node.Node) parseNode ktg [ name, mtotal, mnode, mfree, dtotal, dfree , ctotal, cnos, offline, drained, vm_capable, spindles, g_uuid , tags, excl_stor, sptotal, spfree, cpu_speed ] = do xname <- annotateResult "Parsing new node" (fromJValWithStatus name) let convert a = genericConvert "Node" xname a xoffline <- convert "offline" offline xdrained <- convert "drained" drained xvm_capable <- convert "vm_capable" vm_capable xgdx <- convert "group.uuid" g_uuid >>= lookupGroup ktg xname xtags <- convert "tags" tags xexcl_stor <- convert "exclusive_storage" excl_stor xcpu_speed <- convert "cpu_speed" cpu_speed let live = not xoffline && xvm_capable lvconvert def n d = eitherLive live def $ convert n d xsptotal <- if xexcl_stor then lvconvert 0 "sptotal" sptotal else convert "spindles" spindles let xspfree = genericResult (const (0 :: Int)) id $ lvconvert 0 "spfree" spfree -- "spfree" might be missing, if sharedfile is the only -- supported disk template xmtotal <- lvconvert 0.0 "mtotal" mtotal xmnode <- lvconvert 0 "mnode" mnode xmfree <- lvconvert 0 "mfree" mfree let xdtotal = genericResult (const 0.0) id $ lvconvert 0.0 "dtotal" dtotal xdfree = genericResult (const 0) id $ lvconvert 0 "dfree" dfree -- "dtotal" and "dfree" might be missing, e.g., if sharedfile -- is the only supported disk template xctotal <- lvconvert 0.0 "ctotal" ctotal xcnos <- lvconvert 0 "cnos" cnos let node = flip Node.setCpuSpeed xcpu_speed . flip Node.setNodeTags xtags $ Node.create xname xmtotal xmnode xmfree xdtotal xdfree xctotal xcnos (not live || xdrained) xsptotal xspfree xgdx xexcl_stor return (xname, node)
1,983
parseNode :: NameAssoc -> [(JSValue, JSValue)] -> Result (String, Node.Node) parseNode ktg [ name, mtotal, mnode, mfree, dtotal, dfree , ctotal, cnos, offline, drained, vm_capable, spindles, g_uuid , tags, excl_stor, sptotal, spfree, cpu_speed ] = do xname <- annotateResult "Parsing new node" (fromJValWithStatus name) let convert a = genericConvert "Node" xname a xoffline <- convert "offline" offline xdrained <- convert "drained" drained xvm_capable <- convert "vm_capable" vm_capable xgdx <- convert "group.uuid" g_uuid >>= lookupGroup ktg xname xtags <- convert "tags" tags xexcl_stor <- convert "exclusive_storage" excl_stor xcpu_speed <- convert "cpu_speed" cpu_speed let live = not xoffline && xvm_capable lvconvert def n d = eitherLive live def $ convert n d xsptotal <- if xexcl_stor then lvconvert 0 "sptotal" sptotal else convert "spindles" spindles let xspfree = genericResult (const (0 :: Int)) id $ lvconvert 0 "spfree" spfree -- "spfree" might be missing, if sharedfile is the only -- supported disk template xmtotal <- lvconvert 0.0 "mtotal" mtotal xmnode <- lvconvert 0 "mnode" mnode xmfree <- lvconvert 0 "mfree" mfree let xdtotal = genericResult (const 0.0) id $ lvconvert 0.0 "dtotal" dtotal xdfree = genericResult (const 0) id $ lvconvert 0 "dfree" dfree -- "dtotal" and "dfree" might be missing, e.g., if sharedfile -- is the only supported disk template xctotal <- lvconvert 0.0 "ctotal" ctotal xcnos <- lvconvert 0 "cnos" cnos let node = flip Node.setCpuSpeed xcpu_speed . flip Node.setNodeTags xtags $ Node.create xname xmtotal xmnode xmfree xdtotal xdfree xctotal xcnos (not live || xdrained) xsptotal xspfree xgdx xexcl_stor return (xname, node)
1,941
parseNode ktg [ name, mtotal, mnode, mfree, dtotal, dfree , ctotal, cnos, offline, drained, vm_capable, spindles, g_uuid , tags, excl_stor, sptotal, spfree, cpu_speed ] = do xname <- annotateResult "Parsing new node" (fromJValWithStatus name) let convert a = genericConvert "Node" xname a xoffline <- convert "offline" offline xdrained <- convert "drained" drained xvm_capable <- convert "vm_capable" vm_capable xgdx <- convert "group.uuid" g_uuid >>= lookupGroup ktg xname xtags <- convert "tags" tags xexcl_stor <- convert "exclusive_storage" excl_stor xcpu_speed <- convert "cpu_speed" cpu_speed let live = not xoffline && xvm_capable lvconvert def n d = eitherLive live def $ convert n d xsptotal <- if xexcl_stor then lvconvert 0 "sptotal" sptotal else convert "spindles" spindles let xspfree = genericResult (const (0 :: Int)) id $ lvconvert 0 "spfree" spfree -- "spfree" might be missing, if sharedfile is the only -- supported disk template xmtotal <- lvconvert 0.0 "mtotal" mtotal xmnode <- lvconvert 0 "mnode" mnode xmfree <- lvconvert 0 "mfree" mfree let xdtotal = genericResult (const 0.0) id $ lvconvert 0.0 "dtotal" dtotal xdfree = genericResult (const 0) id $ lvconvert 0 "dfree" dfree -- "dtotal" and "dfree" might be missing, e.g., if sharedfile -- is the only supported disk template xctotal <- lvconvert 0.0 "ctotal" ctotal xcnos <- lvconvert 0 "cnos" cnos let node = flip Node.setCpuSpeed xcpu_speed . flip Node.setNodeTags xtags $ Node.create xname xmtotal xmnode xmfree xdtotal xdfree xctotal xcnos (not live || xdrained) xsptotal xspfree xgdx xexcl_stor return (xname, node)
1,864
true
true
0
14
527
549
266
283
null
null
spell-music/temporal-music-notation-demo
src/Temporal/Music/Demo/GeneralMidi.hs
bsd-3-clause
trumpet = instr 56
18
trumpet = instr 56
18
trumpet = instr 56
18
false
false
0
5
3
9
4
5
null
null
tonyday567/trade
src/Data/Tick.hs
mit
renderTick' :: (ByteString, Tick) -> Text renderTick' (sym, tick) = sformat (stext % " ") (decodeUtf8 sym) <> renderTick tick
133
renderTick' :: (ByteString, Tick) -> Text renderTick' (sym, tick) = sformat (stext % " ") (decodeUtf8 sym) <> renderTick tick
133
renderTick' (sym, tick) = sformat (stext % " ") (decodeUtf8 sym) <> renderTick tick
91
false
true
0
7
27
61
30
31
null
null
carlostome/wlp-engine
src/Expr.hs
bsd-3-clause
intarr :: SType (Array I) intarr = SArray SI
45
intarr :: SType (Array I) intarr = SArray SI
45
intarr = SArray SI
19
false
true
2
6
9
30
11
19
null
null
IreneKnapp/Faction
libfaction/Distribution/Version.hs
bsd-3-clause
minLowerBound :: LowerBound minLowerBound = LowerBound (Version [0] []) InclusiveBound
86
minLowerBound :: LowerBound minLowerBound = LowerBound (Version [0] []) InclusiveBound
86
minLowerBound = LowerBound (Version [0] []) InclusiveBound
58
false
true
0
8
9
29
15
14
null
null
sergei-romanenko/sc-mini
src/NeighborhoodAnalysis.hs
unlicense
nan' sub (Node _ (ETransient (Just (Match (Pat cname _))) t1)) (Node conf (EVariants xs)) = sub' where Just (Contraction v pat, t2) = find (\(Contraction _ (Pat cn _), _) -> cn == cname) xs sub' = nan' (sub /// [(v, pat2Ctr pat)]) t1 t2 -- in the case of conveniality class, -- we should return just sub
311
nan' sub (Node _ (ETransient (Just (Match (Pat cname _))) t1)) (Node conf (EVariants xs)) = sub' where Just (Contraction v pat, t2) = find (\(Contraction _ (Pat cn _), _) -> cn == cname) xs sub' = nan' (sub /// [(v, pat2Ctr pat)]) t1 t2 -- in the case of conveniality class, -- we should return just sub
311
nan' sub (Node _ (ETransient (Just (Match (Pat cname _))) t1)) (Node conf (EVariants xs)) = sub' where Just (Contraction v pat, t2) = find (\(Contraction _ (Pat cn _), _) -> cn == cname) xs sub' = nan' (sub /// [(v, pat2Ctr pat)]) t1 t2 -- in the case of conveniality class, -- we should return just sub
311
false
false
0
15
66
155
80
75
null
null
ndmitchell/extra
src/Control/Exception/Extra.hs
bsd-3-clause
retryBool p 1 x = x
19
retryBool p 1 x = x
19
retryBool p 1 x = x
19
false
false
0
5
5
13
6
7
null
null
ony/hledger
hledger-lib/Hledger/Data/Account.hs
gpl-3.0
clipAccountsAndAggregate :: Int -> [Account] -> [Account] clipAccountsAndAggregate d as = combined where clipped = [a{aname=clipOrEllipsifyAccountName d $ aname a} | a <- as] combined = [a{aebalance=sum (map aebalance same)} | same@(a:_) <- groupBy (\a1 a2 -> aname a1 == aname a2) clipped] {- test cases, assuming d=1: assets:cash 1 1 assets:checking 1 1 -> as: [assets:cash 1 1, assets:checking 1 1] clipped: [assets 1 1, assets 1 1] combined: [assets 2 2] assets 0 2 assets:cash 1 1 assets:checking 1 1 -> as: [assets 0 2, assets:cash 1 1, assets:checking 1 1] clipped: [assets 0 2, assets 1 1, assets 1 1] combined: [assets 2 2] assets 0 2 assets:bank 1 2 assets:bank:checking 1 1 -> as: [assets 0 2, assets:bank 1 2, assets:bank:checking 1 1] clipped: [assets 0 2, assets 1 2, assets 1 1] combined: [assets 2 2] -} -- | Remove all leaf accounts and subtrees matching a predicate.
950
clipAccountsAndAggregate :: Int -> [Account] -> [Account] clipAccountsAndAggregate d as = combined where clipped = [a{aname=clipOrEllipsifyAccountName d $ aname a} | a <- as] combined = [a{aebalance=sum (map aebalance same)} | same@(a:_) <- groupBy (\a1 a2 -> aname a1 == aname a2) clipped] {- test cases, assuming d=1: assets:cash 1 1 assets:checking 1 1 -> as: [assets:cash 1 1, assets:checking 1 1] clipped: [assets 1 1, assets 1 1] combined: [assets 2 2] assets 0 2 assets:cash 1 1 assets:checking 1 1 -> as: [assets 0 2, assets:cash 1 1, assets:checking 1 1] clipped: [assets 0 2, assets 1 1, assets 1 1] combined: [assets 2 2] assets 0 2 assets:bank 1 2 assets:bank:checking 1 1 -> as: [assets 0 2, assets:bank 1 2, assets:bank:checking 1 1] clipped: [assets 0 2, assets 1 2, assets 1 1] combined: [assets 2 2] -} -- | Remove all leaf accounts and subtrees matching a predicate.
950
clipAccountsAndAggregate d as = combined where clipped = [a{aname=clipOrEllipsifyAccountName d $ aname a} | a <- as] combined = [a{aebalance=sum (map aebalance same)} | same@(a:_) <- groupBy (\a1 a2 -> aname a1 == aname a2) clipped] {- test cases, assuming d=1: assets:cash 1 1 assets:checking 1 1 -> as: [assets:cash 1 1, assets:checking 1 1] clipped: [assets 1 1, assets 1 1] combined: [assets 2 2] assets 0 2 assets:cash 1 1 assets:checking 1 1 -> as: [assets 0 2, assets:cash 1 1, assets:checking 1 1] clipped: [assets 0 2, assets 1 1, assets 1 1] combined: [assets 2 2] assets 0 2 assets:bank 1 2 assets:bank:checking 1 1 -> as: [assets 0 2, assets:bank 1 2, assets:bank:checking 1 1] clipped: [assets 0 2, assets 1 2, assets 1 1] combined: [assets 2 2] -} -- | Remove all leaf accounts and subtrees matching a predicate.
892
false
true
1
13
218
141
74
67
null
null
SiestaMadokaist/writescheme
src/Ramadoka/Parser/LispVal.hs
bsd-3-clause
boolBoolBinOp op xs = liftM (Bool . foldl1 op) $ mapM unpackBool xs
67
boolBoolBinOp op xs = liftM (Bool . foldl1 op) $ mapM unpackBool xs
67
boolBoolBinOp op xs = liftM (Bool . foldl1 op) $ mapM unpackBool xs
67
false
false
0
9
12
33
15
18
null
null
jvilar/hrows
lib/Model/SourceInfo.hs
gpl-2.0
-- |Build a `PathAndConf` from the path of the file and a `Maybe` of the configuration. -- If the configuration is `Nothing` the file system is tested to see if it is appropriate -- to use the default config file name (from `defaultConfFileName`). It will be used if the -- file is new and the config does not exist or if both the file and the config file exist. mkPathAndConf :: FilePath -> Maybe FilePath -> IO PathAndConf mkPathAndConf fn Nothing = do let defFn = defaultConfFileName fn exFn <- doesFileExist fn exCnf <- doesFileExist defFn return . PathAndConf fn $ if exFn == exCnf then Just defFn else Nothing
691
mkPathAndConf :: FilePath -> Maybe FilePath -> IO PathAndConf mkPathAndConf fn Nothing = do let defFn = defaultConfFileName fn exFn <- doesFileExist fn exCnf <- doesFileExist defFn return . PathAndConf fn $ if exFn == exCnf then Just defFn else Nothing
328
mkPathAndConf fn Nothing = do let defFn = defaultConfFileName fn exFn <- doesFileExist fn exCnf <- doesFileExist defFn return . PathAndConf fn $ if exFn == exCnf then Just defFn else Nothing
266
true
true
0
10
185
100
46
54
null
null
Ferdinand-vW/Wlp-verification-engine
src/Transformer.hs
gpl-3.0
modifyExpr (Not e1) old new = Not e1
45
modifyExpr (Not e1) old new = Not e1
45
modifyExpr (Not e1) old new = Not e1
45
false
false
1
7
16
24
10
14
null
null
vikraman/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
hsLInstDeclBinders (L _ (TyFamInstD {})) = mempty
49
hsLInstDeclBinders (L _ (TyFamInstD {})) = mempty
49
hsLInstDeclBinders (L _ (TyFamInstD {})) = mempty
49
false
false
0
8
6
25
12
13
null
null
thalerjonathan/phd
thesis/code/concurrent/sugarscape/SugarScapePure/src/GlossRunner.hs
gpl-3.0
renderStepAnimate :: RandomGen g => (Int, Int) -> Double -> DTime -> IORef (SimulationState g) -> String -> Float -> IO GLO.Picture renderStepAnimate winSize durSecs dt ssRef perfFile _ = do ss <- readIORef ssRef (ss', out) <- simulationStep dt ss writeIORef ssRef ss' _ <- checkTime durSecs ss' perfFile modelToPicture winSize out
470
renderStepAnimate :: RandomGen g => (Int, Int) -> Double -> DTime -> IORef (SimulationState g) -> String -> Float -> IO GLO.Picture renderStepAnimate winSize durSecs dt ssRef perfFile _ = do ss <- readIORef ssRef (ss', out) <- simulationStep dt ss writeIORef ssRef ss' _ <- checkTime durSecs ss' perfFile modelToPicture winSize out
470
renderStepAnimate winSize durSecs dt ssRef perfFile _ = do ss <- readIORef ssRef (ss', out) <- simulationStep dt ss writeIORef ssRef ss' _ <- checkTime durSecs ss' perfFile modelToPicture winSize out
212
false
true
0
14
191
138
63
75
null
null
karamellpelle/grid
designer/source/Game/Do.hs
gpl-3.0
noBreakModify :: s -> a -> b -> MEnv' (Maybe (s, a, b)) noBreakModify s a b = return Nothing
96
noBreakModify :: s -> a -> b -> MEnv' (Maybe (s, a, b)) noBreakModify s a b = return Nothing
96
noBreakModify s a b = return Nothing
40
false
true
0
11
23
51
26
25
null
null
vTurbine/ghc
compiler/basicTypes/OccName.hs
bsd-3-clause
pprNameSpace :: NameSpace -> SDoc pprNameSpace DataName = text "data constructor"
82
pprNameSpace :: NameSpace -> SDoc pprNameSpace DataName = text "data constructor"
82
pprNameSpace DataName = text "data constructor"
48
false
true
0
5
11
21
10
11
null
null
dcreager/cabal
Distribution/Simple/Setup.hs
bsd-3-clause
buildVerbose :: BuildFlags -> Verbosity buildVerbose = fromFlagOrDefault normal . buildVerbosity
96
buildVerbose :: BuildFlags -> Verbosity buildVerbose = fromFlagOrDefault normal . buildVerbosity
96
buildVerbose = fromFlagOrDefault normal . buildVerbosity
56
false
true
0
6
10
22
11
11
null
null
matthiasgoergens/redgrep
src/Red.hs
bsd-3-clause
n' (Not a) = maybe (Just ()) (const Nothing) $ n' a
51
n' (Not a) = maybe (Just ()) (const Nothing) $ n' a
51
n' (Not a) = maybe (Just ()) (const Nothing) $ n' a
51
false
false
0
9
11
42
19
23
null
null
sourcegraph/srclib-haskell
src/Locations.hs
mit
ext ∷ RepoPath → Extension ext (Repo(FP[])) = Nothing
53
ext ∷ RepoPath → Extension ext (Repo(FP[])) = Nothing
53
ext (Repo(FP[])) = Nothing
26
false
true
0
9
8
36
17
19
null
null
piyush-kurur/yesod
yesod-core/Yesod/Widget.hs
mit
ihamletToRepHtml :: RenderMessage master message => HtmlUrlI18n message (Route master) -> GHandler sub master RepHtml ihamletToRepHtml ih = do urender <- getUrlRenderParams mrender <- getMessageRender return $ RepHtml $ toContent $ ih (toHtml . mrender) urender
307
ihamletToRepHtml :: RenderMessage master message => HtmlUrlI18n message (Route master) -> GHandler sub master RepHtml ihamletToRepHtml ih = do urender <- getUrlRenderParams mrender <- getMessageRender return $ RepHtml $ toContent $ ih (toHtml . mrender) urender
307
ihamletToRepHtml ih = do urender <- getUrlRenderParams mrender <- getMessageRender return $ RepHtml $ toContent $ ih (toHtml . mrender) urender
155
false
true
0
10
81
86
40
46
null
null
johan--/twitter-conduit
Web/Twitter/Conduit/Status.hs
bsd-2-clause
-- | Returns post data which updates the authenticating user's current status. -- To upload an image to accompany the tweet, use 'updateWithMedia'. -- -- You can perform a search query using 'call': -- -- @ -- res <- 'call' twInfo mgr '$' 'update' \"Hello World\" -- @ -- -- >>> update "Hello World" -- APIRequestPost "https://api.twitter.com/1.1/statuses/update.json" [("status","Hello World")] -- >>> update "Hello World" & inReplyToStatusId ?~ 1234567890 -- APIRequestPost "https://api.twitter.com/1.1/statuses/update.json" [("in_reply_to_status_id","1234567890"),("status","Hello World")] update :: T.Text -> APIRequest StatusesUpdate Status update status = APIRequestPost uri [("status", PVString status)] where uri = endpoint ++ "statuses/update.json"
759
update :: T.Text -> APIRequest StatusesUpdate Status update status = APIRequestPost uri [("status", PVString status)] where uri = endpoint ++ "statuses/update.json"
166
update status = APIRequestPost uri [("status", PVString status)] where uri = endpoint ++ "statuses/update.json"
113
true
true
0
8
95
67
40
27
null
null
wayofthepie/scar
src/Analysis/Java.hs
bsd-3-clause
getTypeDecls :: CompilationUnit -> [TypeDecl] getTypeDecls (CompilationUnit _ _ ts) = ts
88
getTypeDecls :: CompilationUnit -> [TypeDecl] getTypeDecls (CompilationUnit _ _ ts) = ts
88
getTypeDecls (CompilationUnit _ _ ts) = ts
42
false
true
0
7
11
31
16
15
null
null
mhwombat/creatur-wains-iomha
src/ALife/Creatur/Wain/Iomha/Universe.hs
bsd-3-clause
cMaturityRange :: Setting (Word16, Word16) cMaturityRange = requiredSetting "maturityRange"
91
cMaturityRange :: Setting (Word16, Word16) cMaturityRange = requiredSetting "maturityRange"
91
cMaturityRange = requiredSetting "maturityRange"
48
false
true
1
6
8
26
12
14
null
null
sdiehl/ghc
libraries/base/Data/Data.hs
bsd-3-clause
-- | Lookup a constructor via a string readConstr :: DataType -> String -> Maybe Constr readConstr dt str = case dataTypeRep dt of AlgRep cons -> idx cons IntRep -> mkReadCon (\i -> (mkPrimCon dt str (IntConstr i))) FloatRep -> mkReadCon ffloat CharRep -> mkReadCon (\c -> (mkPrimCon dt str (CharConstr c))) NoRep -> Nothing where -- Read a value and build a constructor mkReadCon :: Read t => (t -> Constr) -> Maybe Constr mkReadCon f = case (reads str) of [(t,"")] -> Just (f t) _ -> Nothing -- Traverse list of algebraic datatype constructors idx :: [Constr] -> Maybe Constr idx cons = let fit = filter ((==) str . showConstr) cons in if fit == [] then Nothing else Just (head fit) ffloat :: Double -> Constr ffloat = mkPrimCon dt str . FloatConstr . toRational ------------------------------------------------------------------------------ -- -- Convenience functions: algebraic data types -- ------------------------------------------------------------------------------ -- | Test for an algebraic type
1,215
readConstr :: DataType -> String -> Maybe Constr readConstr dt str = case dataTypeRep dt of AlgRep cons -> idx cons IntRep -> mkReadCon (\i -> (mkPrimCon dt str (IntConstr i))) FloatRep -> mkReadCon ffloat CharRep -> mkReadCon (\c -> (mkPrimCon dt str (CharConstr c))) NoRep -> Nothing where -- Read a value and build a constructor mkReadCon :: Read t => (t -> Constr) -> Maybe Constr mkReadCon f = case (reads str) of [(t,"")] -> Just (f t) _ -> Nothing -- Traverse list of algebraic datatype constructors idx :: [Constr] -> Maybe Constr idx cons = let fit = filter ((==) str . showConstr) cons in if fit == [] then Nothing else Just (head fit) ffloat :: Double -> Constr ffloat = mkPrimCon dt str . FloatConstr . toRational ------------------------------------------------------------------------------ -- -- Convenience functions: algebraic data types -- ------------------------------------------------------------------------------ -- | Test for an algebraic type
1,176
readConstr dt str = case dataTypeRep dt of AlgRep cons -> idx cons IntRep -> mkReadCon (\i -> (mkPrimCon dt str (IntConstr i))) FloatRep -> mkReadCon ffloat CharRep -> mkReadCon (\c -> (mkPrimCon dt str (CharConstr c))) NoRep -> Nothing where -- Read a value and build a constructor mkReadCon :: Read t => (t -> Constr) -> Maybe Constr mkReadCon f = case (reads str) of [(t,"")] -> Just (f t) _ -> Nothing -- Traverse list of algebraic datatype constructors idx :: [Constr] -> Maybe Constr idx cons = let fit = filter ((==) str . showConstr) cons in if fit == [] then Nothing else Just (head fit) ffloat :: Double -> Constr ffloat = mkPrimCon dt str . FloatConstr . toRational ------------------------------------------------------------------------------ -- -- Convenience functions: algebraic data types -- ------------------------------------------------------------------------------ -- | Test for an algebraic type
1,127
true
true
0
14
365
334
166
168
null
null
eggzilla/RNAlien
Biobase/RNAlien/InfernalParser.hs
gpl-3.0
readCMSearches :: String -> IO (Either ParseError CMsearch) readCMSearches filePath = do parsedFile <- parseFromFile genParserCMSearches filePath return parsedFile
167
readCMSearches :: String -> IO (Either ParseError CMsearch) readCMSearches filePath = do parsedFile <- parseFromFile genParserCMSearches filePath return parsedFile
167
readCMSearches filePath = do parsedFile <- parseFromFile genParserCMSearches filePath return parsedFile
107
false
true
0
8
22
47
21
26
null
null
Javran/hakyll
src/Hakyll/Web/Template/Context.hs
bsd-3-clause
field' :: String -> (Item a -> Compiler ContextField) -> Context a field' key value = Context $ \k _ i -> if k == key then value i else empty
141
field' :: String -> (Item a -> Compiler ContextField) -> Context a field' key value = Context $ \k _ i -> if k == key then value i else empty
141
field' key value = Context $ \k _ i -> if k == key then value i else empty
74
false
true
0
9
30
73
35
38
null
null
andreagenso/java2scala
src/J2s/Scanner.hs
apache-2.0
isHexaFloatingPointLiteral2 (c1:c2:[]) = False
50
isHexaFloatingPointLiteral2 (c1:c2:[]) = False
50
isHexaFloatingPointLiteral2 (c1:c2:[]) = False
50
false
false
0
8
7
23
11
12
null
null
brendanhay/gogol
gogol-file/gen/Network/Google/Resource/File/Projects/Locations/Backups/Patch.hs
mpl-2.0
-- | V1 error format. plbpXgafv :: Lens' ProjectsLocationsBackupsPatch (Maybe Xgafv) plbpXgafv = lens _plbpXgafv (\ s a -> s{_plbpXgafv = a})
143
plbpXgafv :: Lens' ProjectsLocationsBackupsPatch (Maybe Xgafv) plbpXgafv = lens _plbpXgafv (\ s a -> s{_plbpXgafv = a})
121
plbpXgafv = lens _plbpXgafv (\ s a -> s{_plbpXgafv = a})
58
true
true
0
9
23
48
25
23
null
null
spechub/Hets
atermlib/src/ATerm/ReadWrite.hs
gpl-2.0
mkAbbrev :: Int -> String mkAbbrev x = if x > 0 then mkAbbrevAux x "" else "A"
78
mkAbbrev :: Int -> String mkAbbrev x = if x > 0 then mkAbbrevAux x "" else "A"
78
mkAbbrev x = if x > 0 then mkAbbrevAux x "" else "A"
52
false
true
0
7
17
41
19
22
null
null
ChrisKuklewicz/SafeSemaphore
src/Control/Concurrent/STM/SSem.hs
bsd-3-clause
-- | Create a new semaphore with the given argument as the initially available quantity. This -- allows new semaphores to start with a negative, zero, or positive quantity. new :: Int -> STM SSem new = fmap SSem . newTVar
222
new :: Int -> STM SSem new = fmap SSem . newTVar
48
new = fmap SSem . newTVar
25
true
true
1
7
41
34
15
19
null
null
noteed/intake
Intake/Core.hs
bsd-3-clause
step :: WorkflowEnv -> (WorkflowEnv, [Run]) step e = let (s, rs) = step' $ envState e in (e { envState = s }, rs)
117
step :: WorkflowEnv -> (WorkflowEnv, [Run]) step e = let (s, rs) = step' $ envState e in (e { envState = s }, rs)
117
step e = let (s, rs) = step' $ envState e in (e { envState = s }, rs)
73
false
true
0
10
28
66
36
30
null
null
SumAll/haskell-eureka-client
src/Network/Eureka/Types.hs
apache-2.0
toNetworkName Unknown = "UNKNOWN"
33
toNetworkName Unknown = "UNKNOWN"
33
toNetworkName Unknown = "UNKNOWN"
33
false
false
1
5
3
13
4
9
null
null
gereeter/bounded-intmap
tests/WordMap.hs
mit
main :: IO () main = defaultMain $ testGroup "Tests" [properties, unitTests]
76
main :: IO () main = defaultMain $ testGroup "Tests" [properties, unitTests]
76
main = defaultMain $ testGroup "Tests" [properties, unitTests]
62
false
true
0
7
11
31
16
15
null
null
ikirill/ComputationalMathematics
Cube/Permutation.hs
gpl-3.0
commute :: Perm -> Perm -> Bool commute p1 p2 | size p1 /= size p2 = wrongSizeError "commute" | otherwise = not $ null $ intersect (nonfixedElts p1) (nonfixedElts p2)
170
commute :: Perm -> Perm -> Bool commute p1 p2 | size p1 /= size p2 = wrongSizeError "commute" | otherwise = not $ null $ intersect (nonfixedElts p1) (nonfixedElts p2)
170
commute p1 p2 | size p1 /= size p2 = wrongSizeError "commute" | otherwise = not $ null $ intersect (nonfixedElts p1) (nonfixedElts p2)
138
false
true
4
9
34
86
37
49
null
null