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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
davnils/formal-fft | src/Math/FormalFFT.hs | bsd-3-clause | dot (a:at) (b:bt) = (a `cmul` b) `cadd` dot at bt | 49 | dot (a:at) (b:bt) = (a `cmul` b) `cadd` dot at bt | 49 | dot (a:at) (b:bt) = (a `cmul` b) `cadd` dot at bt | 49 | false | false | 0 | 7 | 10 | 45 | 25 | 20 | null | null |
michaelbeaumont/pandoc | src/Text/Pandoc/Writers/OpenDocument.hs | gpl-2.0 | handleSpaces :: String -> Doc
handleSpaces s
| ( ' ':_) <- s = genTag s
| ('\t':x) <- s = selfClosingTag "text:tab" [] <> rm x
| otherwise = rm s
where
genTag = span (==' ') >>> tag . length *** rm >>> uncurry (<>)
tag n = when (n /= 0) $ selfClosingTag "text:s" [("text:c", show n)]
rm ( ' ':xs) = char ' ' <> genTag xs
rm ('\t':xs) = selfClosingTag "text:tab" [] <> genTag xs
rm ( x:xs) = char x <> rm xs
rm [] = empty
-- | Convert Pandoc document to string in OpenDocument format. | 576 | handleSpaces :: String -> Doc
handleSpaces s
| ( ' ':_) <- s = genTag s
| ('\t':x) <- s = selfClosingTag "text:tab" [] <> rm x
| otherwise = rm s
where
genTag = span (==' ') >>> tag . length *** rm >>> uncurry (<>)
tag n = when (n /= 0) $ selfClosingTag "text:s" [("text:c", show n)]
rm ( ' ':xs) = char ' ' <> genTag xs
rm ('\t':xs) = selfClosingTag "text:tab" [] <> genTag xs
rm ( x:xs) = char x <> rm xs
rm [] = empty
-- | Convert Pandoc document to string in OpenDocument format. | 576 | handleSpaces s
| ( ' ':_) <- s = genTag s
| ('\t':x) <- s = selfClosingTag "text:tab" [] <> rm x
| otherwise = rm s
where
genTag = span (==' ') >>> tag . length *** rm >>> uncurry (<>)
tag n = when (n /= 0) $ selfClosingTag "text:s" [("text:c", show n)]
rm ( ' ':xs) = char ' ' <> genTag xs
rm ('\t':xs) = selfClosingTag "text:tab" [] <> genTag xs
rm ( x:xs) = char x <> rm xs
rm [] = empty
-- | Convert Pandoc document to string in OpenDocument format. | 546 | false | true | 0 | 12 | 195 | 248 | 122 | 126 | null | null |
NorfairKing/the-notes | src/Logic/HoareLogic/Macro.hs | gpl-2.0 | -- | Consequence with only two arguments
-- This is useful when one of the arguments is @true@ and you would like to keep the tree small
conseq2 :: Note -> Note -> Note -> Note
conseq2 = binaryInf "[conseq]" | 207 | conseq2 :: Note -> Note -> Note -> Note
conseq2 = binaryInf "[conseq]" | 70 | conseq2 = binaryInf "[conseq]" | 30 | true | true | 0 | 9 | 39 | 35 | 16 | 19 | null | null |
phischu/fragnix | tests/packages/scotty/Data.IntMap.Internal.DeprecatedDebug.hs | bsd-3-clause | {- | /O(n)/. The expression (@'showTreeWith' hang wide map@) shows
the tree that implements the map. If @hang@ is
'True', a /hanging/ tree is shown otherwise a rotated tree is shown. If
@wide@ is 'True', an extra wide version is shown.
-}
showTreeWith :: Show a => Bool -> Bool -> IntMap a -> String
showTreeWith = IM.showTreeWith | 333 | showTreeWith :: Show a => Bool -> Bool -> IntMap a -> String
showTreeWith = IM.showTreeWith | 91 | showTreeWith = IM.showTreeWith | 30 | true | true | 0 | 9 | 60 | 36 | 18 | 18 | null | null |
bravit/Idris-dev | src/Idris/Apropos.hs | bsd-3-clause | -- | Find definitions that are relevant to all space-delimited components of
-- some string. Relevance is one or more of the following:
--
-- * the string is a substring of the name
--
-- * the string occurs in the documentation string
--
-- * the type of the definition is apropos
apropos :: IState -> T.Text -> [Name]
apropos ist what = let defs = ctxtAlist (tt_ctxt ist)
docs = toAlist (idris_docstrings ist)
in nub (map fst (isAproposAll parts defs) ++
map fst (isAproposAll parts docs))
where isAproposAll [] xs = xs
isAproposAll (what:more) xs = filter (isApropos what)
(isAproposAll more xs)
parts = filter ((> 0) . T.length) . T.splitOn (T.pack " ") $ what
-- | Find modules whose names or docstrings contain all the
-- space-delimited components of some string. | 912 | apropos :: IState -> T.Text -> [Name]
apropos ist what = let defs = ctxtAlist (tt_ctxt ist)
docs = toAlist (idris_docstrings ist)
in nub (map fst (isAproposAll parts defs) ++
map fst (isAproposAll parts docs))
where isAproposAll [] xs = xs
isAproposAll (what:more) xs = filter (isApropos what)
(isAproposAll more xs)
parts = filter ((> 0) . T.length) . T.splitOn (T.pack " ") $ what
-- | Find modules whose names or docstrings contain all the
-- space-delimited components of some string. | 630 | apropos ist what = let defs = ctxtAlist (tt_ctxt ist)
docs = toAlist (idris_docstrings ist)
in nub (map fst (isAproposAll parts defs) ++
map fst (isAproposAll parts docs))
where isAproposAll [] xs = xs
isAproposAll (what:more) xs = filter (isApropos what)
(isAproposAll more xs)
parts = filter ((> 0) . T.length) . T.splitOn (T.pack " ") $ what
-- | Find modules whose names or docstrings contain all the
-- space-delimited components of some string. | 592 | true | true | 0 | 12 | 277 | 207 | 106 | 101 | null | null |
CharlesRandles/cryptoChallenge | base64.hs | gpl-3.0 | decodeQuad (c1:c2:c3:c4:cs) =
(shift v1 2) + (shift (v2 .&. 0x30) (-4)) :
(shift (v2 .&. 0x0f) 4) + (shift (v3 .&. 0x3c) (-2)) :
(shift (v3 .&. 0x03) 6) + v4 :
[]
where v1 = fromBase64Char c1
v2 = fromBase64Char c2
v3 = fromBase64Char c3
v4 = fromBase64Char c4
--TODO:: Fix the encode bug here: toTriplets (a:[]) = [(a,0,0)] = ? | 403 | decodeQuad (c1:c2:c3:c4:cs) =
(shift v1 2) + (shift (v2 .&. 0x30) (-4)) :
(shift (v2 .&. 0x0f) 4) + (shift (v3 .&. 0x3c) (-2)) :
(shift (v3 .&. 0x03) 6) + v4 :
[]
where v1 = fromBase64Char c1
v2 = fromBase64Char c2
v3 = fromBase64Char c3
v4 = fromBase64Char c4
--TODO:: Fix the encode bug here: toTriplets (a:[]) = [(a,0,0)] = ? | 403 | decodeQuad (c1:c2:c3:c4:cs) =
(shift v1 2) + (shift (v2 .&. 0x30) (-4)) :
(shift (v2 .&. 0x0f) 4) + (shift (v3 .&. 0x3c) (-2)) :
(shift (v3 .&. 0x03) 6) + v4 :
[]
where v1 = fromBase64Char c1
v2 = fromBase64Char c2
v3 = fromBase64Char c3
v4 = fromBase64Char c4
--TODO:: Fix the encode bug here: toTriplets (a:[]) = [(a,0,0)] = ? | 403 | false | false | 0 | 14 | 137 | 167 | 87 | 80 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 92 = 91 | 7 | 92 = 91 | 7 | 92 = 91 | 7 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
nikita-volkov/laika | library/Laika/Building/ByteString/Builder/FixedPrims.hs | mit | lesserThan :: FixedPrim a
lesserThan =
fourStaticASCIIChars '&' 'l' 't' ';' | 77 | lesserThan :: FixedPrim a
lesserThan =
fourStaticASCIIChars '&' 'l' 't' ';' | 77 | lesserThan =
fourStaticASCIIChars '&' 'l' 't' ';' | 51 | false | true | 1 | 5 | 12 | 26 | 11 | 15 | null | null |
mgrabmueller/harpy | Harpy/X86CodeGen.hs | bsd-3-clause | x86_sse_ss = X86_SSE_SS | 23 | x86_sse_ss = X86_SSE_SS | 23 | x86_sse_ss = X86_SSE_SS | 23 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
ilyasergey/GHC-XAppFix | compiler/cmm/PprC.hs | bsd-3-clause | -- --------------------------------------------------------------------------
-- Statements.
--
pprStmt :: Platform -> CmmStmt -> SDoc
pprStmt platform stmt = case stmt of
CmmReturn _ -> panic "pprStmt: return statement should have been cps'd away"
CmmNop -> empty
CmmComment _ -> empty -- (hang (ptext (sLit "/*")) 3 (ftext s)) $$ ptext (sLit "*/")
-- XXX if the string contains "*/", we need to fix it
-- XXX we probably want to emit these comments when
-- some debugging option is on. They can get quite
-- large.
CmmAssign dest src -> pprAssign platform dest src
CmmStore dest src
| typeWidth rep == W64 && wordWidth /= W64
-> (if isFloatType rep then ptext (sLit "ASSIGN_DBL")
else ptext (sLit ("ASSIGN_Word64"))) <>
parens (mkP_ <> pprExpr1 platform dest <> comma <> pprExpr platform src) <> semi
| otherwise
-> hsep [ pprExpr platform (CmmLoad dest rep), equals, pprExpr platform src <> semi ]
where
rep = cmmExprType src
CmmCall (CmmCallee fn cconv) results args ret ->
maybe_proto $$
fnCall
where
cast_fn = parens (cCast platform (pprCFunType (char '*') cconv results args) fn)
real_fun_proto lbl = char ';' <>
pprCFunType (pprCLabel platform lbl) cconv results args <>
noreturn_attr <> semi
noreturn_attr = case ret of
CmmNeverReturns -> text "__attribute__ ((noreturn))"
CmmMayReturn -> empty
-- See wiki:Commentary/Compiler/Backends/PprC#Prototypes
(maybe_proto, fnCall) =
case fn of
CmmLit (CmmLabel lbl)
| StdCallConv <- cconv ->
let myCall = pprCall platform (pprCLabel platform lbl) cconv results args
in (real_fun_proto lbl, myCall)
-- stdcall functions must be declared with
-- a function type, otherwise the C compiler
-- doesn't add the @n suffix to the label. We
-- can't add the @n suffix ourselves, because
-- it isn't valid C.
| CmmNeverReturns <- ret ->
let myCall = pprCall platform (pprCLabel platform lbl) cconv results args
in (real_fun_proto lbl, myCall)
| not (isMathFun lbl) ->
pprForeignCall platform (pprCLabel platform lbl) cconv results args
_ ->
(empty {- no proto -},
pprCall platform cast_fn cconv results args <> semi)
-- for a dynamic call, no declaration is necessary.
CmmCall (CmmPrim op) results args _ret ->
proto $$ fn_call
where
cconv = CCallConv
fn = pprCallishMachOp_for_C op
(proto, fn_call)
-- The mem primops carry an extra alignment arg, must drop it.
-- We could maybe emit an alignment directive using this info.
-- We also need to cast mem primops to prevent conflicts with GCC
-- builtins (see bug #5967).
| op `elem` [MO_Memcpy, MO_Memset, MO_Memmove]
= pprForeignCall platform fn cconv results (init args)
| otherwise
= (empty, pprCall platform fn cconv results args)
CmmBranch ident -> pprBranch ident
CmmCondBranch expr ident -> pprCondBranch platform expr ident
CmmJump lbl _params -> mkJMP_(pprExpr platform lbl) <> semi
CmmSwitch arg ids -> pprSwitch platform arg ids | 3,769 | pprStmt :: Platform -> CmmStmt -> SDoc
pprStmt platform stmt = case stmt of
CmmReturn _ -> panic "pprStmt: return statement should have been cps'd away"
CmmNop -> empty
CmmComment _ -> empty -- (hang (ptext (sLit "/*")) 3 (ftext s)) $$ ptext (sLit "*/")
-- XXX if the string contains "*/", we need to fix it
-- XXX we probably want to emit these comments when
-- some debugging option is on. They can get quite
-- large.
CmmAssign dest src -> pprAssign platform dest src
CmmStore dest src
| typeWidth rep == W64 && wordWidth /= W64
-> (if isFloatType rep then ptext (sLit "ASSIGN_DBL")
else ptext (sLit ("ASSIGN_Word64"))) <>
parens (mkP_ <> pprExpr1 platform dest <> comma <> pprExpr platform src) <> semi
| otherwise
-> hsep [ pprExpr platform (CmmLoad dest rep), equals, pprExpr platform src <> semi ]
where
rep = cmmExprType src
CmmCall (CmmCallee fn cconv) results args ret ->
maybe_proto $$
fnCall
where
cast_fn = parens (cCast platform (pprCFunType (char '*') cconv results args) fn)
real_fun_proto lbl = char ';' <>
pprCFunType (pprCLabel platform lbl) cconv results args <>
noreturn_attr <> semi
noreturn_attr = case ret of
CmmNeverReturns -> text "__attribute__ ((noreturn))"
CmmMayReturn -> empty
-- See wiki:Commentary/Compiler/Backends/PprC#Prototypes
(maybe_proto, fnCall) =
case fn of
CmmLit (CmmLabel lbl)
| StdCallConv <- cconv ->
let myCall = pprCall platform (pprCLabel platform lbl) cconv results args
in (real_fun_proto lbl, myCall)
-- stdcall functions must be declared with
-- a function type, otherwise the C compiler
-- doesn't add the @n suffix to the label. We
-- can't add the @n suffix ourselves, because
-- it isn't valid C.
| CmmNeverReturns <- ret ->
let myCall = pprCall platform (pprCLabel platform lbl) cconv results args
in (real_fun_proto lbl, myCall)
| not (isMathFun lbl) ->
pprForeignCall platform (pprCLabel platform lbl) cconv results args
_ ->
(empty {- no proto -},
pprCall platform cast_fn cconv results args <> semi)
-- for a dynamic call, no declaration is necessary.
CmmCall (CmmPrim op) results args _ret ->
proto $$ fn_call
where
cconv = CCallConv
fn = pprCallishMachOp_for_C op
(proto, fn_call)
-- The mem primops carry an extra alignment arg, must drop it.
-- We could maybe emit an alignment directive using this info.
-- We also need to cast mem primops to prevent conflicts with GCC
-- builtins (see bug #5967).
| op `elem` [MO_Memcpy, MO_Memset, MO_Memmove]
= pprForeignCall platform fn cconv results (init args)
| otherwise
= (empty, pprCall platform fn cconv results args)
CmmBranch ident -> pprBranch ident
CmmCondBranch expr ident -> pprCondBranch platform expr ident
CmmJump lbl _params -> mkJMP_(pprExpr platform lbl) <> semi
CmmSwitch arg ids -> pprSwitch platform arg ids | 3,671 | pprStmt platform stmt = case stmt of
CmmReturn _ -> panic "pprStmt: return statement should have been cps'd away"
CmmNop -> empty
CmmComment _ -> empty -- (hang (ptext (sLit "/*")) 3 (ftext s)) $$ ptext (sLit "*/")
-- XXX if the string contains "*/", we need to fix it
-- XXX we probably want to emit these comments when
-- some debugging option is on. They can get quite
-- large.
CmmAssign dest src -> pprAssign platform dest src
CmmStore dest src
| typeWidth rep == W64 && wordWidth /= W64
-> (if isFloatType rep then ptext (sLit "ASSIGN_DBL")
else ptext (sLit ("ASSIGN_Word64"))) <>
parens (mkP_ <> pprExpr1 platform dest <> comma <> pprExpr platform src) <> semi
| otherwise
-> hsep [ pprExpr platform (CmmLoad dest rep), equals, pprExpr platform src <> semi ]
where
rep = cmmExprType src
CmmCall (CmmCallee fn cconv) results args ret ->
maybe_proto $$
fnCall
where
cast_fn = parens (cCast platform (pprCFunType (char '*') cconv results args) fn)
real_fun_proto lbl = char ';' <>
pprCFunType (pprCLabel platform lbl) cconv results args <>
noreturn_attr <> semi
noreturn_attr = case ret of
CmmNeverReturns -> text "__attribute__ ((noreturn))"
CmmMayReturn -> empty
-- See wiki:Commentary/Compiler/Backends/PprC#Prototypes
(maybe_proto, fnCall) =
case fn of
CmmLit (CmmLabel lbl)
| StdCallConv <- cconv ->
let myCall = pprCall platform (pprCLabel platform lbl) cconv results args
in (real_fun_proto lbl, myCall)
-- stdcall functions must be declared with
-- a function type, otherwise the C compiler
-- doesn't add the @n suffix to the label. We
-- can't add the @n suffix ourselves, because
-- it isn't valid C.
| CmmNeverReturns <- ret ->
let myCall = pprCall platform (pprCLabel platform lbl) cconv results args
in (real_fun_proto lbl, myCall)
| not (isMathFun lbl) ->
pprForeignCall platform (pprCLabel platform lbl) cconv results args
_ ->
(empty {- no proto -},
pprCall platform cast_fn cconv results args <> semi)
-- for a dynamic call, no declaration is necessary.
CmmCall (CmmPrim op) results args _ret ->
proto $$ fn_call
where
cconv = CCallConv
fn = pprCallishMachOp_for_C op
(proto, fn_call)
-- The mem primops carry an extra alignment arg, must drop it.
-- We could maybe emit an alignment directive using this info.
-- We also need to cast mem primops to prevent conflicts with GCC
-- builtins (see bug #5967).
| op `elem` [MO_Memcpy, MO_Memset, MO_Memmove]
= pprForeignCall platform fn cconv results (init args)
| otherwise
= (empty, pprCall platform fn cconv results args)
CmmBranch ident -> pprBranch ident
CmmCondBranch expr ident -> pprCondBranch platform expr ident
CmmJump lbl _params -> mkJMP_(pprExpr platform lbl) <> semi
CmmSwitch arg ids -> pprSwitch platform arg ids | 3,632 | true | true | 1 | 20 | 1,386 | 764 | 380 | 384 | null | null |
benweitzman/PhoBuddies | src/Util/JWT.hs | mit | jwtAlgorithm :: Algorithm
jwtAlgorithm = HS256 | 46 | jwtAlgorithm :: Algorithm
jwtAlgorithm = HS256 | 46 | jwtAlgorithm = HS256 | 20 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
brendanhay/gogol | gogol-surveys/gen/Network/Google/Resource/Surveys/Surveys/Get.hs | mpl-2.0 | -- | External URL ID for the survey.
sgSurveyURLId :: Lens' SurveysGet Text
sgSurveyURLId
= lens _sgSurveyURLId
(\ s a -> s{_sgSurveyURLId = a}) | 152 | sgSurveyURLId :: Lens' SurveysGet Text
sgSurveyURLId
= lens _sgSurveyURLId
(\ s a -> s{_sgSurveyURLId = a}) | 115 | sgSurveyURLId
= lens _sgSurveyURLId
(\ s a -> s{_sgSurveyURLId = a}) | 76 | true | true | 0 | 8 | 31 | 43 | 22 | 21 | null | null |
GaloisInc/halvm-ghc | compiler/nativeGen/PPC/CodeGen.hs | bsd-3-clause | getCondCode _ = panic "getCondCode(2)(powerpc)" | 47 | getCondCode _ = panic "getCondCode(2)(powerpc)" | 47 | getCondCode _ = panic "getCondCode(2)(powerpc)" | 47 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
travitch/dalvik | src/Dalvik/AccessFlags.hs | bsd-3-clause | codeFlag AMethod 0x10000 = ACC_CONSTRUCTOR | 42 | codeFlag AMethod 0x10000 = ACC_CONSTRUCTOR | 42 | codeFlag AMethod 0x10000 = ACC_CONSTRUCTOR | 42 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
facebookincubator/duckling | Duckling/Time/KA/Rules.hs | bsd-3-clause | ruleYearInterval :: Rule
ruleYearInterval = Rule
{ name = "<integer> year"
, pattern =
[ Predicate isNatural
, regex "წელიწად(ის|ი|ში)?|წლ(ის)?|წელ(შ?ი|ს)"
]
, prod = \case
(token:_) -> do
n <- getIntValue token
Token Time <$> interval TTime.Open (year n) (year $ n + 1)
_ -> Nothing
} | 333 | ruleYearInterval :: Rule
ruleYearInterval = Rule
{ name = "<integer> year"
, pattern =
[ Predicate isNatural
, regex "წელიწად(ის|ი|ში)?|წლ(ის)?|წელ(შ?ი|ს)"
]
, prod = \case
(token:_) -> do
n <- getIntValue token
Token Time <$> interval TTime.Open (year n) (year $ n + 1)
_ -> Nothing
} | 333 | ruleYearInterval = Rule
{ name = "<integer> year"
, pattern =
[ Predicate isNatural
, regex "წელიწად(ის|ი|ში)?|წლ(ის)?|წელ(შ?ი|ს)"
]
, prod = \case
(token:_) -> do
n <- getIntValue token
Token Time <$> interval TTime.Open (year n) (year $ n + 1)
_ -> Nothing
} | 308 | false | true | 0 | 17 | 95 | 114 | 58 | 56 | null | null |
emillon/http-feedproxy | src/Main.hs | bsd-3-clause | -- FIXME GPL code (github/dpx-infinity/udisksevt)
doDaemonize :: IO () -> IO ()
doDaemonize prog = do
_ <- forkProcess $ do
_ <- createSession
_ <- forkProcess $ do
nullFd <- openFd "/dev/null" ReadWrite Nothing defaultFileFlags
mapM_ closeFd [stdInput, stdOutput, stdError]
mapM_ (dupTo nullFd) [stdInput, stdOutput, stdError]
closeFd nullFd
prog
exitImmediately ExitSuccess
putStrLn "Forked to background."
exitImmediately ExitSuccess | 532 | doDaemonize :: IO () -> IO ()
doDaemonize prog = do
_ <- forkProcess $ do
_ <- createSession
_ <- forkProcess $ do
nullFd <- openFd "/dev/null" ReadWrite Nothing defaultFileFlags
mapM_ closeFd [stdInput, stdOutput, stdError]
mapM_ (dupTo nullFd) [stdInput, stdOutput, stdError]
closeFd nullFd
prog
exitImmediately ExitSuccess
putStrLn "Forked to background."
exitImmediately ExitSuccess | 482 | doDaemonize prog = do
_ <- forkProcess $ do
_ <- createSession
_ <- forkProcess $ do
nullFd <- openFd "/dev/null" ReadWrite Nothing defaultFileFlags
mapM_ closeFd [stdInput, stdOutput, stdError]
mapM_ (dupTo nullFd) [stdInput, stdOutput, stdError]
closeFd nullFd
prog
exitImmediately ExitSuccess
putStrLn "Forked to background."
exitImmediately ExitSuccess | 452 | true | true | 0 | 17 | 153 | 141 | 64 | 77 | null | null |
tekul/cryptonite | Crypto/Random.hs | bsd-3-clause | -- Length for ChaCha DRG seed
seedLength :: Int
seedLength = 40 | 63 | seedLength :: Int
seedLength = 40 | 33 | seedLength = 40 | 15 | true | true | 0 | 4 | 11 | 12 | 7 | 5 | null | null |
AlexMckey/FP101x-ItFP_Haskell | Sources/foldlInfoldr.hs | cc0-1.0 | foldl_4 = foldr . flip | 22 | foldl_4 = foldr . flip | 22 | foldl_4 = foldr . flip | 22 | false | false | 1 | 5 | 4 | 13 | 5 | 8 | null | null |
sdiehl/ghc | compiler/ghci/ByteCodeAsm.hs | bsd-3-clause | push_alts V32 = error "push_alts: vector" | 41 | push_alts V32 = error "push_alts: vector" | 41 | push_alts V32 = error "push_alts: vector" | 41 | false | false | 0 | 5 | 5 | 12 | 5 | 7 | null | null |
grsmv/sllar-client | src/Common.hs | mit | green = color Green | 19 | green = color Green | 19 | green = color Green | 19 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
gpahal/hgraph | src/HGraph/Node.hs | bsd-3-clause | removeLabelFromNodeN :: Label -> Node -> GS Node
removeLabelFromNodeN l n = do nli <- getNodeLabelIndex l
maybe (return n) (`removeLabelIndexFromNodeN` n) nli | 188 | removeLabelFromNodeN :: Label -> Node -> GS Node
removeLabelFromNodeN l n = do nli <- getNodeLabelIndex l
maybe (return n) (`removeLabelIndexFromNodeN` n) nli | 188 | removeLabelFromNodeN l n = do nli <- getNodeLabelIndex l
maybe (return n) (`removeLabelIndexFromNodeN` n) nli | 139 | false | true | 0 | 9 | 52 | 59 | 29 | 30 | null | null |
apyrgio/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | -- * Import/export I/O
-- | Direct file I/O, equivalent to a shell's I/O redirection using
-- '<' or '>'
ieioFile :: String
ieioFile = "file" | 142 | ieioFile :: String
ieioFile = "file" | 36 | ieioFile = "file" | 17 | true | true | 0 | 4 | 26 | 14 | 9 | 5 | null | null |
CulpaBS/wbBach | src/Futhark/Pass/ExtractKernels.hs | bsd-3-clause | unbalancedLambda :: Lambda -> Bool
unbalancedLambda lam =
unbalancedBody
(HS.fromList $ map paramName $ lambdaParams lam) $
lambdaBody lam
where subExpBound (Var i) bound = i `HS.member` bound
subExpBound (Constant _) _ = False
unbalancedBody bound body =
any (unbalancedBinding (bound <> boundInBody body) . bindingExp) $
bodyBindings body
-- XXX - our notion of balancing is probably still too naive.
unbalancedBinding bound (Op (Map _ w _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Reduce _ w _ _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Scan _ w _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Redomap _ w _ _ _ _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Stream _ w _ _ _)) =
w `subExpBound` bound
unbalancedBinding _ (Op Write{}) =
False
unbalancedBinding bound (DoLoop _ merge (ForLoop i iterations) body) =
iterations `subExpBound` bound ||
unbalancedBody bound' body
where bound' = foldr HS.insert bound $
i : map (paramName . fst) merge
unbalancedBinding _ (DoLoop _ _ (WhileLoop _) _) =
False
unbalancedBinding bound (If _ tbranch fbranch _) =
unbalancedBody bound tbranch || unbalancedBody bound fbranch
unbalancedBinding _ (PrimOp _) =
False
unbalancedBinding _ (Apply fname _ _) =
not $ isBuiltInFunction fname | 1,580 | unbalancedLambda :: Lambda -> Bool
unbalancedLambda lam =
unbalancedBody
(HS.fromList $ map paramName $ lambdaParams lam) $
lambdaBody lam
where subExpBound (Var i) bound = i `HS.member` bound
subExpBound (Constant _) _ = False
unbalancedBody bound body =
any (unbalancedBinding (bound <> boundInBody body) . bindingExp) $
bodyBindings body
-- XXX - our notion of balancing is probably still too naive.
unbalancedBinding bound (Op (Map _ w _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Reduce _ w _ _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Scan _ w _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Redomap _ w _ _ _ _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Stream _ w _ _ _)) =
w `subExpBound` bound
unbalancedBinding _ (Op Write{}) =
False
unbalancedBinding bound (DoLoop _ merge (ForLoop i iterations) body) =
iterations `subExpBound` bound ||
unbalancedBody bound' body
where bound' = foldr HS.insert bound $
i : map (paramName . fst) merge
unbalancedBinding _ (DoLoop _ _ (WhileLoop _) _) =
False
unbalancedBinding bound (If _ tbranch fbranch _) =
unbalancedBody bound tbranch || unbalancedBody bound fbranch
unbalancedBinding _ (PrimOp _) =
False
unbalancedBinding _ (Apply fname _ _) =
not $ isBuiltInFunction fname | 1,580 | unbalancedLambda lam =
unbalancedBody
(HS.fromList $ map paramName $ lambdaParams lam) $
lambdaBody lam
where subExpBound (Var i) bound = i `HS.member` bound
subExpBound (Constant _) _ = False
unbalancedBody bound body =
any (unbalancedBinding (bound <> boundInBody body) . bindingExp) $
bodyBindings body
-- XXX - our notion of balancing is probably still too naive.
unbalancedBinding bound (Op (Map _ w _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Reduce _ w _ _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Scan _ w _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Redomap _ w _ _ _ _ _)) =
w `subExpBound` bound
unbalancedBinding bound (Op (Stream _ w _ _ _)) =
w `subExpBound` bound
unbalancedBinding _ (Op Write{}) =
False
unbalancedBinding bound (DoLoop _ merge (ForLoop i iterations) body) =
iterations `subExpBound` bound ||
unbalancedBody bound' body
where bound' = foldr HS.insert bound $
i : map (paramName . fst) merge
unbalancedBinding _ (DoLoop _ _ (WhileLoop _) _) =
False
unbalancedBinding bound (If _ tbranch fbranch _) =
unbalancedBody bound tbranch || unbalancedBody bound fbranch
unbalancedBinding _ (PrimOp _) =
False
unbalancedBinding _ (Apply fname _ _) =
not $ isBuiltInFunction fname | 1,545 | false | true | 5 | 11 | 504 | 549 | 268 | 281 | null | null |
sonyandy/perm | Control/Monad/Perm/Internal.hs | bsd-3-clause | liftM' :: Monad m => (a -> b) -> Perm m a -> Perm m b
liftM' f (Plus dict m n) = Plus dict (liftM' f m) (liftM' f n) | 116 | liftM' :: Monad m => (a -> b) -> Perm m a -> Perm m b
liftM' f (Plus dict m n) = Plus dict (liftM' f m) (liftM' f n) | 116 | liftM' f (Plus dict m n) = Plus dict (liftM' f m) (liftM' f n) | 62 | false | true | 0 | 11 | 30 | 86 | 40 | 46 | null | null |
sanjoy/DietLISP | src/Builtins.hs | gpl-2.0 | invalidArgsErr fn args = BottomD $ "invalid arguments to " ++ fn ++ ": " ++ show args | 85 | invalidArgsErr fn args = BottomD $ "invalid arguments to " ++ fn ++ ": " ++ show args | 85 | invalidArgsErr fn args = BottomD $ "invalid arguments to " ++ fn ++ ": " ++ show args | 85 | false | false | 0 | 8 | 17 | 30 | 14 | 16 | null | null |
andreyk0/amqp-tail | src/Main.hs | bsd-3-clause | tailAMQP:: App -> IO ()
tailAMQP app@App{..} = do
conn <- openConnection host (T.pack vhost) (T.pack user) (T.pack password)
chan <- openChannel conn
-- declare a queue, exchange and binding
(qName, _, _) <- declareQueue chan newQueue { queueExclusive = True, queueAutoDelete = True }
bindQueue chan qName (T.pack exchange) (T.pack routingKey)
-- subscribe to the queue
_ <- consumeMsgs chan qName Ack (msgCallback app)
let loop = do
l <- getLine -- wait for keypress
if l == "q" || l == "quit"
then do closeConnection conn
putStrLn "Quitting ..."
else loop
loop | 637 | tailAMQP:: App -> IO ()
tailAMQP app@App{..} = do
conn <- openConnection host (T.pack vhost) (T.pack user) (T.pack password)
chan <- openChannel conn
-- declare a queue, exchange and binding
(qName, _, _) <- declareQueue chan newQueue { queueExclusive = True, queueAutoDelete = True }
bindQueue chan qName (T.pack exchange) (T.pack routingKey)
-- subscribe to the queue
_ <- consumeMsgs chan qName Ack (msgCallback app)
let loop = do
l <- getLine -- wait for keypress
if l == "q" || l == "quit"
then do closeConnection conn
putStrLn "Quitting ..."
else loop
loop | 637 | tailAMQP app@App{..} = do
conn <- openConnection host (T.pack vhost) (T.pack user) (T.pack password)
chan <- openChannel conn
-- declare a queue, exchange and binding
(qName, _, _) <- declareQueue chan newQueue { queueExclusive = True, queueAutoDelete = True }
bindQueue chan qName (T.pack exchange) (T.pack routingKey)
-- subscribe to the queue
_ <- consumeMsgs chan qName Ack (msgCallback app)
let loop = do
l <- getLine -- wait for keypress
if l == "q" || l == "quit"
then do closeConnection conn
putStrLn "Quitting ..."
else loop
loop | 613 | false | true | 14 | 10 | 168 | 198 | 102 | 96 | null | null |
keithodulaigh/Hets | Static/GTheory.hs | gpl-2.0 | getThAxioms :: G_theory -> [(String, Bool)]
getThAxioms (G_theory _ _ _ _ sens _) = map
(\ (k, s) -> (k, wasTheorem s))
$ OMap.toList $ OMap.filter isAxiom sens | 168 | getThAxioms :: G_theory -> [(String, Bool)]
getThAxioms (G_theory _ _ _ _ sens _) = map
(\ (k, s) -> (k, wasTheorem s))
$ OMap.toList $ OMap.filter isAxiom sens | 168 | getThAxioms (G_theory _ _ _ _ sens _) = map
(\ (k, s) -> (k, wasTheorem s))
$ OMap.toList $ OMap.filter isAxiom sens | 124 | false | true | 4 | 9 | 36 | 94 | 47 | 47 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/isAscii_1.hs | mit | esEsOrdering GT LT = MyFalse | 28 | esEsOrdering GT LT = MyFalse | 28 | esEsOrdering GT LT = MyFalse | 28 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpFixity DoubleLeOp = Just (Fixity 4 InfixN) | 48 | primOpFixity DoubleLeOp = Just (Fixity 4 InfixN) | 48 | primOpFixity DoubleLeOp = Just (Fixity 4 InfixN) | 48 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
mikeizbicki/Classification | src/AI/Classification/DecisionStump.hs | bsd-3-clause | fetchLabelCount :: (Ord labelType) => DStump labelType -> DataItem -> Map.Map labelType Int
fetchLabelCount dt Missing = defaultLabelCount dt | 141 | fetchLabelCount :: (Ord labelType) => DStump labelType -> DataItem -> Map.Map labelType Int
fetchLabelCount dt Missing = defaultLabelCount dt | 141 | fetchLabelCount dt Missing = defaultLabelCount dt | 49 | false | true | 0 | 10 | 18 | 50 | 23 | 27 | null | null |
spechub/Hets | LF/Sign.hs | gpl-2.0 | -- get the set of symbols included from other signatures
getGlobalSyms :: Sign -> Set.Set Symbol
getGlobalSyms sig = Set.filter (`isGlobalSym` sig) $ getSymbols sig | 164 | getGlobalSyms :: Sign -> Set.Set Symbol
getGlobalSyms sig = Set.filter (`isGlobalSym` sig) $ getSymbols sig | 107 | getGlobalSyms sig = Set.filter (`isGlobalSym` sig) $ getSymbols sig | 67 | true | true | 0 | 7 | 24 | 42 | 22 | 20 | null | null |
karamellpelle/grid | designer/source/Game/Values.hs | gpl-3.0 | valueGridMaxPathSize :: UInt
valueGridMaxPathSize =
255 | 59 | valueGridMaxPathSize :: UInt
valueGridMaxPathSize =
255 | 59 | valueGridMaxPathSize =
255 | 30 | false | true | 0 | 4 | 9 | 11 | 6 | 5 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | -- Generic data constructors
crossDataConKey, inlDataConKey, inrDataConKey, genUnitDataConKey :: Unique
crossDataConKey = mkPreludeDataConUnique 20 | 171 | crossDataConKey, inlDataConKey, inrDataConKey, genUnitDataConKey :: Unique
crossDataConKey = mkPreludeDataConUnique 20 | 142 | crossDataConKey = mkPreludeDataConUnique 20 | 67 | true | true | 2 | 5 | 37 | 25 | 14 | 11 | null | null |
hamishmack/haskell-gi | lib/Data/GI/CodeGen/Overrides.hs | lgpl-2.1 | parseIgnore (T.words -> [T.splitOn "." -> [api,elem]]) (Just ns) =
tell $ defaultOverrides {ignoredElems = M.singleton (Name ns api)
(S.singleton elem)} | 197 | parseIgnore (T.words -> [T.splitOn "." -> [api,elem]]) (Just ns) =
tell $ defaultOverrides {ignoredElems = M.singleton (Name ns api)
(S.singleton elem)} | 197 | parseIgnore (T.words -> [T.splitOn "." -> [api,elem]]) (Just ns) =
tell $ defaultOverrides {ignoredElems = M.singleton (Name ns api)
(S.singleton elem)} | 197 | false | false | 2 | 11 | 65 | 87 | 43 | 44 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/sequence__2.hs | mit | psPs (Cons x xs) ys = Cons x (psPs xs ys) | 41 | psPs (Cons x xs) ys = Cons x (psPs xs ys) | 41 | psPs (Cons x xs) ys = Cons x (psPs xs ys) | 41 | false | false | 0 | 7 | 10 | 32 | 15 | 17 | null | null |
damianfral/clay | src/Clay/Selector.hs | bsd-3-clause | -- | The star selector applies to all elements. Maps to @*@ in CSS.
star :: Selector
star = In (SelectorF (Refinement []) Star) | 128 | star :: Selector
star = In (SelectorF (Refinement []) Star) | 59 | star = In (SelectorF (Refinement []) Star) | 42 | true | true | 0 | 10 | 24 | 31 | 16 | 15 | null | null |
sdiehl/ghc | compiler/basicTypes/Literal.hs | bsd-3-clause | -- Note [Types of LitNumbers]
literalType (LitRubbish) = mkForAllTy a Inferred (mkTyVarTy a)
where
a = alphaTyVarUnliftedRep | 135 | literalType (LitRubbish) = mkForAllTy a Inferred (mkTyVarTy a)
where
a = alphaTyVarUnliftedRep | 105 | literalType (LitRubbish) = mkForAllTy a Inferred (mkTyVarTy a)
where
a = alphaTyVarUnliftedRep | 105 | true | false | 1 | 7 | 27 | 39 | 17 | 22 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_INDIC_PLAIN :: Int
wxSTC_INDIC_PLAIN = 0 | 46 | wxSTC_INDIC_PLAIN :: Int
wxSTC_INDIC_PLAIN = 0 | 46 | wxSTC_INDIC_PLAIN = 0 | 21 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
dsj36/beekeeper | src/Beekeeper/Core/Identifiers.hs | bsd-3-clause | splitOn :: Char -> String -> [String]
splitOn _ [] = [] | 55 | splitOn :: Char -> String -> [String]
splitOn _ [] = [] | 55 | splitOn _ [] = [] | 17 | false | true | 0 | 7 | 11 | 31 | 16 | 15 | null | null |
urv/fixhs | src/Data/FIX/Spec/FIX42.hs | lgpl-2.1 | tValueOfFutures :: FIXTag
tValueOfFutures = FIXTag
{ tName = "ValueOfFutures"
, tnum = 408
, tparser = toFIXDouble
, arbitraryValue = FIXDouble <$> (return (-2.112 :: Double)) } | 190 | tValueOfFutures :: FIXTag
tValueOfFutures = FIXTag
{ tName = "ValueOfFutures"
, tnum = 408
, tparser = toFIXDouble
, arbitraryValue = FIXDouble <$> (return (-2.112 :: Double)) } | 190 | tValueOfFutures = FIXTag
{ tName = "ValueOfFutures"
, tnum = 408
, tparser = toFIXDouble
, arbitraryValue = FIXDouble <$> (return (-2.112 :: Double)) } | 164 | false | true | 0 | 12 | 40 | 59 | 34 | 25 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 895 = 894 | 9 | 895 = 894 | 9 | 895 = 894 | 9 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
green-haskell/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | basicBlockCodeGen
:: CmmBlock
-> NatM ( [NatBasicBlock Instr]
, [NatCmmDecl (Alignment, CmmStatics) Instr])
basicBlockCodeGen block = do
let (_, nodes, tail) = blockSplit block
id = entryLabel block
stmts = blockToList nodes
-- Generate location directive
dbg <- getDebugBlock (entryLabel block)
loc_instrs <- case dblSourceTick =<< dbg of
Just (SourceNote span name)
-> do fileId <- getFileId (srcSpanFile span)
let line = srcSpanStartLine span; col = srcSpanStartCol span
return $ unitOL $ LOCATION fileId line col name
_ -> return nilOL
mid_instrs <- stmtsToInstrs stmts
tail_instrs <- stmtToInstrs tail
let instrs = loc_instrs `appOL` mid_instrs `appOL` tail_instrs
-- code generation may introduce new basic block boundaries, which
-- are indicated by the NEWBLOCK instruction. We must split up the
-- instruction stream into basic blocks again. Also, we extract
-- LDATAs here too.
let
(top,other_blocks,statics) = foldrOL mkBlocks ([],[],[]) instrs
mkBlocks (NEWBLOCK id) (instrs,blocks,statics)
= ([], BasicBlock id instrs : blocks, statics)
mkBlocks (LDATA sec dat) (instrs,blocks,statics)
= (instrs, blocks, CmmData sec dat:statics)
mkBlocks instr (instrs,blocks,statics)
= (instr:instrs, blocks, statics)
return (BasicBlock id top : other_blocks, statics) | 1,441 | basicBlockCodeGen
:: CmmBlock
-> NatM ( [NatBasicBlock Instr]
, [NatCmmDecl (Alignment, CmmStatics) Instr])
basicBlockCodeGen block = do
let (_, nodes, tail) = blockSplit block
id = entryLabel block
stmts = blockToList nodes
-- Generate location directive
dbg <- getDebugBlock (entryLabel block)
loc_instrs <- case dblSourceTick =<< dbg of
Just (SourceNote span name)
-> do fileId <- getFileId (srcSpanFile span)
let line = srcSpanStartLine span; col = srcSpanStartCol span
return $ unitOL $ LOCATION fileId line col name
_ -> return nilOL
mid_instrs <- stmtsToInstrs stmts
tail_instrs <- stmtToInstrs tail
let instrs = loc_instrs `appOL` mid_instrs `appOL` tail_instrs
-- code generation may introduce new basic block boundaries, which
-- are indicated by the NEWBLOCK instruction. We must split up the
-- instruction stream into basic blocks again. Also, we extract
-- LDATAs here too.
let
(top,other_blocks,statics) = foldrOL mkBlocks ([],[],[]) instrs
mkBlocks (NEWBLOCK id) (instrs,blocks,statics)
= ([], BasicBlock id instrs : blocks, statics)
mkBlocks (LDATA sec dat) (instrs,blocks,statics)
= (instrs, blocks, CmmData sec dat:statics)
mkBlocks instr (instrs,blocks,statics)
= (instr:instrs, blocks, statics)
return (BasicBlock id top : other_blocks, statics) | 1,440 | basicBlockCodeGen block = do
let (_, nodes, tail) = blockSplit block
id = entryLabel block
stmts = blockToList nodes
-- Generate location directive
dbg <- getDebugBlock (entryLabel block)
loc_instrs <- case dblSourceTick =<< dbg of
Just (SourceNote span name)
-> do fileId <- getFileId (srcSpanFile span)
let line = srcSpanStartLine span; col = srcSpanStartCol span
return $ unitOL $ LOCATION fileId line col name
_ -> return nilOL
mid_instrs <- stmtsToInstrs stmts
tail_instrs <- stmtToInstrs tail
let instrs = loc_instrs `appOL` mid_instrs `appOL` tail_instrs
-- code generation may introduce new basic block boundaries, which
-- are indicated by the NEWBLOCK instruction. We must split up the
-- instruction stream into basic blocks again. Also, we extract
-- LDATAs here too.
let
(top,other_blocks,statics) = foldrOL mkBlocks ([],[],[]) instrs
mkBlocks (NEWBLOCK id) (instrs,blocks,statics)
= ([], BasicBlock id instrs : blocks, statics)
mkBlocks (LDATA sec dat) (instrs,blocks,statics)
= (instrs, blocks, CmmData sec dat:statics)
mkBlocks instr (instrs,blocks,statics)
= (instr:instrs, blocks, statics)
return (BasicBlock id top : other_blocks, statics) | 1,300 | false | true | 0 | 16 | 351 | 429 | 222 | 207 | null | null |
mgsloan/quasi-extras | src/Language/Quasi/Internal/Unused.hs | bsd-3-clause | reifyError :: String -> Name -> Info -> ErrorQ a
reifyError s n i = errorQ $ "Could not reify " ++ s ++ " for "
++ "'" ++ pprint n ++ "' - instead got:\n"
++ pprint i | 198 | reifyError :: String -> Name -> Info -> ErrorQ a
reifyError s n i = errorQ $ "Could not reify " ++ s ++ " for "
++ "'" ++ pprint n ++ "' - instead got:\n"
++ pprint i | 198 | reifyError s n i = errorQ $ "Could not reify " ++ s ++ " for "
++ "'" ++ pprint n ++ "' - instead got:\n"
++ pprint i | 149 | false | true | 0 | 11 | 71 | 67 | 32 | 35 | null | null |
adp-multi/adp-multi | src/ADP/Multi/Rewriting/Explicit.hs | bsd-3-clause | adjustMinYield :: Subword1 -> YieldSize -> YieldSize -> Maybe (Int,Int)
adjustMinYield (i,j) (minl,maxl) (minr,maxr) =
let len = j-i
adjust oldMinY maxY = let x = maybe oldMinY (\m -> len - m) maxY
in max x oldMinY
minrAdj = adjust minr maxl
minlAdj = adjust minl maxr
in do
minlRes <- maybe (Just minlAdj) (\m -> if minlAdj > m then Nothing else Just minlAdj) maxl
minrRes <- maybe (Just minrAdj) (\m -> if minrAdj > m then Nothing else Just minrAdj) maxr
Just (minlRes,minrRes)
-- assumes that other nonterminal component is in the same part | 663 | adjustMinYield :: Subword1 -> YieldSize -> YieldSize -> Maybe (Int,Int)
adjustMinYield (i,j) (minl,maxl) (minr,maxr) =
let len = j-i
adjust oldMinY maxY = let x = maybe oldMinY (\m -> len - m) maxY
in max x oldMinY
minrAdj = adjust minr maxl
minlAdj = adjust minl maxr
in do
minlRes <- maybe (Just minlAdj) (\m -> if minlAdj > m then Nothing else Just minlAdj) maxl
minrRes <- maybe (Just minrAdj) (\m -> if minrAdj > m then Nothing else Just minrAdj) maxr
Just (minlRes,minrRes)
-- assumes that other nonterminal component is in the same part | 663 | adjustMinYield (i,j) (minl,maxl) (minr,maxr) =
let len = j-i
adjust oldMinY maxY = let x = maybe oldMinY (\m -> len - m) maxY
in max x oldMinY
minrAdj = adjust minr maxl
minlAdj = adjust minl maxr
in do
minlRes <- maybe (Just minlAdj) (\m -> if minlAdj > m then Nothing else Just minlAdj) maxl
minrRes <- maybe (Just minrAdj) (\m -> if minrAdj > m then Nothing else Just minrAdj) maxr
Just (minlRes,minrRes)
-- assumes that other nonterminal component is in the same part | 591 | false | true | 0 | 16 | 216 | 236 | 122 | 114 | null | null |
hvr/jhc | src/E/PrimDecode.hs | mit | (+>) :: Typ -> Typ -> Typ
~([] :-> k) +> ks :-> rt = (k:ks) :-> rt | 66 | (+>) :: Typ -> Typ -> Typ
~([] :-> k) +> ks :-> rt = (k:ks) :-> rt | 66 | ~([] :-> k) +> ks :-> rt = (k:ks) :-> rt | 40 | false | true | 0 | 9 | 17 | 52 | 27 | 25 | null | null |
kazu-yamamoto/dns | test/RoundTripSpec.hs | bsd-3-clause | genIPv4 :: Gen IPv4
genIPv4 = toIPv4 <$> replicateM 4 (fromIntegral <$> genWord8) | 81 | genIPv4 :: Gen IPv4
genIPv4 = toIPv4 <$> replicateM 4 (fromIntegral <$> genWord8) | 81 | genIPv4 = toIPv4 <$> replicateM 4 (fromIntegral <$> genWord8) | 61 | false | true | 0 | 8 | 12 | 30 | 15 | 15 | null | null |
tolysz/prepare-ghcjs | spec-lts8/cabal/cabal-install/Distribution/Client/ProjectPlanning.hs | bsd-3-clause | programsMonitorFiles :: ProgramDb -> [MonitorFilePath]
programsMonitorFiles progdb =
[ monitor
| prog <- configuredPrograms progdb
, monitor <- monitorFileSearchPath (programMonitorFiles prog)
(programPath prog)
] | 271 | programsMonitorFiles :: ProgramDb -> [MonitorFilePath]
programsMonitorFiles progdb =
[ monitor
| prog <- configuredPrograms progdb
, monitor <- monitorFileSearchPath (programMonitorFiles prog)
(programPath prog)
] | 271 | programsMonitorFiles progdb =
[ monitor
| prog <- configuredPrograms progdb
, monitor <- monitorFileSearchPath (programMonitorFiles prog)
(programPath prog)
] | 216 | false | true | 0 | 11 | 81 | 64 | 31 | 33 | null | null |
orchid-hybrid/absint-study | Ch1_Sign.hs | gpl-2.0 | e_sgn (x :+: y) = e_sgn x `p` e_sgn y | 37 | e_sgn (x :+: y) = e_sgn x `p` e_sgn y | 37 | e_sgn (x :+: y) = e_sgn x `p` e_sgn y | 37 | false | false | 0 | 7 | 9 | 28 | 14 | 14 | null | null |
harley/hamball | src/Common.hs | mit | -- width MUST be divisible by 4
-- height MUST be divisible by 3
width, height :: GLint
(width,height) = (640, 480) | 115 | width, height :: GLint
(width,height) = (640, 480) | 50 | (width,height) = (640, 480) | 27 | true | true | 0 | 5 | 21 | 28 | 18 | 10 | null | null |
iljakuklic/eel-proto | src/Sema/Term.hs | bsd-3-clause | getMeta (TUnit m) = m | 26 | getMeta (TUnit m) = m | 26 | getMeta (TUnit m) = m | 26 | false | false | 0 | 7 | 9 | 15 | 7 | 8 | null | null |
hjwylde/qux | test/shared/src/Qux/Test/Steps.hs | bsd-3-clause | link :: FilePath -> WorkerT IO ()
link dir = do
filePaths <- findFilesByExtension [".o"] binDir
liftIO $ createDirectoryIfMissing True distDir
runProcess "gcc" (["-o", distDir </> "main"] ++ filePaths) ""
where
binDir = dir </> "bin"
distDir = dir </> "dist" | 293 | link :: FilePath -> WorkerT IO ()
link dir = do
filePaths <- findFilesByExtension [".o"] binDir
liftIO $ createDirectoryIfMissing True distDir
runProcess "gcc" (["-o", distDir </> "main"] ++ filePaths) ""
where
binDir = dir </> "bin"
distDir = dir </> "dist" | 293 | link dir = do
filePaths <- findFilesByExtension [".o"] binDir
liftIO $ createDirectoryIfMissing True distDir
runProcess "gcc" (["-o", distDir </> "main"] ++ filePaths) ""
where
binDir = dir </> "bin"
distDir = dir </> "dist" | 259 | false | true | 6 | 11 | 75 | 113 | 50 | 63 | null | null |
mitochon/hexercise | src/haskellbook/ch18/ch18.hs | mit | Nil <*> _ = Nil | 15 | Nil <*> _ = Nil | 15 | Nil <*> _ = Nil | 15 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
bitc/omegagb | src/Cpu.hs | gpl-2.0 | mcti 0x87 _ = (ADD A, 4, 0) | 62 | mcti 0x87 _ = (ADD A, 4, 0) | 62 | mcti 0x87 _ = (ADD A, 4, 0) | 62 | false | false | 0 | 6 | 42 | 25 | 12 | 13 | null | null |
bvdelft/parac2 | src/Language/Java/Paragon/Monad/PiReader.hs | bsd-3-clause | getTypeContents :: MonadPR m => Name a -> m (CompilationUnit SourcePos)
getTypeContents n = liftPR $ do
let path = tNameToFile n
piPath <- getPiPath
findFirstPi path piPath
where findFirstPi :: FilePath -> [FilePath] -> PiReader (CompilationUnit SourcePos)
findFirstPi _ [] = panic (piReaderModule ++ ".getTypeContents")
("No such type exists - doesTypeExist not called successfully: "
++ show n)
findFirstPi path (pip:pips) = do
isT <- liftIO $ doesFileExist $ pip </> path
if isT
then do fc <- liftIO $ readFile $ pip </> path
let pRes = parser compilationUnit fc
case pRes of
Right cu -> return cu
Left pe -> fail $ "Parse error in pi file for type "
++ prettyPrint n ++ ":\n"
++ show pe
else findFirstPi path pips
---- Helper functions
-- |Return only the names of files with .pi extension. The extension is dropped | 1,245 | getTypeContents :: MonadPR m => Name a -> m (CompilationUnit SourcePos)
getTypeContents n = liftPR $ do
let path = tNameToFile n
piPath <- getPiPath
findFirstPi path piPath
where findFirstPi :: FilePath -> [FilePath] -> PiReader (CompilationUnit SourcePos)
findFirstPi _ [] = panic (piReaderModule ++ ".getTypeContents")
("No such type exists - doesTypeExist not called successfully: "
++ show n)
findFirstPi path (pip:pips) = do
isT <- liftIO $ doesFileExist $ pip </> path
if isT
then do fc <- liftIO $ readFile $ pip </> path
let pRes = parser compilationUnit fc
case pRes of
Right cu -> return cu
Left pe -> fail $ "Parse error in pi file for type "
++ prettyPrint n ++ ":\n"
++ show pe
else findFirstPi path pips
---- Helper functions
-- |Return only the names of files with .pi extension. The extension is dropped | 1,245 | getTypeContents n = liftPR $ do
let path = tNameToFile n
piPath <- getPiPath
findFirstPi path piPath
where findFirstPi :: FilePath -> [FilePath] -> PiReader (CompilationUnit SourcePos)
findFirstPi _ [] = panic (piReaderModule ++ ".getTypeContents")
("No such type exists - doesTypeExist not called successfully: "
++ show n)
findFirstPi path (pip:pips) = do
isT <- liftIO $ doesFileExist $ pip </> path
if isT
then do fc <- liftIO $ readFile $ pip </> path
let pRes = parser compilationUnit fc
case pRes of
Right cu -> return cu
Left pe -> fail $ "Parse error in pi file for type "
++ prettyPrint n ++ ":\n"
++ show pe
else findFirstPi path pips
---- Helper functions
-- |Return only the names of files with .pi extension. The extension is dropped | 1,173 | false | true | 4 | 17 | 567 | 266 | 126 | 140 | null | null |
TOSPIO/jason | src/Jason/Util.hs | gpl-3.0 | bsToStr :: ByteString -> String
bsToStr = T.unpack . decodeUtf8 | 63 | bsToStr :: ByteString -> String
bsToStr = T.unpack . decodeUtf8 | 63 | bsToStr = T.unpack . decodeUtf8 | 31 | false | true | 0 | 6 | 9 | 21 | 11 | 10 | null | null |
tmcgilchrist/riak-haskell-client | riak/benchmarks/Main.hs | apache-2.0 | getEmpty c = get c "counters" "not here" "never was" | 54 | getEmpty c = get c "counters" "not here" "never was" | 54 | getEmpty c = get c "counters" "not here" "never was" | 54 | false | false | 0 | 5 | 11 | 18 | 8 | 10 | null | null |
siddhanathan/yi | example-configs/yi-emacs-vty-static/Main.hs | gpl-2.0 | main :: IO ()
main = do
files <- getArgs
let openFileActions = intersperse (EditorA newTabE) (map (YiA . openNewFile) files)
cfg <- execStateT
(runConfigM (myConfig >> (startActionsA .= openFileActions)))
defaultConfig
startEditor cfg Nothing | 274 | main :: IO ()
main = do
files <- getArgs
let openFileActions = intersperse (EditorA newTabE) (map (YiA . openNewFile) files)
cfg <- execStateT
(runConfigM (myConfig >> (startActionsA .= openFileActions)))
defaultConfig
startEditor cfg Nothing | 274 | main = do
files <- getArgs
let openFileActions = intersperse (EditorA newTabE) (map (YiA . openNewFile) files)
cfg <- execStateT
(runConfigM (myConfig >> (startActionsA .= openFileActions)))
defaultConfig
startEditor cfg Nothing | 260 | false | true | 0 | 14 | 65 | 98 | 47 | 51 | null | null |
ctford/Idris-Elba-dev | src/Idris/REPL.hs | bsd-3-clause | parseArgs ("-O2":ns) = OptLevel 2 : parseArgs ns | 60 | parseArgs ("-O2":ns) = OptLevel 2 : parseArgs ns | 60 | parseArgs ("-O2":ns) = OptLevel 2 : parseArgs ns | 60 | false | false | 0 | 6 | 19 | 27 | 12 | 15 | null | null |
keera-studios/hssdl | Examples/NeHe/lesson08/lesson8.sdl.hs | bsd-3-clause | resizeGLScene w h
= do setVideoMode w h 0 [OpenGL,Resizeable]
viewport $= (Position 0 0, Size (fromIntegral w) (fromIntegral h))
matrixMode $= Projection
loadIdentity
perspective 45 radio 0.1 100
matrixMode $= Modelview 0
where radio = fromIntegral w / fromIntegral h | 320 | resizeGLScene w h
= do setVideoMode w h 0 [OpenGL,Resizeable]
viewport $= (Position 0 0, Size (fromIntegral w) (fromIntegral h))
matrixMode $= Projection
loadIdentity
perspective 45 radio 0.1 100
matrixMode $= Modelview 0
where radio = fromIntegral w / fromIntegral h | 320 | resizeGLScene w h
= do setVideoMode w h 0 [OpenGL,Resizeable]
viewport $= (Position 0 0, Size (fromIntegral w) (fromIntegral h))
matrixMode $= Projection
loadIdentity
perspective 45 radio 0.1 100
matrixMode $= Modelview 0
where radio = fromIntegral w / fromIntegral h | 320 | false | false | 0 | 11 | 93 | 114 | 52 | 62 | null | null |
demhydraz/ligand | src/Syntax/Lexer.hs | mit | colon = T.colon lexer | 21 | colon = T.colon lexer | 21 | colon = T.colon lexer | 21 | false | false | 1 | 6 | 3 | 14 | 5 | 9 | null | null |
benb/MetAl | src/Phylo/Alignment/DistSet.hs | gpl-3.0 | labDist :: (Ord a,SiteLabel a) => ([[(a,Int)]] -> [[[((a,Int),(a,Int))]]]) -> (Set.Set ((a,Int),(a,Int))-> Set.Set ((a,Int),(a,Int)) -> (Int,Int)) -> (ListAlignment -> [[(a)]]) -> ListAlignment -> ListAlignment -> (Int,Int)
labDist pairFunc distFunc numF aln1 aln2 = distFunc set1 set2 where
setLabel :: [[a]] -> Int -> [[(a,Int)]]
setLabel [] i = []
setLabel (x:xs) i = (map (\f -> (f,i)) x) : (setLabel xs (i+1))
set1 = toSet $ pairFunc (setLabel (numF aln1) 0)
set2 = toSet $ pairFunc (setLabel (numF aln2) 0)
toSet (x:xs) = (toSet2 x) `Set.union` (toSet xs)
toSet [] = Set.fromList []
toSet1 (x:xs) = (toSet2 x) `Set.union` (toSet1 xs)
toSet1 [] = Set.fromList []
toSet2 (x:xs) = (Set.fromList x) `Set.union` (toSet2 xs)
toSet2 [] = Set.fromList [] | 1,050 | labDist :: (Ord a,SiteLabel a) => ([[(a,Int)]] -> [[[((a,Int),(a,Int))]]]) -> (Set.Set ((a,Int),(a,Int))-> Set.Set ((a,Int),(a,Int)) -> (Int,Int)) -> (ListAlignment -> [[(a)]]) -> ListAlignment -> ListAlignment -> (Int,Int)
labDist pairFunc distFunc numF aln1 aln2 = distFunc set1 set2 where
setLabel :: [[a]] -> Int -> [[(a,Int)]]
setLabel [] i = []
setLabel (x:xs) i = (map (\f -> (f,i)) x) : (setLabel xs (i+1))
set1 = toSet $ pairFunc (setLabel (numF aln1) 0)
set2 = toSet $ pairFunc (setLabel (numF aln2) 0)
toSet (x:xs) = (toSet2 x) `Set.union` (toSet xs)
toSet [] = Set.fromList []
toSet1 (x:xs) = (toSet2 x) `Set.union` (toSet1 xs)
toSet1 [] = Set.fromList []
toSet2 (x:xs) = (Set.fromList x) `Set.union` (toSet2 xs)
toSet2 [] = Set.fromList [] | 1,050 | labDist pairFunc distFunc numF aln1 aln2 = distFunc set1 set2 where
setLabel :: [[a]] -> Int -> [[(a,Int)]]
setLabel [] i = []
setLabel (x:xs) i = (map (\f -> (f,i)) x) : (setLabel xs (i+1))
set1 = toSet $ pairFunc (setLabel (numF aln1) 0)
set2 = toSet $ pairFunc (setLabel (numF aln2) 0)
toSet (x:xs) = (toSet2 x) `Set.union` (toSet xs)
toSet [] = Set.fromList []
toSet1 (x:xs) = (toSet2 x) `Set.union` (toSet1 xs)
toSet1 [] = Set.fromList []
toSet2 (x:xs) = (Set.fromList x) `Set.union` (toSet2 xs)
toSet2 [] = Set.fromList [] | 826 | false | true | 0 | 13 | 416 | 508 | 280 | 228 | null | null |
rueshyna/gogol | gogol-container/gen/Network/Google/Resource/Container/Projects/Zones/GetServerConfig.hs | mpl-2.0 | -- | The name of the Google Compute Engine
-- [zone](\/compute\/docs\/zones#available) to return operations for.
pzgscZone :: Lens' ProjectsZonesGetServerConfig Text
pzgscZone
= lens _pzgscZone (\ s a -> s{_pzgscZone = a}) | 224 | pzgscZone :: Lens' ProjectsZonesGetServerConfig Text
pzgscZone
= lens _pzgscZone (\ s a -> s{_pzgscZone = a}) | 111 | pzgscZone
= lens _pzgscZone (\ s a -> s{_pzgscZone = a}) | 58 | true | true | 0 | 9 | 32 | 43 | 23 | 20 | null | null |
reinvdwoerd/lisp | src/Primitives.hs | mit | purePrimitives =
wrapPrimitives False Pure
[("+", numericBinop (+)),
("-", numericBinop (-)),
("*", numericBinop (*)),
("/", numericBinop div),
("mod", numericBinop mod),
("=", equals),
("and", boolBinop (&&)),
("or", boolBinop (||)),
("first", first),
("rest", rest),
("cons", cons),
("list", list),
("reverse", reverseList),
("string-append", stringAppend)] | 416 | purePrimitives =
wrapPrimitives False Pure
[("+", numericBinop (+)),
("-", numericBinop (-)),
("*", numericBinop (*)),
("/", numericBinop div),
("mod", numericBinop mod),
("=", equals),
("and", boolBinop (&&)),
("or", boolBinop (||)),
("first", first),
("rest", rest),
("cons", cons),
("list", list),
("reverse", reverseList),
("string-append", stringAppend)] | 416 | purePrimitives =
wrapPrimitives False Pure
[("+", numericBinop (+)),
("-", numericBinop (-)),
("*", numericBinop (*)),
("/", numericBinop div),
("mod", numericBinop mod),
("=", equals),
("and", boolBinop (&&)),
("or", boolBinop (||)),
("first", first),
("rest", rest),
("cons", cons),
("list", list),
("reverse", reverseList),
("string-append", stringAppend)] | 416 | false | false | 1 | 8 | 96 | 176 | 107 | 69 | null | null |
koodilehto/kryptoradio | encoder/Resources.hs | agpl-3.0 | showText :: Text -> ShowS
showText = showString . unpack | 56 | showText :: Text -> ShowS
showText = showString . unpack | 56 | showText = showString . unpack | 30 | false | true | 0 | 5 | 9 | 19 | 10 | 9 | null | null |
simhu/cubical | Main.hs | mit | lexer :: String -> [Token]
lexer = resolveLayout True . myLexer | 63 | lexer :: String -> [Token]
lexer = resolveLayout True . myLexer | 63 | lexer = resolveLayout True . myLexer | 36 | false | true | 0 | 6 | 10 | 25 | 13 | 12 | null | null |
osa1/sequent-core | src/Language/SequentCore/Simpl/Env.hs | bsd-3-clause | termIsHNF _ _ = False | 30 | termIsHNF _ _ = False | 30 | termIsHNF _ _ = False | 30 | false | false | 0 | 5 | 13 | 11 | 5 | 6 | null | null |
keithodulaigh/Hets | OWL2/XML.hs | gpl-2.0 | getEntityType :: String -> EntityType
getEntityType ty = fromMaybe (err $ "no entity type " ++ ty)
. lookup ty $ map (\ e -> (show e, e)) entityTypes | 151 | getEntityType :: String -> EntityType
getEntityType ty = fromMaybe (err $ "no entity type " ++ ty)
. lookup ty $ map (\ e -> (show e, e)) entityTypes | 151 | getEntityType ty = fromMaybe (err $ "no entity type " ++ ty)
. lookup ty $ map (\ e -> (show e, e)) entityTypes | 113 | false | true | 3 | 9 | 30 | 70 | 34 | 36 | null | null |
lamdu/lamdu | src/Lamdu/Expr/IRef.hs | gpl-3.0 | readTagData :: Monad m => T.Tag -> T m Tag
readTagData tag =
Transaction.irefExists i
>>=
\case
False -> pure (Tag 0 NoSymbol mempty)
True -> Transaction.readIRef i
where
i = tagI tag | 215 | readTagData :: Monad m => T.Tag -> T m Tag
readTagData tag =
Transaction.irefExists i
>>=
\case
False -> pure (Tag 0 NoSymbol mempty)
True -> Transaction.readIRef i
where
i = tagI tag | 215 | readTagData tag =
Transaction.irefExists i
>>=
\case
False -> pure (Tag 0 NoSymbol mempty)
True -> Transaction.readIRef i
where
i = tagI tag | 172 | false | true | 3 | 10 | 64 | 94 | 41 | 53 | null | null |
jbracker/supermonad-plugin | examples/monad/hmtc/original/CodeGenerator.hs | bsd-3-clause | -- Note that there is a check in place to ensure this is a total function.
-- See "isMTchr" in "Type".
tamRepMTChr :: MTChr -> MTInt
tamRepMTChr c = fromIntegral (fromEnum c) | 175 | tamRepMTChr :: MTChr -> MTInt
tamRepMTChr c = fromIntegral (fromEnum c) | 71 | tamRepMTChr c = fromIntegral (fromEnum c) | 41 | true | true | 0 | 7 | 32 | 29 | 15 | 14 | null | null |
fibsifan/pandoc | src/Text/Pandoc/Readers/MediaWiki.hs | gpl-2.0 | isBlockTag' tag = isBlockTag tag | 32 | isBlockTag' tag = isBlockTag tag | 32 | isBlockTag' tag = isBlockTag tag | 32 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
JohnLato/scryptic | src/Scryptic/Scrypt.hs | gpl-3.0 | mkConfig (TitleOpt idnt) = bcTitle._Wrapped._Just.from ident .~ idnt $ mempty | 77 | mkConfig (TitleOpt idnt) = bcTitle._Wrapped._Just.from ident .~ idnt $ mempty | 77 | mkConfig (TitleOpt idnt) = bcTitle._Wrapped._Just.from ident .~ idnt $ mempty | 77 | false | false | 0 | 10 | 9 | 33 | 15 | 18 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 21402 = 5772 | 32 | getValueFromProduct 21402 = 5772 | 32 | getValueFromProduct 21402 = 5772 | 32 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
jgeskens/oemfoe-haskell | Evaluator.hs | mit | evaluator ex = ev [] $ map makeToken $ tokenize ex "" | 53 | evaluator ex = ev [] $ map makeToken $ tokenize ex "" | 53 | evaluator ex = ev [] $ map makeToken $ tokenize ex "" | 53 | false | false | 0 | 8 | 11 | 30 | 13 | 17 | null | null |
carlostome/wlp-engine | src/Expr.hs | bsd-3-clause | atb :: Name -> Expr INT -> Expr BOOL -> Asg
atb n ix = Asg (TArr (n ::: boolarr) ix) | 88 | atb :: Name -> Expr INT -> Expr BOOL -> Asg
atb n ix = Asg (TArr (n ::: boolarr) ix) | 88 | atb n ix = Asg (TArr (n ::: boolarr) ix) | 44 | false | true | 0 | 9 | 24 | 57 | 26 | 31 | null | null |
edsko/cabal | Cabal/src/Distribution/Simple/PackageIndex.hs | bsd-3-clause | -- | Tries to take the transitive closure of the package dependencies.
--
-- If the transitive closure is complete then it returns that subset of the
-- index. Otherwise it returns the broken packages as in 'brokenPackages'.
--
-- * Note that if the result is @Right []@ it is because at least one of
-- the original given 'PackageId's do not occur in the index.
--
dependencyClosure :: PackageInstalled a => PackageIndex a
-> [UnitId]
-> Either (PackageIndex a)
[(a, [UnitId])]
dependencyClosure index pkgids0 = case closure mempty [] pkgids0 of
(completed, []) -> Left completed
(completed, _) -> Right (brokenPackages completed)
where
closure completed failed [] = (completed, failed)
closure completed failed (pkgid:pkgids) = case lookupUnitId index pkgid of
Nothing -> closure completed (pkgid:failed) pkgids
Just pkg -> case lookupUnitId completed (installedUnitId pkg) of
Just _ -> closure completed failed pkgids
Nothing -> closure completed' failed pkgids'
where completed' = insert pkg completed
pkgids' = installedDepends pkg ++ pkgids
-- | Takes the transitive closure of the packages reverse dependencies.
--
-- * The given 'PackageId's must be in the index.
-- | 1,327 | dependencyClosure :: PackageInstalled a => PackageIndex a
-> [UnitId]
-> Either (PackageIndex a)
[(a, [UnitId])]
dependencyClosure index pkgids0 = case closure mempty [] pkgids0 of
(completed, []) -> Left completed
(completed, _) -> Right (brokenPackages completed)
where
closure completed failed [] = (completed, failed)
closure completed failed (pkgid:pkgids) = case lookupUnitId index pkgid of
Nothing -> closure completed (pkgid:failed) pkgids
Just pkg -> case lookupUnitId completed (installedUnitId pkg) of
Just _ -> closure completed failed pkgids
Nothing -> closure completed' failed pkgids'
where completed' = insert pkg completed
pkgids' = installedDepends pkg ++ pkgids
-- | Takes the transitive closure of the packages reverse dependencies.
--
-- * The given 'PackageId's must be in the index.
-- | 961 | dependencyClosure index pkgids0 = case closure mempty [] pkgids0 of
(completed, []) -> Left completed
(completed, _) -> Right (brokenPackages completed)
where
closure completed failed [] = (completed, failed)
closure completed failed (pkgid:pkgids) = case lookupUnitId index pkgid of
Nothing -> closure completed (pkgid:failed) pkgids
Just pkg -> case lookupUnitId completed (installedUnitId pkg) of
Just _ -> closure completed failed pkgids
Nothing -> closure completed' failed pkgids'
where completed' = insert pkg completed
pkgids' = installedDepends pkg ++ pkgids
-- | Takes the transitive closure of the packages reverse dependencies.
--
-- * The given 'PackageId's must be in the index.
-- | 784 | true | true | 0 | 14 | 337 | 271 | 141 | 130 | null | null |
christiaanb/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | tcSplitAppTy_maybe ty = repSplitAppTy_maybe ty | 46 | tcSplitAppTy_maybe ty = repSplitAppTy_maybe ty | 46 | tcSplitAppTy_maybe ty = repSplitAppTy_maybe ty | 46 | false | false | 1 | 5 | 4 | 15 | 5 | 10 | null | null |
ihc/futhark | src/Futhark/Optimise/InPlaceLowering/SubstituteIndices.hs | isc | substituteIndicesInSubExp :: MonadBinder m =>
IndexSubstitutions (LetAttr (Lore m))
-> SubExp
-> m SubExp
substituteIndicesInSubExp substs (Var v) = Var <$> substituteIndicesInVar substs v | 269 | substituteIndicesInSubExp :: MonadBinder m =>
IndexSubstitutions (LetAttr (Lore m))
-> SubExp
-> m SubExp
substituteIndicesInSubExp substs (Var v) = Var <$> substituteIndicesInVar substs v | 269 | substituteIndicesInSubExp substs (Var v) = Var <$> substituteIndicesInVar substs v | 82 | false | true | 0 | 11 | 104 | 64 | 30 | 34 | null | null |
bitemyapp/ghc | compiler/hsSyn/HsTypes.hs | bsd-3-clause | hsTyVarName (KindedTyVar n _) = n | 33 | hsTyVarName (KindedTyVar n _) = n | 33 | hsTyVarName (KindedTyVar n _) = n | 33 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
lukexi/rumpus | src/Rumpus/Systems/KeyPads.hs | bsd-3-clause | keyCapHeight _ = 1 | 37 | keyCapHeight _ = 1 | 37 | keyCapHeight _ = 1 | 37 | false | false | 0 | 5 | 22 | 9 | 4 | 5 | null | null |
diminishedprime/.org | programmey_stuff/write_yourself_a_scheme/ch_08/wyas/app/Eval.hs | mit | eval _ val@(Ratio _ ) = return val | 34 | eval _ val@(Ratio _ ) = return val | 34 | eval _ val@(Ratio _ ) = return val | 34 | false | false | 0 | 8 | 7 | 27 | 12 | 15 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/book/2011-Learn_You_a_Haskell/Learn_You_a_Haskell.hs | unlicense | flavia = Peep {firstPeep = "Flavia", lastPeep = "Cervino-Wood", agePeep = 53} | 77 | flavia = Peep {firstPeep = "Flavia", lastPeep = "Cervino-Wood", agePeep = 53} | 77 | flavia = Peep {firstPeep = "Flavia", lastPeep = "Cervino-Wood", agePeep = 53} | 77 | false | false | 1 | 7 | 11 | 33 | 17 | 16 | null | null |
mrkkrp/stack | src/Path/Find.hs | bsd-3-clause | findFiles :: Path Abs Dir -- ^ Root directory to begin with.
-> (Path Abs File -> Bool) -- ^ Predicate to match files.
-> (Path Abs Dir -> Bool) -- ^ Predicate for which directories to traverse.
-> IO [Path Abs File] -- ^ List of matching files.
findFiles dir p traversep =
do (dirs,files) <- catchJust (\ e -> if isPermissionError e
then Just ()
else Nothing)
(listDir dir)
(\ _ -> return ([], []))
filteredFiles <- evaluate $ force (filter p files)
filteredDirs <- filterM (fmap not . isSymLink) dirs
subResults <-
forM filteredDirs
(\entry ->
if traversep entry
then findFiles entry p traversep
else return [])
return (concat (filteredFiles : subResults)) | 941 | findFiles :: Path Abs Dir -- ^ Root directory to begin with.
-> (Path Abs File -> Bool) -- ^ Predicate to match files.
-> (Path Abs Dir -> Bool) -- ^ Predicate for which directories to traverse.
-> IO [Path Abs File]
findFiles dir p traversep =
do (dirs,files) <- catchJust (\ e -> if isPermissionError e
then Just ()
else Nothing)
(listDir dir)
(\ _ -> return ([], []))
filteredFiles <- evaluate $ force (filter p files)
filteredDirs <- filterM (fmap not . isSymLink) dirs
subResults <-
forM filteredDirs
(\entry ->
if traversep entry
then findFiles entry p traversep
else return [])
return (concat (filteredFiles : subResults)) | 907 | findFiles dir p traversep =
do (dirs,files) <- catchJust (\ e -> if isPermissionError e
then Just ()
else Nothing)
(listDir dir)
(\ _ -> return ([], []))
filteredFiles <- evaluate $ force (filter p files)
filteredDirs <- filterM (fmap not . isSymLink) dirs
subResults <-
forM filteredDirs
(\entry ->
if traversep entry
then findFiles entry p traversep
else return [])
return (concat (filteredFiles : subResults)) | 648 | true | true | 0 | 13 | 397 | 251 | 126 | 125 | null | null |
mainland/dph | dph-examples/lib/System/Console/ParseArgs.hs | bsd-3-clause | gotArg :: (Ord a) =>
Args a -- ^Parsed arguments.
-> a -- ^Index of argument to be checked for.
-> Bool -- ^True if the arg was present.
gotArg (Args { args = ArgRecord am }) k =
case Map.lookup k am of
Just _ -> True
Nothing -> False
-- |Type of values that can be parsed by the argument parser. | 353 | gotArg :: (Ord a) =>
Args a -- ^Parsed arguments.
-> a -- ^Index of argument to be checked for.
-> Bool
gotArg (Args { args = ArgRecord am }) k =
case Map.lookup k am of
Just _ -> True
Nothing -> False
-- |Type of values that can be parsed by the argument parser. | 315 | gotArg (Args { args = ArgRecord am }) k =
case Map.lookup k am of
Just _ -> True
Nothing -> False
-- |Type of values that can be parsed by the argument parser. | 176 | true | true | 3 | 9 | 119 | 85 | 42 | 43 | null | null |
up9cloud/line-api-server | lib/hs/src/Thrift/Protocol/Compact.hs | mit | parseCompactValue T_I32 = TI32 <$> parseVarint zigZagToI32 | 58 | parseCompactValue T_I32 = TI32 <$> parseVarint zigZagToI32 | 58 | parseCompactValue T_I32 = TI32 <$> parseVarint zigZagToI32 | 58 | false | false | 0 | 6 | 6 | 16 | 7 | 9 | null | null |
MichielDerhaeg/stack | src/Stack/Image.hs | bsd-3-clause | filterImages :: [String] -> [ImageDockerOpts] -> [ImageDockerOpts]
filterImages [] = id | 87 | filterImages :: [String] -> [ImageDockerOpts] -> [ImageDockerOpts]
filterImages [] = id | 87 | filterImages [] = id | 20 | false | true | 0 | 7 | 10 | 33 | 18 | 15 | null | null |
fmapfmapfmap/amazonka | amazonka-redshift/gen/Network/AWS/Redshift/CreateTags.hs | mpl-2.0 | -- | The Amazon Resource Name (ARN) to which you want to add the tag or tags.
-- For example, 'arn:aws:redshift:us-east-1:123456789:cluster:t1'.
ctResourceName :: Lens' CreateTags Text
ctResourceName = lens _ctResourceName (\ s a -> s{_ctResourceName = a}) | 256 | ctResourceName :: Lens' CreateTags Text
ctResourceName = lens _ctResourceName (\ s a -> s{_ctResourceName = a}) | 111 | ctResourceName = lens _ctResourceName (\ s a -> s{_ctResourceName = a}) | 71 | true | true | 1 | 9 | 36 | 45 | 23 | 22 | null | null |
goldfirere/singletons | singletons-base/tests/compile-and-dump/Singletons/T124.hs | bsd-3-clause | bar :: SBool b -> STuple0 (Foo b)
bar b = $(sCases ''Bool [| b |] [| STuple0 |]) | 80 | bar :: SBool b -> STuple0 (Foo b)
bar b = $(sCases ''Bool [| b |] [| STuple0 |]) | 80 | bar b = $(sCases ''Bool [| b |] [| STuple0 |]) | 46 | false | true | 0 | 9 | 18 | 53 | 27 | 26 | null | null |
vladimir-ipatov/ganeti | test/hs/Test/Ganeti/TestCommon.hs | gpl-2.0 | genSample :: Gen a -> IO a
genSample gen = do
values <- sample' gen
case values of
[] -> error "sample' returned an empty list of values??"
x:_ -> return x
-- | Function for testing whether a file is parsed correctly. | 230 | genSample :: Gen a -> IO a
genSample gen = do
values <- sample' gen
case values of
[] -> error "sample' returned an empty list of values??"
x:_ -> return x
-- | Function for testing whether a file is parsed correctly. | 230 | genSample gen = do
values <- sample' gen
case values of
[] -> error "sample' returned an empty list of values??"
x:_ -> return x
-- | Function for testing whether a file is parsed correctly. | 203 | false | true | 0 | 11 | 55 | 71 | 31 | 40 | null | null |
dmjio/aeson | src/Data/Aeson/TH.hs | bsd-3-clause | jsonClassName (JSONClass To Arity2) = ''ToJSON2 | 49 | jsonClassName (JSONClass To Arity2) = ''ToJSON2 | 49 | jsonClassName (JSONClass To Arity2) = ''ToJSON2 | 49 | false | false | 0 | 7 | 7 | 19 | 9 | 10 | null | null |
shlevy/ghc | testsuite/tests/pmcheck/complete_sigs/completesig08.hs | bsd-3-clause | m2 :: T -> S -> ()
m2 A D = () | 30 | m2 :: T -> S -> ()
m2 A D = () | 30 | m2 A D = () | 11 | false | true | 0 | 7 | 11 | 33 | 15 | 18 | null | null |
matshch/OTP | src/Data/OTP.hs | mit | totpCounterRange :: (Word8, Word8)
-> UTCTime
-> Word64
-> [Word64]
totpCounterRange rng time period =
counterRange rng $ totpCounter time period | 200 | totpCounterRange :: (Word8, Word8)
-> UTCTime
-> Word64
-> [Word64]
totpCounterRange rng time period =
counterRange rng $ totpCounter time period | 200 | totpCounterRange rng time period =
counterRange rng $ totpCounter time period | 81 | false | true | 0 | 8 | 75 | 51 | 26 | 25 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/utils/Outputable.hs | bsd-3-clause | alwaysQualify = QueryQualify alwaysQualifyNames
alwaysQualifyModules
alwaysQualifyPackages | 148 | alwaysQualify = QueryQualify alwaysQualifyNames
alwaysQualifyModules
alwaysQualifyPackages | 148 | alwaysQualify = QueryQualify alwaysQualifyNames
alwaysQualifyModules
alwaysQualifyPackages | 148 | false | false | 0 | 5 | 63 | 13 | 6 | 7 | null | null |
keenbug/iexpr | Backends/Haskell/Syntax.hs | gpl-2.0 | prettyDefinition (HSFuncDef declarations)
= vcat $ map prettyDeclaration declarations | 87 | prettyDefinition (HSFuncDef declarations)
= vcat $ map prettyDeclaration declarations | 87 | prettyDefinition (HSFuncDef declarations)
= vcat $ map prettyDeclaration declarations | 87 | false | false | 2 | 6 | 10 | 27 | 11 | 16 | null | null |
glutamate/matio | test/TestUniversal.hs | bsd-3-clause | toMatVal (MatData MatInt64 i) = VInt64 i | 56 | toMatVal (MatData MatInt64 i) = VInt64 i | 56 | toMatVal (MatData MatInt64 i) = VInt64 i | 56 | false | false | 0 | 6 | 22 | 21 | 9 | 12 | null | null |
jberryman/simple-actors | Benchmark.hs | bsd-3-clause | -- ACTORS
testActors :: (Int,Int) -> IO Int
testActors (x,y) = do
traceEventIO "creating friendlyList"
fl <- deepEvaluate $ friendlyList x
traceEventIO "inserting numbers into tree"
t <- spawn nil
mapM_ (insert t) fl
traceEventIO "generate random values"
--g <- getStdGen
let g = mkStdGen seed
is <- deepEvaluate (take y $ randomRs (1, x*2) g :: [Int])
traceEventIO "query random values and calculate payload"
results <- getChanContents =<< streamQueries t is
let payload = length $ filter snd $ take y results
return payload
-- create a list 1..n, ordered such that we get a mostly-balanced tree when
-- inserted sequentially: | 690 | testActors :: (Int,Int) -> IO Int
testActors (x,y) = do
traceEventIO "creating friendlyList"
fl <- deepEvaluate $ friendlyList x
traceEventIO "inserting numbers into tree"
t <- spawn nil
mapM_ (insert t) fl
traceEventIO "generate random values"
--g <- getStdGen
let g = mkStdGen seed
is <- deepEvaluate (take y $ randomRs (1, x*2) g :: [Int])
traceEventIO "query random values and calculate payload"
results <- getChanContents =<< streamQueries t is
let payload = length $ filter snd $ take y results
return payload
-- create a list 1..n, ordered such that we get a mostly-balanced tree when
-- inserted sequentially: | 680 | testActors (x,y) = do
traceEventIO "creating friendlyList"
fl <- deepEvaluate $ friendlyList x
traceEventIO "inserting numbers into tree"
t <- spawn nil
mapM_ (insert t) fl
traceEventIO "generate random values"
--g <- getStdGen
let g = mkStdGen seed
is <- deepEvaluate (take y $ randomRs (1, x*2) g :: [Int])
traceEventIO "query random values and calculate payload"
results <- getChanContents =<< streamQueries t is
let payload = length $ filter snd $ take y results
return payload
-- create a list 1..n, ordered such that we get a mostly-balanced tree when
-- inserted sequentially: | 646 | true | true | 0 | 13 | 164 | 199 | 92 | 107 | null | null |
chrisbanks/cpiwb | CPi/Parser.hs | gpl-3.0 | pTau :: Parser Prefix
pTau = do reserved "tau";
r <- angles double;
return (Tau r) | 102 | pTau :: Parser Prefix
pTau = do reserved "tau";
r <- angles double;
return (Tau r) | 102 | pTau = do reserved "tau";
r <- angles double;
return (Tau r) | 80 | false | true | 0 | 10 | 35 | 50 | 21 | 29 | null | null |
nmk/Spock | src/Web/Spock/Safe.hs | bsd-3-clause | injectHook :: LiftHooked ctx m -> (forall a. ActionCtxT ctx' m a -> ActionCtxT ctx m a) -> LiftHooked ctx' m
injectHook (LiftHooked baseHook) nextHook =
LiftHooked $ baseHook . nextHook | 189 | injectHook :: LiftHooked ctx m -> (forall a. ActionCtxT ctx' m a -> ActionCtxT ctx m a) -> LiftHooked ctx' m
injectHook (LiftHooked baseHook) nextHook =
LiftHooked $ baseHook . nextHook | 189 | injectHook (LiftHooked baseHook) nextHook =
LiftHooked $ baseHook . nextHook | 80 | false | true | 0 | 10 | 34 | 74 | 36 | 38 | null | null |
mrmonday/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | ibc i (IBCClass n) f
= case lookupCtxtExact n (idris_classes i) of
Just v -> return f { ibc_classes = (n,v): ibc_classes f }
_ -> ifail "IBC write failed" | 225 | ibc i (IBCClass n) f
= case lookupCtxtExact n (idris_classes i) of
Just v -> return f { ibc_classes = (n,v): ibc_classes f }
_ -> ifail "IBC write failed" | 225 | ibc i (IBCClass n) f
= case lookupCtxtExact n (idris_classes i) of
Just v -> return f { ibc_classes = (n,v): ibc_classes f }
_ -> ifail "IBC write failed" | 225 | false | false | 1 | 12 | 100 | 81 | 37 | 44 | null | null |
rleshchinskiy/vector | Data/Vector/Generic.hs | bsd-3-clause | unstablePartition_stream f s = s `seq` runST (
do
(mv1,mv2) <- M.unstablePartitionBundle f s
v1 <- unsafeFreeze mv1
v2 <- unsafeFreeze mv2
return (v1,v2)) | 172 | unstablePartition_stream f s = s `seq` runST (
do
(mv1,mv2) <- M.unstablePartitionBundle f s
v1 <- unsafeFreeze mv1
v2 <- unsafeFreeze mv2
return (v1,v2)) | 172 | unstablePartition_stream f s = s `seq` runST (
do
(mv1,mv2) <- M.unstablePartitionBundle f s
v1 <- unsafeFreeze mv1
v2 <- unsafeFreeze mv2
return (v1,v2)) | 172 | false | false | 0 | 12 | 41 | 75 | 36 | 39 | null | null |
isomorphism/hackage2 | MirrorClient.hs | bsd-3-clause | helpDescrStr :: String
helpDescrStr = unlines
[ "The hackage-mirror client copies packages from one hackage server to another."
, "By default it copies over all packages that exist on the source but not on"
, "the destination server. You can also select just specific packages to mirror."
, "It is also possible to run the mirror in a continuous mode, giving you"
, "nearly-live mirroring.\n"
] | 406 | helpDescrStr :: String
helpDescrStr = unlines
[ "The hackage-mirror client copies packages from one hackage server to another."
, "By default it copies over all packages that exist on the source but not on"
, "the destination server. You can also select just specific packages to mirror."
, "It is also possible to run the mirror in a continuous mode, giving you"
, "nearly-live mirroring.\n"
] | 406 | helpDescrStr = unlines
[ "The hackage-mirror client copies packages from one hackage server to another."
, "By default it copies over all packages that exist on the source but not on"
, "the destination server. You can also select just specific packages to mirror."
, "It is also possible to run the mirror in a continuous mode, giving you"
, "nearly-live mirroring.\n"
] | 383 | false | true | 0 | 5 | 77 | 29 | 17 | 12 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.