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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
siddhanathan/ghc | testsuite/tests/programs/joao-circular/Funcs_Lexer.hs | bsd-3-clause | lexer (';':cs) = Tsemicolon : lexer cs | 39 | lexer (';':cs) = Tsemicolon : lexer cs | 39 | lexer (';':cs) = Tsemicolon : lexer cs | 39 | false | false | 2 | 6 | 7 | 26 | 11 | 15 | null | null |
themoritz/cabal | cabal-testsuite/PackageTests/OrderFlags/setup.test.hs | bsd-3-clause | -- Test that setup properly orders GHC flags passed to GHC (when
-- there are multiple ghc-options fields.)
main = setupAndCabalTest $ setup_build [] | 149 | main = setupAndCabalTest $ setup_build [] | 41 | main = setupAndCabalTest $ setup_build [] | 41 | true | false | 1 | 7 | 23 | 20 | 9 | 11 | null | null |
joelburget/haste-compiler | libraries/haste-lib/src/Haste/DOM/Core.hs | bsd-3-clause | -- | Get the sibling before the given one, if any.
getChildBefore :: (IsElem e, MonadIO m) => e -> m (Maybe Elem)
getChildBefore e = liftIO $ fromPtr `fmap` jsGetChildBefore (elemOf e) | 184 | getChildBefore :: (IsElem e, MonadIO m) => e -> m (Maybe Elem)
getChildBefore e = liftIO $ fromPtr `fmap` jsGetChildBefore (elemOf e) | 133 | getChildBefore e = liftIO $ fromPtr `fmap` jsGetChildBefore (elemOf e) | 70 | true | true | 0 | 9 | 32 | 62 | 32 | 30 | null | null |
Shimmen/Sokobhask | Sokobhask.hs | mit | emptyLevel :: Level
emptyLevel = Level {
lvlSize = (0, 0)
, lvlPlayer = (0, 0)
, lvlWalls = []
, lvlCrates = []
, lvlStorage = []
} | 140 | emptyLevel :: Level
emptyLevel = Level {
lvlSize = (0, 0)
, lvlPlayer = (0, 0)
, lvlWalls = []
, lvlCrates = []
, lvlStorage = []
} | 140 | emptyLevel = Level {
lvlSize = (0, 0)
, lvlPlayer = (0, 0)
, lvlWalls = []
, lvlCrates = []
, lvlStorage = []
} | 120 | false | true | 0 | 7 | 37 | 61 | 38 | 23 | null | null |
sdiehl/ghc | compiler/basicTypes/IdInfo.hs | bsd-3-clause | -- Setters
setRuleInfo :: IdInfo -> RuleInfo -> IdInfo
setRuleInfo info sp = sp `seq` info { ruleInfo = sp } | 115 | setRuleInfo :: IdInfo -> RuleInfo -> IdInfo
setRuleInfo info sp = sp `seq` info { ruleInfo = sp } | 103 | setRuleInfo info sp = sp `seq` info { ruleInfo = sp } | 59 | true | true | 0 | 7 | 27 | 39 | 22 | 17 | null | null |
swoertz/pia | src/Parser/Polynomial.hs | gpl-3.0 | -- | 'row' parses positive/negative integer and floating point numbers separated by @','@ (commas) and surrounded by brackets
-- and returns a list of 'Double' values
row :: Parser [Double]
row = do
spaces
_ <- char '['
spaces
v <- signedNumber `sepBy` (spaces >> char ',' >> spaces)
spaces
_ <- char ']'
spaces
return v
-- | 'signedNumber' parses a (un)signed integer or floating-point number and returns a it as 'Double' | 457 | row :: Parser [Double]
row = do
spaces
_ <- char '['
spaces
v <- signedNumber `sepBy` (spaces >> char ',' >> spaces)
spaces
_ <- char ']'
spaces
return v
-- | 'signedNumber' parses a (un)signed integer or floating-point number and returns a it as 'Double' | 290 | row = do
spaces
_ <- char '['
spaces
v <- signedNumber `sepBy` (spaces >> char ',' >> spaces)
spaces
_ <- char ']'
spaces
return v
-- | 'signedNumber' parses a (un)signed integer or floating-point number and returns a it as 'Double' | 267 | true | true | 0 | 13 | 107 | 91 | 41 | 50 | null | null |
jonsterling/Luitzen | src/Environment.hs | bsd-3-clause | err :: (Disp a, MonadError Err m, MonadReader Env m) => a -> m b
err d = do
loc <- getSourceLocation
throwError $ Err loc (disp d)
-- | Print a warning | 156 | err :: (Disp a, MonadError Err m, MonadReader Env m) => a -> m b
err d = do
loc <- getSourceLocation
throwError $ Err loc (disp d)
-- | Print a warning | 156 | err d = do
loc <- getSourceLocation
throwError $ Err loc (disp d)
-- | Print a warning | 91 | false | true | 0 | 11 | 37 | 77 | 36 | 41 | null | null |
propella/prolog | test.hs | mit | unificationTest = test [
"apply1" ~: applyTerm [(w"X", w"Y"), (w"Y", w"Z")] (w"X") ~=? (w"Z"),
"apply2" ~: applyTerm [(w"X",Var "X" 1)] (Var "X" 1) ~=? (Var "X" 1),
"list" ~: unifyList [w"X",w"Y",w"Y"] [w"Z",w"Z",w"a"] ~=?
Just [(w"X",w"Z"), (w"Y",w"Z"), (w"Z",w"a")]
] | 350 | unificationTest = test [
"apply1" ~: applyTerm [(w"X", w"Y"), (w"Y", w"Z")] (w"X") ~=? (w"Z"),
"apply2" ~: applyTerm [(w"X",Var "X" 1)] (Var "X" 1) ~=? (Var "X" 1),
"list" ~: unifyList [w"X",w"Y",w"Y"] [w"Z",w"Z",w"a"] ~=?
Just [(w"X",w"Z"), (w"Y",w"Z"), (w"Z",w"a")]
] | 350 | unificationTest = test [
"apply1" ~: applyTerm [(w"X", w"Y"), (w"Y", w"Z")] (w"X") ~=? (w"Z"),
"apply2" ~: applyTerm [(w"X",Var "X" 1)] (Var "X" 1) ~=? (Var "X" 1),
"list" ~: unifyList [w"X",w"Y",w"Y"] [w"Z",w"Z",w"a"] ~=?
Just [(w"X",w"Z"), (w"Y",w"Z"), (w"Z",w"a")]
] | 350 | false | false | 0 | 12 | 118 | 216 | 110 | 106 | null | null |
k32/QFL | tools/Lam2W.hs | unlicense | ski2iot (App a b) = ski2iot a :. ski2iot b | 42 | ski2iot (App a b) = ski2iot a :. ski2iot b | 42 | ski2iot (App a b) = ski2iot a :. ski2iot b | 42 | false | false | 0 | 7 | 9 | 27 | 12 | 15 | null | null |
vladimir-ipatov/ganeti | test/hs/Test/Ganeti/TestHelper.hs | gpl-2.0 | -- | Test case prefix without underscore.
case2Pfx :: String
case2Pfx = "case" | 78 | case2Pfx :: String
case2Pfx = "case" | 36 | case2Pfx = "case" | 17 | true | true | 0 | 6 | 12 | 19 | 8 | 11 | null | null |
facebookincubator/duckling | Duckling/Time/TR/Rules.hs | bsd-3-clause | ruleLastCycleOfTime :: Rule
ruleLastCycleOfTime = Rule
{ name = "last <cycle> of <time>"
, pattern =
[ dimension Time
, regex "son"
, dimension TimeGrain
]
, prod = \case
(Token Time td:_:Token TimeGrain grain:_) ->
tt $ cycleLastOf grain td
_ -> Nothing
} | 300 | ruleLastCycleOfTime :: Rule
ruleLastCycleOfTime = Rule
{ name = "last <cycle> of <time>"
, pattern =
[ dimension Time
, regex "son"
, dimension TimeGrain
]
, prod = \case
(Token Time td:_:Token TimeGrain grain:_) ->
tt $ cycleLastOf grain td
_ -> Nothing
} | 300 | ruleLastCycleOfTime = Rule
{ name = "last <cycle> of <time>"
, pattern =
[ dimension Time
, regex "son"
, dimension TimeGrain
]
, prod = \case
(Token Time td:_:Token TimeGrain grain:_) ->
tt $ cycleLastOf grain td
_ -> Nothing
} | 272 | false | true | 0 | 15 | 88 | 101 | 52 | 49 | null | null |
peter-fogg/pardoc | src/Text/Pandoc/Readers/Org.hs | gpl-2.0 | inlineBlockOption :: OrgParser (String, String)
inlineBlockOption = try $ (,) <$> orgArgKey <*> orgInlineParamValue | 115 | inlineBlockOption :: OrgParser (String, String)
inlineBlockOption = try $ (,) <$> orgArgKey <*> orgInlineParamValue | 115 | inlineBlockOption = try $ (,) <$> orgArgKey <*> orgInlineParamValue | 67 | false | true | 0 | 8 | 13 | 35 | 19 | 16 | null | null |
bgaster/idris-java | src/IRTS/CodegenJava.hs | bsd-3-clause | mkCaseBinding :: BlockPostprocessor -> LVar -> Int -> [Name] -> SExp -> CodeGeneration [BlockStmt]
mkCaseBinding pp var stackStart params branchExpression =
mkExp pp (toLetIn var stackStart params branchExpression)
where
toLetIn :: LVar -> Int -> [Name] -> SExp -> SExp
toLetIn var stackStart members start =
foldr
(\ pos inExp -> SLet (Loc (stackStart + pos)) (SProj var pos) inExp)
start
[0.. (length members - 1)]
-----------------------------------------------------------------------
-- Projection (retrieve the n-th field of an object) | 584 | mkCaseBinding :: BlockPostprocessor -> LVar -> Int -> [Name] -> SExp -> CodeGeneration [BlockStmt]
mkCaseBinding pp var stackStart params branchExpression =
mkExp pp (toLetIn var stackStart params branchExpression)
where
toLetIn :: LVar -> Int -> [Name] -> SExp -> SExp
toLetIn var stackStart members start =
foldr
(\ pos inExp -> SLet (Loc (stackStart + pos)) (SProj var pos) inExp)
start
[0.. (length members - 1)]
-----------------------------------------------------------------------
-- Projection (retrieve the n-th field of an object) | 584 | mkCaseBinding pp var stackStart params branchExpression =
mkExp pp (toLetIn var stackStart params branchExpression)
where
toLetIn :: LVar -> Int -> [Name] -> SExp -> SExp
toLetIn var stackStart members start =
foldr
(\ pos inExp -> SLet (Loc (stackStart + pos)) (SProj var pos) inExp)
start
[0.. (length members - 1)]
-----------------------------------------------------------------------
-- Projection (retrieve the n-th field of an object) | 485 | false | true | 0 | 12 | 118 | 171 | 88 | 83 | null | null |
vikraman/ghc | compiler/coreSyn/CoreUtils.hs | bsd-3-clause | dataConInstPat :: [FastString] -- A long enough list of FSs to use for names
-> [Unique] -- An equally long list of uniques, at least one for each binder
-> DataCon
-> [Type] -- Types to instantiate the universally quantified tyvars
-> ([TyVar], [Id]) -- Return instantiated variables
-- dataConInstPat arg_fun fss us con inst_tys returns a tuple
-- (ex_tvs, arg_ids),
--
-- ex_tvs are intended to be used as binders for existential type args
--
-- arg_ids are indended to be used as binders for value arguments,
-- and their types have been instantiated with inst_tys and ex_tys
-- The arg_ids include both evidence and
-- programmer-specified arguments (both after rep-ing)
--
-- Example.
-- The following constructor T1
--
-- data T a where
-- T1 :: forall b. Int -> b -> T(a,b)
-- ...
--
-- has representation type
-- forall a. forall a1. forall b. (a ~ (a1,b)) =>
-- Int -> b -> T a
--
-- dataConInstPat fss us T1 (a1',b') will return
--
-- ([a1'', b''], [c :: (a1', b')~(a1'', b''), x :: Int, y :: b''])
--
-- where the double-primed variables are created with the FastStrings and
-- Uniques given as fss and us
dataConInstPat fss uniqs con inst_tys
= ASSERT( univ_tvs `equalLength` inst_tys )
(ex_bndrs, arg_ids)
where
univ_tvs = dataConUnivTyVars con
ex_tvs = dataConExTyVars con
arg_tys = dataConRepArgTys con
arg_strs = dataConRepStrictness con -- 1-1 with arg_tys
n_ex = length ex_tvs
-- split the Uniques and FastStrings
(ex_uniqs, id_uniqs) = splitAt n_ex uniqs
(ex_fss, id_fss) = splitAt n_ex fss
-- Make the instantiating substitution for universals
univ_subst = zipTvSubst univ_tvs inst_tys
-- Make existential type variables, applyingn and extending the substitution
(full_subst, ex_bndrs) = mapAccumL mk_ex_var univ_subst
(zip3 ex_tvs ex_fss ex_uniqs)
mk_ex_var :: TCvSubst -> (TyVar, FastString, Unique) -> (TCvSubst, TyVar)
mk_ex_var subst (tv, fs, uniq) = (Type.extendTvSubstWithClone subst tv
new_tv
, new_tv)
where
new_tv = mkTyVar (mkSysTvName uniq fs) kind
kind = Type.substTyUnchecked subst (tyVarKind tv)
-- Make value vars, instantiating types
arg_ids = zipWith4 mk_id_var id_uniqs id_fss arg_tys arg_strs
mk_id_var uniq fs ty str
= mkLocalIdOrCoVarWithInfo name (Type.substTy full_subst ty) info
where
name = mkInternalName uniq (mkVarOccFS fs) noSrcSpan
info | isMarkedStrict str = vanillaIdInfo `setUnfoldingInfo` evaldUnfolding
| otherwise = vanillaIdInfo
-- See Note [Mark evaluated arguments]
{-
Note [Mark evaluated arguments]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When pattern matching on a constructor with strict fields, the binder
can have an 'evaldUnfolding'. Moreover, it *should* have one, so that
when loading an interface file unfolding like:
data T = MkT !Int
f x = case x of { MkT y -> let v::Int# = case y of I# n -> n+1
in ... }
we don't want Lint to complain. The 'y' is evaluated, so the
case in the RHS of the binding for 'v' is fine. But only if we
*know* that 'y' is evaluated.
c.f. add_evals in Simplify.simplAlt
************************************************************************
* *
Equality
* *
************************************************************************
-}
-- | A cheap equality test which bales out fast!
-- If it returns @True@ the arguments are definitely equal,
-- otherwise, they may or may not be equal.
--
-- See also 'exprIsBig' | 3,940 | dataConInstPat :: [FastString] -- A long enough list of FSs to use for names
-> [Unique] -- An equally long list of uniques, at least one for each binder
-> DataCon
-> [Type] -- Types to instantiate the universally quantified tyvars
-> ([TyVar], [Id])
dataConInstPat fss uniqs con inst_tys
= ASSERT( univ_tvs `equalLength` inst_tys )
(ex_bndrs, arg_ids)
where
univ_tvs = dataConUnivTyVars con
ex_tvs = dataConExTyVars con
arg_tys = dataConRepArgTys con
arg_strs = dataConRepStrictness con -- 1-1 with arg_tys
n_ex = length ex_tvs
-- split the Uniques and FastStrings
(ex_uniqs, id_uniqs) = splitAt n_ex uniqs
(ex_fss, id_fss) = splitAt n_ex fss
-- Make the instantiating substitution for universals
univ_subst = zipTvSubst univ_tvs inst_tys
-- Make existential type variables, applyingn and extending the substitution
(full_subst, ex_bndrs) = mapAccumL mk_ex_var univ_subst
(zip3 ex_tvs ex_fss ex_uniqs)
mk_ex_var :: TCvSubst -> (TyVar, FastString, Unique) -> (TCvSubst, TyVar)
mk_ex_var subst (tv, fs, uniq) = (Type.extendTvSubstWithClone subst tv
new_tv
, new_tv)
where
new_tv = mkTyVar (mkSysTvName uniq fs) kind
kind = Type.substTyUnchecked subst (tyVarKind tv)
-- Make value vars, instantiating types
arg_ids = zipWith4 mk_id_var id_uniqs id_fss arg_tys arg_strs
mk_id_var uniq fs ty str
= mkLocalIdOrCoVarWithInfo name (Type.substTy full_subst ty) info
where
name = mkInternalName uniq (mkVarOccFS fs) noSrcSpan
info | isMarkedStrict str = vanillaIdInfo `setUnfoldingInfo` evaldUnfolding
| otherwise = vanillaIdInfo
-- See Note [Mark evaluated arguments]
{-
Note [Mark evaluated arguments]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When pattern matching on a constructor with strict fields, the binder
can have an 'evaldUnfolding'. Moreover, it *should* have one, so that
when loading an interface file unfolding like:
data T = MkT !Int
f x = case x of { MkT y -> let v::Int# = case y of I# n -> n+1
in ... }
we don't want Lint to complain. The 'y' is evaluated, so the
case in the RHS of the binding for 'v' is fine. But only if we
*know* that 'y' is evaluated.
c.f. add_evals in Simplify.simplAlt
************************************************************************
* *
Equality
* *
************************************************************************
-}
-- | A cheap equality test which bales out fast!
-- If it returns @True@ the arguments are definitely equal,
-- otherwise, they may or may not be equal.
--
-- See also 'exprIsBig' | 3,033 | dataConInstPat fss uniqs con inst_tys
= ASSERT( univ_tvs `equalLength` inst_tys )
(ex_bndrs, arg_ids)
where
univ_tvs = dataConUnivTyVars con
ex_tvs = dataConExTyVars con
arg_tys = dataConRepArgTys con
arg_strs = dataConRepStrictness con -- 1-1 with arg_tys
n_ex = length ex_tvs
-- split the Uniques and FastStrings
(ex_uniqs, id_uniqs) = splitAt n_ex uniqs
(ex_fss, id_fss) = splitAt n_ex fss
-- Make the instantiating substitution for universals
univ_subst = zipTvSubst univ_tvs inst_tys
-- Make existential type variables, applyingn and extending the substitution
(full_subst, ex_bndrs) = mapAccumL mk_ex_var univ_subst
(zip3 ex_tvs ex_fss ex_uniqs)
mk_ex_var :: TCvSubst -> (TyVar, FastString, Unique) -> (TCvSubst, TyVar)
mk_ex_var subst (tv, fs, uniq) = (Type.extendTvSubstWithClone subst tv
new_tv
, new_tv)
where
new_tv = mkTyVar (mkSysTvName uniq fs) kind
kind = Type.substTyUnchecked subst (tyVarKind tv)
-- Make value vars, instantiating types
arg_ids = zipWith4 mk_id_var id_uniqs id_fss arg_tys arg_strs
mk_id_var uniq fs ty str
= mkLocalIdOrCoVarWithInfo name (Type.substTy full_subst ty) info
where
name = mkInternalName uniq (mkVarOccFS fs) noSrcSpan
info | isMarkedStrict str = vanillaIdInfo `setUnfoldingInfo` evaldUnfolding
| otherwise = vanillaIdInfo
-- See Note [Mark evaluated arguments]
{-
Note [Mark evaluated arguments]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When pattern matching on a constructor with strict fields, the binder
can have an 'evaldUnfolding'. Moreover, it *should* have one, so that
when loading an interface file unfolding like:
data T = MkT !Int
f x = case x of { MkT y -> let v::Int# = case y of I# n -> n+1
in ... }
we don't want Lint to complain. The 'y' is evaluated, so the
case in the RHS of the binding for 'v' is fine. But only if we
*know* that 'y' is evaluated.
c.f. add_evals in Simplify.simplAlt
************************************************************************
* *
Equality
* *
************************************************************************
-}
-- | A cheap equality test which bales out fast!
-- If it returns @True@ the arguments are definitely equal,
-- otherwise, they may or may not be equal.
--
-- See also 'exprIsBig' | 2,684 | true | true | 4 | 10 | 1,154 | 435 | 248 | 187 | null | null |
dysinger/amazonka | amazonka-iam/gen/Network/AWS/IAM/Types.hs | mpl-2.0 | -- | The date and time, in <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the group was created.
gCreateDate :: Lens' Group UTCTime
gCreateDate = lens _gCreateDate (\s a -> s { _gCreateDate = a }) . _Time | 222 | gCreateDate :: Lens' Group UTCTime
gCreateDate = lens _gCreateDate (\s a -> s { _gCreateDate = a }) . _Time | 107 | gCreateDate = lens _gCreateDate (\s a -> s { _gCreateDate = a }) . _Time | 72 | true | true | 0 | 9 | 36 | 51 | 25 | 26 | null | null |
alphaHeavy/shake-install | Development/Shake/Install/Rules.hs | bsd-3-clause | noTemplateHaskell
:: GetBuildType arg
=> arg
-> Bool
noTemplateHaskell = not . any (== EnableExtension TemplateHaskell) . exts where
exts = concat . fmap allExtensions . getBuildInfo
-- |
-- Dispatching function that selects between in-process
-- and cabal-install invocations to perform each build step | 312 | noTemplateHaskell
:: GetBuildType arg
=> arg
-> Bool
noTemplateHaskell = not . any (== EnableExtension TemplateHaskell) . exts where
exts = concat . fmap allExtensions . getBuildInfo
-- |
-- Dispatching function that selects between in-process
-- and cabal-install invocations to perform each build step | 312 | noTemplateHaskell = not . any (== EnableExtension TemplateHaskell) . exts where
exts = concat . fmap allExtensions . getBuildInfo
-- |
-- Dispatching function that selects between in-process
-- and cabal-install invocations to perform each build step | 253 | false | true | 0 | 9 | 53 | 68 | 33 | 35 | null | null |
ony/hledger | hledger-lib/Hledger/Data/Journal.hs | gpl-3.0 | abspat pat = if isnegativepat pat then drop (length negateprefix) pat else pat | 78 | abspat pat = if isnegativepat pat then drop (length negateprefix) pat else pat | 78 | abspat pat = if isnegativepat pat then drop (length negateprefix) pat else pat | 78 | false | false | 0 | 8 | 12 | 31 | 15 | 16 | null | null |
mkawalec/email | src/Persist/Thread.hs | gpl-3.0 | extractRelatedEmailIds :: MPT.Header -> [MPT.MessageId]
extractRelatedEmailIds = \case
MPT.References refs -> refs
MPT.InReplyTo msgId -> [msgId]
_ -> []
-- |Checks if any of related emails is in a thread | 211 | extractRelatedEmailIds :: MPT.Header -> [MPT.MessageId]
extractRelatedEmailIds = \case
MPT.References refs -> refs
MPT.InReplyTo msgId -> [msgId]
_ -> []
-- |Checks if any of related emails is in a thread | 211 | extractRelatedEmailIds = \case
MPT.References refs -> refs
MPT.InReplyTo msgId -> [msgId]
_ -> []
-- |Checks if any of related emails is in a thread | 155 | false | true | 0 | 9 | 36 | 58 | 30 | 28 | null | null |
proger/cron | test/System/CronSpec.hs | bsd-2-clause | stepMax :: (Enum a, Ord a) => a -> a -> a
stepMax mx n | n < mx = succ n
| otherwise = pred n | 109 | stepMax :: (Enum a, Ord a) => a -> a -> a
stepMax mx n | n < mx = succ n
| otherwise = pred n | 109 | stepMax mx n | n < mx = succ n
| otherwise = pred n | 67 | false | true | 0 | 8 | 42 | 64 | 30 | 34 | null | null |
spacekitteh/smcghc | libraries/base/System/IO/Error.hs | bsd-3-clause | isAlreadyExistsErrorType _ = False | 34 | isAlreadyExistsErrorType _ = False | 34 | isAlreadyExistsErrorType _ = False | 34 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
nushio3/ghc | compiler/types/Coercion.hs | bsd-3-clause | -- | Returns the type coerced if this coercion is reflexive. Guaranteed
-- to work very quickly. Sometimes a coercion can be reflexive, but not
-- obviously so. c.f. 'isReflexiveCo_maybe'
isReflCo_maybe :: Coercion -> Maybe (Type, Role)
isReflCo_maybe (Refl r ty) = Just (ty, r) | 278 | isReflCo_maybe :: Coercion -> Maybe (Type, Role)
isReflCo_maybe (Refl r ty) = Just (ty, r) | 90 | isReflCo_maybe (Refl r ty) = Just (ty, r) | 41 | true | true | 0 | 7 | 44 | 47 | 26 | 21 | null | null |
ronichoudhury/bechtrek | app/bechdel.hs | apache-2.0 | isFemale _ = False | 18 | isFemale _ = False | 18 | isFemale _ = False | 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
timtylin/scholdoc-texmath | src/Text/TeXMath/Readers/TeX.hs | gpl-2.0 | acute 's' = "ś" | 15 | acute 's' = "ś" | 15 | acute 's' = "ś" | 15 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
hguenther/fac | Interpolation.hs | gpl-3.0 | getInterpolant :: InterpolationState a -> PropL Var
getInterpolant interp = case Map.lookup (pred $ nextInterpolationNode interp) (interpolationNodes interp) of
Just (cl,int) -> if Map.null cl
then int
else error "Incomplete interpolation"
_ -> error "Interpolation hasn't completed yet." | 330 | getInterpolant :: InterpolationState a -> PropL Var
getInterpolant interp = case Map.lookup (pred $ nextInterpolationNode interp) (interpolationNodes interp) of
Just (cl,int) -> if Map.null cl
then int
else error "Incomplete interpolation"
_ -> error "Interpolation hasn't completed yet." | 330 | getInterpolant interp = case Map.lookup (pred $ nextInterpolationNode interp) (interpolationNodes interp) of
Just (cl,int) -> if Map.null cl
then int
else error "Incomplete interpolation"
_ -> error "Interpolation hasn't completed yet." | 278 | false | true | 0 | 10 | 79 | 91 | 44 | 47 | null | null |
JPMoresmau/BuildWrapper | src/Language/Haskell/BuildWrapper/GHC.hs | bsd-3-clause | -- pattern
tokenType ITminimal_prag = "EK" | 49 | tokenType ITminimal_prag = "EK" | 37 | tokenType ITminimal_prag = "EK" | 37 | true | false | 0 | 4 | 12 | 11 | 5 | 6 | null | null |
spechub/Hets | Common/AnnoParser.hs | gpl-2.0 | floatingAnno ps = literal2idsAnno ps Float_anno | 47 | floatingAnno ps = literal2idsAnno ps Float_anno | 47 | floatingAnno ps = literal2idsAnno ps Float_anno | 47 | false | false | 1 | 5 | 5 | 17 | 6 | 11 | null | null |
christiaanb/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | process fn (LogLvl i) = setLogLevel i | 37 | process fn (LogLvl i) = setLogLevel i | 37 | process fn (LogLvl i) = setLogLevel i | 37 | false | false | 0 | 6 | 6 | 22 | 9 | 13 | null | null |
Proclivis/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_HBA_DEFAULT :: Int
wxSTC_HBA_DEFAULT = 81 | 47 | wxSTC_HBA_DEFAULT :: Int
wxSTC_HBA_DEFAULT = 81 | 47 | wxSTC_HBA_DEFAULT = 81 | 22 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
slpopejoy/fadno-xml | src/Fadno/MusicXml/MusicXml20.hs | bsd-2-clause | parseChxScoreInstrument :: P.XParse ChxScoreInstrument
parseChxScoreInstrument =
ScoreInstrumentSolo
<$> (P.xchild (P.name "solo") (parseEmpty))
<|> ScoreInstrumentEnsemble
<$> (P.xchild (P.name "ensemble") (P.xtext >>= parsePositiveIntegerOrEmpty)) | 278 | parseChxScoreInstrument :: P.XParse ChxScoreInstrument
parseChxScoreInstrument =
ScoreInstrumentSolo
<$> (P.xchild (P.name "solo") (parseEmpty))
<|> ScoreInstrumentEnsemble
<$> (P.xchild (P.name "ensemble") (P.xtext >>= parsePositiveIntegerOrEmpty)) | 278 | parseChxScoreInstrument =
ScoreInstrumentSolo
<$> (P.xchild (P.name "solo") (parseEmpty))
<|> ScoreInstrumentEnsemble
<$> (P.xchild (P.name "ensemble") (P.xtext >>= parsePositiveIntegerOrEmpty)) | 223 | false | true | 8 | 10 | 49 | 85 | 41 | 44 | null | null |
oldmanmike/ghc | compiler/hsSyn/HsDecls.hs | bsd-3-clause | tyClDeclLName :: TyClDecl name -> Located name
tyClDeclLName (FamDecl { tcdFam = FamilyDecl { fdLName = ln } }) = ln | 116 | tyClDeclLName :: TyClDecl name -> Located name
tyClDeclLName (FamDecl { tcdFam = FamilyDecl { fdLName = ln } }) = ln | 116 | tyClDeclLName (FamDecl { tcdFam = FamilyDecl { fdLName = ln } }) = ln | 69 | false | true | 0 | 12 | 20 | 45 | 23 | 22 | null | null |
vTurbine/ghc | libraries/base/Data/List/NonEmpty.hs | bsd-3-clause | -- | Sort a stream.
sort :: Ord a => NonEmpty a -> NonEmpty a
sort = lift List.sort | 83 | sort :: Ord a => NonEmpty a -> NonEmpty a
sort = lift List.sort | 63 | sort = lift List.sort | 21 | true | true | 0 | 8 | 18 | 40 | 17 | 23 | null | null |
mzini/gubs | src/GUBS/Utils.hs | mit | whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m ()
whenJust (Just a) m = m a | 85 | whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m ()
whenJust (Just a) m = m a | 85 | whenJust (Just a) m = m a | 25 | false | true | 0 | 12 | 21 | 65 | 29 | 36 | null | null |
kmate/HaRe | old/refactorer/RefacTypeSig.hs | bsd-3-clause | findType pnt t
= applyTU (stop_tdTU (failTU `adhocTU` inSig)) t
where
inSig (dec@(Dec (HsTypeSig _ _ _ _))::HsDeclP)
= do
let res = definesTypeSig (pNTtoPN pnt) dec
if res == True
then return [True]
else fail ""
inSig _ = fail "" | 340 | findType pnt t
= applyTU (stop_tdTU (failTU `adhocTU` inSig)) t
where
inSig (dec@(Dec (HsTypeSig _ _ _ _))::HsDeclP)
= do
let res = definesTypeSig (pNTtoPN pnt) dec
if res == True
then return [True]
else fail ""
inSig _ = fail "" | 340 | findType pnt t
= applyTU (stop_tdTU (failTU `adhocTU` inSig)) t
where
inSig (dec@(Dec (HsTypeSig _ _ _ _))::HsDeclP)
= do
let res = definesTypeSig (pNTtoPN pnt) dec
if res == True
then return [True]
else fail ""
inSig _ = fail "" | 340 | false | false | 0 | 14 | 152 | 124 | 62 | 62 | null | null |
rueshyna/gogol | gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ClickTag' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ctValue'
--
-- * 'ctName'
--
-- * 'ctEventName'
clickTag
:: ClickTag
clickTag =
ClickTag'
{ _ctValue = Nothing
, _ctName = Nothing
, _ctEventName = Nothing
} | 350 | clickTag
:: ClickTag
clickTag =
ClickTag'
{ _ctValue = Nothing
, _ctName = Nothing
, _ctEventName = Nothing
} | 133 | clickTag =
ClickTag'
{ _ctValue = Nothing
, _ctName = Nothing
, _ctEventName = Nothing
} | 108 | true | true | 0 | 7 | 84 | 50 | 30 | 20 | null | null |
robrix/surface | src/Expr.hs | bsd-3-clause | makeLambda :: Name -> Term -> Term
makeLambda = (Fix .) . Abs | 61 | makeLambda :: Name -> Term -> Term
makeLambda = (Fix .) . Abs | 61 | makeLambda = (Fix .) . Abs | 26 | false | true | 0 | 6 | 12 | 27 | 15 | 12 | null | null |
bitemyapp/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | -- | All of the following values are quite arbitrary - there are no
-- "good" defaults, these must be customised per-site
ispecsMinmaxDefaults :: Map String (Map String Int)
ispecsMinmaxDefaults =
Map.fromList
[(ispecsMin,
Map.fromList
[(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec),
(ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec),
(ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec),
(ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec),
(ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec),
(ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]),
(ispecsMax,
Map.fromList
[(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec),
(ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec),
(ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec),
(ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec),
(ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec),
(ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])] | 1,193 | ispecsMinmaxDefaults :: Map String (Map String Int)
ispecsMinmaxDefaults =
Map.fromList
[(ispecsMin,
Map.fromList
[(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec),
(ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec),
(ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec),
(ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec),
(ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec),
(ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]),
(ispecsMax,
Map.fromList
[(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec),
(ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec),
(ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec),
(ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec),
(ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec),
(ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])] | 1,071 | ispecsMinmaxDefaults =
Map.fromList
[(ispecsMin,
Map.fromList
[(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec),
(ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec),
(ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec),
(ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec),
(ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec),
(ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]),
(ispecsMax,
Map.fromList
[(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec),
(ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec),
(ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec),
(ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec),
(ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec),
(ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])] | 1,019 | true | true | 1 | 12 | 144 | 279 | 152 | 127 | null | null |
hpacheco/HAAP | examples/gameworker/li1g175/Bomberman.hs | mit | explodeBricks'' :: (Int,Int) -> [(Int,Int)] -> String -> String
explodeBricks'' _ _ [] = [] | 91 | explodeBricks'' :: (Int,Int) -> [(Int,Int)] -> String -> String
explodeBricks'' _ _ [] = [] | 91 | explodeBricks'' _ _ [] = [] | 27 | false | true | 0 | 8 | 14 | 49 | 27 | 22 | null | null |
int-index/singletons | tests/compile-and-dump/Singletons/CaseExpressions.hs | bsd-3-clause | foo5a :: Proxy (Foo5 Int)
foo5a = Proxy | 39 | foo5a :: Proxy (Foo5 Int)
foo5a = Proxy | 39 | foo5a = Proxy | 13 | false | true | 2 | 6 | 7 | 27 | 10 | 17 | null | null |
bytbox/hepevt.hs | Data/HEPEVT.hs | mit | parseLine :: S.ByteString -> Line
parseLine line =
let ws = S.words line in
parseLine' (map S.unpack ws) line
where
parseLine' ("E":xs) _ = E $ map parseDouble xs
parseLine' ("P":xs) _ = P $ mkParticle xs
parseLine' ("V":xs) _ = V $ map parseDouble xs
parseLine' _ line = if S.length line > 1 then Meta (S.unpack line) else Blank | 353 | parseLine :: S.ByteString -> Line
parseLine line =
let ws = S.words line in
parseLine' (map S.unpack ws) line
where
parseLine' ("E":xs) _ = E $ map parseDouble xs
parseLine' ("P":xs) _ = P $ mkParticle xs
parseLine' ("V":xs) _ = V $ map parseDouble xs
parseLine' _ line = if S.length line > 1 then Meta (S.unpack line) else Blank | 353 | parseLine line =
let ws = S.words line in
parseLine' (map S.unpack ws) line
where
parseLine' ("E":xs) _ = E $ map parseDouble xs
parseLine' ("P":xs) _ = P $ mkParticle xs
parseLine' ("V":xs) _ = V $ map parseDouble xs
parseLine' _ line = if S.length line > 1 then Meta (S.unpack line) else Blank | 319 | false | true | 3 | 11 | 84 | 167 | 82 | 85 | null | null |
gennady-em/haskel | src/Main_Test.hs | gpl-2.0 | insert2 :: (a -> a -> Bool) -> a -> [a] -> [a]
insert2 pred x [] = [x] | 93 | insert2 :: (a -> a -> Bool) -> a -> [a] -> [a]
insert2 pred x [] = [x] | 70 | insert2 pred x [] = [x] | 23 | false | true | 0 | 8 | 41 | 52 | 28 | 24 | null | null |
GaloisInc/halvm-ghc | compiler/types/Coercion.hs | bsd-3-clause | mkTransCo (Refl {}) co2 = co2 | 29 | mkTransCo (Refl {}) co2 = co2 | 29 | mkTransCo (Refl {}) co2 = co2 | 29 | false | false | 1 | 6 | 5 | 19 | 9 | 10 | null | null |
energyflowanalysis/efa-2.1 | test/EFA/Test/Mix.hs | bsd-3-clause | testFlow :: (Ord a) => FlowTopo.Flow (MultiMix a) -> All
testFlow m =
testFlowInner m
<>
testFlowInner (fmap transposeMix m) | 130 | testFlow :: (Ord a) => FlowTopo.Flow (MultiMix a) -> All
testFlow m =
testFlowInner m
<>
testFlowInner (fmap transposeMix m) | 130 | testFlow m =
testFlowInner m
<>
testFlowInner (fmap transposeMix m) | 73 | false | true | 2 | 9 | 25 | 57 | 27 | 30 | null | null |
batterseapower/context-semantics | Language/ContextSemantics/CallByNeedLambda.hs | bsd-3-clause | bracket :: Port -> Port -> (Port, Port)
bracket merged_out waiting_out = (merged_in, waiting_in)
where
merged_in tss = waiting_out (insert ([Bracket (cursor tss) (cursor (right tss))]) (delete (delete tss)))
waiting_in tss = case cursor tss of
[Bracket shallow deep] -> merged_out $ insert shallow $ insert deep $ delete tss
_ -> Left $ "bracket: waiting port got malformed incoming context " ++ show tss | 456 | bracket :: Port -> Port -> (Port, Port)
bracket merged_out waiting_out = (merged_in, waiting_in)
where
merged_in tss = waiting_out (insert ([Bracket (cursor tss) (cursor (right tss))]) (delete (delete tss)))
waiting_in tss = case cursor tss of
[Bracket shallow deep] -> merged_out $ insert shallow $ insert deep $ delete tss
_ -> Left $ "bracket: waiting port got malformed incoming context " ++ show tss | 456 | bracket merged_out waiting_out = (merged_in, waiting_in)
where
merged_in tss = waiting_out (insert ([Bracket (cursor tss) (cursor (right tss))]) (delete (delete tss)))
waiting_in tss = case cursor tss of
[Bracket shallow deep] -> merged_out $ insert shallow $ insert deep $ delete tss
_ -> Left $ "bracket: waiting port got malformed incoming context " ++ show tss | 416 | false | true | 2 | 14 | 116 | 177 | 83 | 94 | null | null |
joshuaunderwood7/HaskeLinGeom | Piece.hs | gpl-3.0 | makeChessDistancePiece :: Color -> Rank -> Location -> Piece
makeChessDistancePiece = makePiece distanceBoard | 109 | makeChessDistancePiece :: Color -> Rank -> Location -> Piece
makeChessDistancePiece = makePiece distanceBoard | 109 | makeChessDistancePiece = makePiece distanceBoard | 48 | false | true | 0 | 9 | 12 | 32 | 14 | 18 | null | null |
dbp/snaplet-wordpress | src/Web/Offset/Splices.hs | bsd-3-clause | customFill :: Wordpress b -> WPKey -> Fill s
customFill Wordpress{..} key = Fill $ \attrs (path, tpl) lib ->
do res <- liftIO $ (cachingGetRetry key :: IO (Either StatusCode WPResponse))
case (fmap decodeWPResponseBody res :: Either StatusCode (Maybe Value)) of
Left code -> do
let notification = "Encountered status code " <> tshow code
<> " when querying \"" <> tshow key <> "\"."
liftIO $ wpLogger notification
return $ "<!-- " <> notification <> " -->"
Right (Just json) ->
unFill (jsonToFill json) attrs (path, tpl) lib
Right Nothing -> do
let notification = "Unable to decode JSON for endpoint \"" <> tshow key
liftIO $ wpLogger $ notification <> ": " <> tshow res
return $ "<!-- " <> notification <> "-->" | 827 | customFill :: Wordpress b -> WPKey -> Fill s
customFill Wordpress{..} key = Fill $ \attrs (path, tpl) lib ->
do res <- liftIO $ (cachingGetRetry key :: IO (Either StatusCode WPResponse))
case (fmap decodeWPResponseBody res :: Either StatusCode (Maybe Value)) of
Left code -> do
let notification = "Encountered status code " <> tshow code
<> " when querying \"" <> tshow key <> "\"."
liftIO $ wpLogger notification
return $ "<!-- " <> notification <> " -->"
Right (Just json) ->
unFill (jsonToFill json) attrs (path, tpl) lib
Right Nothing -> do
let notification = "Unable to decode JSON for endpoint \"" <> tshow key
liftIO $ wpLogger $ notification <> ": " <> tshow res
return $ "<!-- " <> notification <> "-->" | 827 | customFill Wordpress{..} key = Fill $ \attrs (path, tpl) lib ->
do res <- liftIO $ (cachingGetRetry key :: IO (Either StatusCode WPResponse))
case (fmap decodeWPResponseBody res :: Either StatusCode (Maybe Value)) of
Left code -> do
let notification = "Encountered status code " <> tshow code
<> " when querying \"" <> tshow key <> "\"."
liftIO $ wpLogger notification
return $ "<!-- " <> notification <> " -->"
Right (Just json) ->
unFill (jsonToFill json) attrs (path, tpl) lib
Right Nothing -> do
let notification = "Unable to decode JSON for endpoint \"" <> tshow key
liftIO $ wpLogger $ notification <> ": " <> tshow res
return $ "<!-- " <> notification <> "-->" | 782 | false | true | 0 | 21 | 240 | 278 | 132 | 146 | null | null |
timjb/diagrams-rubiks-cube | src/Diagrams/RubiksCube/Move.hs | mit | invert F' = F | 13 | invert F' = F | 13 | invert F' = F | 13 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
CloudI/CloudI | src/api/haskell/external/bytestring-0.10.10.0/tests/QuickCheckUtils.hs | mit | castFn :: Model a b => a -> b
castFn = model | 44 | castFn :: Model a b => a -> b
castFn = model | 44 | castFn = model | 14 | false | true | 0 | 8 | 11 | 31 | 13 | 18 | null | null |
ghcjs/ghcjs | src/Compiler/Plugins.hs | mit | tryLoadThing :: HscEnv -> Type -> Name -> IO (Maybe HValue)
tryLoadThing plugins_env expected_type val_name0 = do
-- putStrLn ("plugins: trying to load: " ++ show val_name0)
let dflags = hsc_dflags plugins_env
doc = text "contains a name used in an invocation of getHValueSafely"
-- We now have an intermediate name that has the correct unit id for the GHC
-- package, but it still has the GHCJS unique. Here we load the interface
-- file and then find the the actual GHC name in the module exports.
let mod = nameModule val_name0
(_, Just val_iface) <- initTcInteractive plugins_env $ initIfaceTcRn $ loadPluginInterface doc mod
let mod_name = moduleName mod
rdr_name = mkRdrUnqual (nameOccName val_name0)
decl_spec = ImpDeclSpec { is_mod = mod_name, is_as = mod_name
, is_qual = False, is_dloc = noSrcSpan }
imp_spec = ImpSpec decl_spec ImpAll
env = mkGlobalRdrEnv (gresFromAvails (Just imp_spec) (mi_exports val_iface))
val_name = case lookupGRE_RdrName rdr_name env of
[gre] -> gre_name gre
_ -> panic "lookupRdrNameInModule"
-- Now look up the names for the value and type constructor in the type environment
mb_val_thing <- lookupTypeHscEnv plugins_env val_name
case mb_val_thing of
Nothing -> pure Nothing -- throwCmdLineErrorS dflags (missingTyThingErrorGHC val_name)
Just (AnId id) ->
-- Check the value type in the interface against the type recovered from the type constructor
-- before finally casting the value to the type we assume corresponds to that constructor
if expected_type `eqPluginType` idType id
then do
-- Link in the module that contains the value, if it has such a module
case nameModule_maybe val_name of
Just mod -> do linkModule plugins_env mod
return ()
Nothing -> return ()
-- Find the value that we just linked in and cast it given that we have proved its type
hval <- getHValue plugins_env val_name >>= wormhole dflags
return (Just hval)
else
return Nothing
Just _val_thing -> pure Nothing -- throwCmdLineErrorS dflags (wrongTyThingError val_name val_thing) | 2,314 | tryLoadThing :: HscEnv -> Type -> Name -> IO (Maybe HValue)
tryLoadThing plugins_env expected_type val_name0 = do
-- putStrLn ("plugins: trying to load: " ++ show val_name0)
let dflags = hsc_dflags plugins_env
doc = text "contains a name used in an invocation of getHValueSafely"
-- We now have an intermediate name that has the correct unit id for the GHC
-- package, but it still has the GHCJS unique. Here we load the interface
-- file and then find the the actual GHC name in the module exports.
let mod = nameModule val_name0
(_, Just val_iface) <- initTcInteractive plugins_env $ initIfaceTcRn $ loadPluginInterface doc mod
let mod_name = moduleName mod
rdr_name = mkRdrUnqual (nameOccName val_name0)
decl_spec = ImpDeclSpec { is_mod = mod_name, is_as = mod_name
, is_qual = False, is_dloc = noSrcSpan }
imp_spec = ImpSpec decl_spec ImpAll
env = mkGlobalRdrEnv (gresFromAvails (Just imp_spec) (mi_exports val_iface))
val_name = case lookupGRE_RdrName rdr_name env of
[gre] -> gre_name gre
_ -> panic "lookupRdrNameInModule"
-- Now look up the names for the value and type constructor in the type environment
mb_val_thing <- lookupTypeHscEnv plugins_env val_name
case mb_val_thing of
Nothing -> pure Nothing -- throwCmdLineErrorS dflags (missingTyThingErrorGHC val_name)
Just (AnId id) ->
-- Check the value type in the interface against the type recovered from the type constructor
-- before finally casting the value to the type we assume corresponds to that constructor
if expected_type `eqPluginType` idType id
then do
-- Link in the module that contains the value, if it has such a module
case nameModule_maybe val_name of
Just mod -> do linkModule plugins_env mod
return ()
Nothing -> return ()
-- Find the value that we just linked in and cast it given that we have proved its type
hval <- getHValue plugins_env val_name >>= wormhole dflags
return (Just hval)
else
return Nothing
Just _val_thing -> pure Nothing -- throwCmdLineErrorS dflags (wrongTyThingError val_name val_thing) | 2,314 | tryLoadThing plugins_env expected_type val_name0 = do
-- putStrLn ("plugins: trying to load: " ++ show val_name0)
let dflags = hsc_dflags plugins_env
doc = text "contains a name used in an invocation of getHValueSafely"
-- We now have an intermediate name that has the correct unit id for the GHC
-- package, but it still has the GHCJS unique. Here we load the interface
-- file and then find the the actual GHC name in the module exports.
let mod = nameModule val_name0
(_, Just val_iface) <- initTcInteractive plugins_env $ initIfaceTcRn $ loadPluginInterface doc mod
let mod_name = moduleName mod
rdr_name = mkRdrUnqual (nameOccName val_name0)
decl_spec = ImpDeclSpec { is_mod = mod_name, is_as = mod_name
, is_qual = False, is_dloc = noSrcSpan }
imp_spec = ImpSpec decl_spec ImpAll
env = mkGlobalRdrEnv (gresFromAvails (Just imp_spec) (mi_exports val_iface))
val_name = case lookupGRE_RdrName rdr_name env of
[gre] -> gre_name gre
_ -> panic "lookupRdrNameInModule"
-- Now look up the names for the value and type constructor in the type environment
mb_val_thing <- lookupTypeHscEnv plugins_env val_name
case mb_val_thing of
Nothing -> pure Nothing -- throwCmdLineErrorS dflags (missingTyThingErrorGHC val_name)
Just (AnId id) ->
-- Check the value type in the interface against the type recovered from the type constructor
-- before finally casting the value to the type we assume corresponds to that constructor
if expected_type `eqPluginType` idType id
then do
-- Link in the module that contains the value, if it has such a module
case nameModule_maybe val_name of
Just mod -> do linkModule plugins_env mod
return ()
Nothing -> return ()
-- Find the value that we just linked in and cast it given that we have proved its type
hval <- getHValue plugins_env val_name >>= wormhole dflags
return (Just hval)
else
return Nothing
Just _val_thing -> pure Nothing -- throwCmdLineErrorS dflags (wrongTyThingError val_name val_thing) | 2,254 | false | true | 0 | 20 | 634 | 401 | 195 | 206 | null | null |
simonced/haskell-kata | email-parser-stack/src/Lib.hs | gpl-3.0 | compareOneToList :: Email -> [Email] -> [String]
compareOneToList email list = mapMaybe (compareEmailTail email) list | 117 | compareOneToList :: Email -> [Email] -> [String]
compareOneToList email list = mapMaybe (compareEmailTail email) list | 117 | compareOneToList email list = mapMaybe (compareEmailTail email) list | 68 | false | true | 0 | 9 | 14 | 46 | 22 | 24 | null | null |
DataStewardshipPortal/ds-wizard | src/Actions.hs | apache-2.0 | doExport :: (ToAny a, FFI a) => B.ClientAction -> a -> IO ()
doExport action = export (toJSString $ B.toFnName action) | 119 | doExport :: (ToAny a, FFI a) => B.ClientAction -> a -> IO ()
doExport action = export (toJSString $ B.toFnName action) | 119 | doExport action = export (toJSString $ B.toFnName action) | 58 | false | true | 0 | 9 | 21 | 59 | 29 | 30 | null | null |
AlexanderPankiv/ghc | compiler/rename/RnSplice.hs | bsd-3-clause | rnSplicePat :: HsSplice RdrName -> RnM (Either (Pat RdrName) (Pat Name), FreeVars)
rnSplicePat e = failTH e "Template Haskell pattern splice" | 141 | rnSplicePat :: HsSplice RdrName -> RnM (Either (Pat RdrName) (Pat Name), FreeVars)
rnSplicePat e = failTH e "Template Haskell pattern splice" | 141 | rnSplicePat e = failTH e "Template Haskell pattern splice" | 58 | false | true | 0 | 11 | 20 | 57 | 26 | 31 | null | null |
heathweiss/Tricad | src/CornerPoints/FaceConversions.hs | gpl-2.0 | frontTopLineFromBackTopLine :: CornerPoints -> CornerPoints
frontTopLineFromBackTopLine (BackTopLine b2 b3) = FrontTopLine b2 b3 | 128 | frontTopLineFromBackTopLine :: CornerPoints -> CornerPoints
frontTopLineFromBackTopLine (BackTopLine b2 b3) = FrontTopLine b2 b3 | 128 | frontTopLineFromBackTopLine (BackTopLine b2 b3) = FrontTopLine b2 b3 | 68 | false | true | 0 | 7 | 12 | 31 | 15 | 16 | null | null |
ezyang/ghc | libraries/base/Data/Unique.hs | bsd-3-clause | uniqSource :: IORef Integer
uniqSource = unsafePerformIO (newIORef 0) | 69 | uniqSource :: IORef Integer
uniqSource = unsafePerformIO (newIORef 0) | 69 | uniqSource = unsafePerformIO (newIORef 0) | 41 | false | true | 0 | 7 | 8 | 23 | 11 | 12 | null | null |
YuichiroSato/GameOfSymbolGrounding | test/DataTest/CellTest.hs | bsd-3-clause | eatTests :: [Test]
eatTests =
[ "eat1" ~: length (eat [car1, her1]) ~?= 1
] | 79 | eatTests :: [Test]
eatTests =
[ "eat1" ~: length (eat [car1, her1]) ~?= 1
] | 79 | eatTests =
[ "eat1" ~: length (eat [car1, her1]) ~?= 1
] | 60 | false | true | 0 | 11 | 18 | 40 | 22 | 18 | null | null |
jfischoff/promise | tests/Main.hs | bsd-3-clause | main = defaultMain [] | 21 | main = defaultMain [] | 21 | main = defaultMain [] | 21 | false | false | 1 | 6 | 3 | 14 | 5 | 9 | null | null |
CindyLinz/Haskell.js | trans/src/Desugar/LambdaCase.hs | mit | deLambdaCaseRPat (RPPat l pat) = RPPat (id l) (deLambdaCasePat pat) | 67 | deLambdaCaseRPat (RPPat l pat) = RPPat (id l) (deLambdaCasePat pat) | 67 | deLambdaCaseRPat (RPPat l pat) = RPPat (id l) (deLambdaCasePat pat) | 67 | false | false | 0 | 7 | 9 | 34 | 16 | 18 | null | null |
ml9951/ThreadScope | papers/haskell_symposium_2009/sumEuler/SumEuler1.hs | bsd-3-clause | -------------------------------------------------------------------------------
fib :: Int -> Int
fib 0 = 0 | 111 | fib :: Int -> Int
fib 0 = 0 | 27 | fib 0 = 0 | 9 | true | true | 0 | 5 | 13 | 23 | 11 | 12 | null | null |
alpicola/mel | src/K/PrettyPrint.hs | mit | ppExpr (KCon con ns) = do
write $ show con ++ " "
case ns of
[] -> return ()
[n] -> write $ show n ++ " "
_ -> write $ "(" ++ intercalate ", " (map show ns) ++ ") " | 180 | ppExpr (KCon con ns) = do
write $ show con ++ " "
case ns of
[] -> return ()
[n] -> write $ show n ++ " "
_ -> write $ "(" ++ intercalate ", " (map show ns) ++ ") " | 180 | ppExpr (KCon con ns) = do
write $ show con ++ " "
case ns of
[] -> return ()
[n] -> write $ show n ++ " "
_ -> write $ "(" ++ intercalate ", " (map show ns) ++ ") " | 180 | false | false | 0 | 14 | 59 | 103 | 48 | 55 | null | null |
codemac/yi-editor | src/Yi/Dired.hs | gpl-2.0 | resetDiredOpState :: YiM ()
resetDiredOpState = withBuffer $ modA bufferDynamicValueA (\_ds -> initial :: DiredOpState) | 119 | resetDiredOpState :: YiM ()
resetDiredOpState = withBuffer $ modA bufferDynamicValueA (\_ds -> initial :: DiredOpState) | 119 | resetDiredOpState = withBuffer $ modA bufferDynamicValueA (\_ds -> initial :: DiredOpState) | 91 | false | true | 1 | 8 | 14 | 39 | 19 | 20 | null | null |
ComputationWithBoundedResources/tct-core | src/Tct/Core/Data/Answer.hs | bsd-3-clause | -- | Extracts lower and upper bounds of a certificate.
timebounds :: T.Certificate -> Timebounds
timebounds c@T.Certificate{} = Timebounds (T.timeLB c) (T.timeUB c) | 167 | timebounds :: T.Certificate -> Timebounds
timebounds c@T.Certificate{} = Timebounds (T.timeLB c) (T.timeUB c) | 112 | timebounds c@T.Certificate{} = Timebounds (T.timeLB c) (T.timeUB c) | 70 | true | true | 2 | 6 | 25 | 44 | 25 | 19 | null | null |
hjwylde/qux-haskell | src/Language/Qux/Annotated/TypeChecker.hs | bsd-3-clause | checkExpr (Ann.TypedExpr _ type_ (Ann.CallExpr pos id arguments)) = views functions (Map.lookup $ map simp id) >>= maybe
(error "internal error: undefined function call has no type (try applying name resolution)")
(\types -> do
let expected = map fst (init types)
zipWithM_ expectExpr arguments $ map (:[]) expected
when (length expected /= length arguments) $ tell [InvalidFunctionCall pos (length arguments) (length expected)]
return type_) | 487 | checkExpr (Ann.TypedExpr _ type_ (Ann.CallExpr pos id arguments)) = views functions (Map.lookup $ map simp id) >>= maybe
(error "internal error: undefined function call has no type (try applying name resolution)")
(\types -> do
let expected = map fst (init types)
zipWithM_ expectExpr arguments $ map (:[]) expected
when (length expected /= length arguments) $ tell [InvalidFunctionCall pos (length arguments) (length expected)]
return type_) | 487 | checkExpr (Ann.TypedExpr _ type_ (Ann.CallExpr pos id arguments)) = views functions (Map.lookup $ map simp id) >>= maybe
(error "internal error: undefined function call has no type (try applying name resolution)")
(\types -> do
let expected = map fst (init types)
zipWithM_ expectExpr arguments $ map (:[]) expected
when (length expected /= length arguments) $ tell [InvalidFunctionCall pos (length arguments) (length expected)]
return type_) | 487 | false | false | 0 | 14 | 108 | 173 | 81 | 92 | null | null |
agocorona/control-monad-supervisor | Control/Monad/Supervisor/Session.hs | bsd-3-clause | runs= flip evalStateT | 21 | runs= flip evalStateT | 21 | runs= flip evalStateT | 21 | false | false | 1 | 5 | 2 | 13 | 4 | 9 | null | null |
daoo/musictheory | src/Music/Theory/Scale/Western.hs | bsd-3-clause | chromatic :: Scale
chromatic = emptyScale #+ 0 #+ 1 #+ 2 #+ 3 #+ 4 #+ 5 #+ 6 #+ 7 #+ 8 #+ 9 #+ 10 #+ 11 | 103 | chromatic :: Scale
chromatic = emptyScale #+ 0 #+ 1 #+ 2 #+ 3 #+ 4 #+ 5 #+ 6 #+ 7 #+ 8 #+ 9 #+ 10 #+ 11 | 103 | chromatic = emptyScale #+ 0 #+ 1 #+ 2 #+ 3 #+ 4 #+ 5 #+ 6 #+ 7 #+ 8 #+ 9 #+ 10 #+ 11 | 84 | false | true | 0 | 16 | 29 | 59 | 30 | 29 | null | null |
fmapfmapfmap/amazonka | amazonka-elasticache/gen/Network/AWS/ElastiCache/CreateReplicationGroup.hs | mpl-2.0 | -- | Undocumented member.
crgrsReplicationGroup :: Lens' CreateReplicationGroupResponse (Maybe ReplicationGroup)
crgrsReplicationGroup = lens _crgrsReplicationGroup (\ s a -> s{_crgrsReplicationGroup = a}) | 205 | crgrsReplicationGroup :: Lens' CreateReplicationGroupResponse (Maybe ReplicationGroup)
crgrsReplicationGroup = lens _crgrsReplicationGroup (\ s a -> s{_crgrsReplicationGroup = a}) | 179 | crgrsReplicationGroup = lens _crgrsReplicationGroup (\ s a -> s{_crgrsReplicationGroup = a}) | 92 | true | true | 0 | 9 | 20 | 46 | 25 | 21 | null | null |
gcampax/ghc | compiler/utils/Util.hs | bsd-3-clause | filterOut :: (a->Bool) -> [a] -> [a]
-- ^ Like filter, only it reverses the sense of the test
filterOut _ [] = [] | 113 | filterOut :: (a->Bool) -> [a] -> [a]
filterOut _ [] = [] | 56 | filterOut _ [] = [] | 19 | true | true | 0 | 9 | 23 | 48 | 24 | 24 | null | null |
forsyde/forsyde-shallow | src/ForSyDe/Shallow/MoC/DomainInterface.hs | bsd-3-clause | par2serxDI = par2serxDI' . zipxSY
where par2serxDI' NullS = NullS
par2serxDI' (xv:-xs) = (signal . fromVector) xv
+-+ par2serxDI' xs | 179 | par2serxDI = par2serxDI' . zipxSY
where par2serxDI' NullS = NullS
par2serxDI' (xv:-xs) = (signal . fromVector) xv
+-+ par2serxDI' xs | 179 | par2serxDI = par2serxDI' . zipxSY
where par2serxDI' NullS = NullS
par2serxDI' (xv:-xs) = (signal . fromVector) xv
+-+ par2serxDI' xs | 179 | false | false | 3 | 8 | 66 | 61 | 26 | 35 | null | null |
olorin/amazonka | amazonka-storagegateway/test/Test/AWS/Gen/StorageGateway.hs | mpl-2.0 | testCreateSnapshot :: CreateSnapshot -> TestTree
testCreateSnapshot = req
"CreateSnapshot"
"fixture/CreateSnapshot.yaml" | 128 | testCreateSnapshot :: CreateSnapshot -> TestTree
testCreateSnapshot = req
"CreateSnapshot"
"fixture/CreateSnapshot.yaml" | 128 | testCreateSnapshot = req
"CreateSnapshot"
"fixture/CreateSnapshot.yaml" | 79 | false | true | 0 | 7 | 17 | 28 | 11 | 17 | null | null |
brendanhay/gogol | gogol-admin-directory/gen/Network/Google/Resource/Admin/Customers/Chrome/Printers/Patch.hs | mpl-2.0 | -- | Creates a value of 'CustomersChromePrintersPatch' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ccppXgafv'
--
-- * 'ccppUploadProtocol'
--
-- * 'ccppUpdateMask'
--
-- * 'ccppAccessToken'
--
-- * 'ccppUploadType'
--
-- * 'ccppPayload'
--
-- * 'ccppName'
--
-- * 'ccppClearMask'
--
-- * 'ccppCallback'
customersChromePrintersPatch
:: Printer -- ^ 'ccppPayload'
-> Text -- ^ 'ccppName'
-> CustomersChromePrintersPatch
customersChromePrintersPatch pCcppPayload_ pCcppName_ =
CustomersChromePrintersPatch'
{ _ccppXgafv = Nothing
, _ccppUploadProtocol = Nothing
, _ccppUpdateMask = Nothing
, _ccppAccessToken = Nothing
, _ccppUploadType = Nothing
, _ccppPayload = pCcppPayload_
, _ccppName = pCcppName_
, _ccppClearMask = Nothing
, _ccppCallback = Nothing
} | 898 | customersChromePrintersPatch
:: Printer -- ^ 'ccppPayload'
-> Text -- ^ 'ccppName'
-> CustomersChromePrintersPatch
customersChromePrintersPatch pCcppPayload_ pCcppName_ =
CustomersChromePrintersPatch'
{ _ccppXgafv = Nothing
, _ccppUploadProtocol = Nothing
, _ccppUpdateMask = Nothing
, _ccppAccessToken = Nothing
, _ccppUploadType = Nothing
, _ccppPayload = pCcppPayload_
, _ccppName = pCcppName_
, _ccppClearMask = Nothing
, _ccppCallback = Nothing
} | 505 | customersChromePrintersPatch pCcppPayload_ pCcppName_ =
CustomersChromePrintersPatch'
{ _ccppXgafv = Nothing
, _ccppUploadProtocol = Nothing
, _ccppUpdateMask = Nothing
, _ccppAccessToken = Nothing
, _ccppUploadType = Nothing
, _ccppPayload = pCcppPayload_
, _ccppName = pCcppName_
, _ccppClearMask = Nothing
, _ccppCallback = Nothing
} | 378 | true | true | 0 | 8 | 174 | 112 | 74 | 38 | null | null |
haskellGardener/yusic | src/Yusic.hs | mit | toSigPitch Fs_Gb5 = Fs_Gb | 25 | toSigPitch Fs_Gb5 = Fs_Gb | 25 | toSigPitch Fs_Gb5 = Fs_Gb | 25 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
kkmonlee/Project-Euler-Solutions | Haskell/Problem1.hs | gpl-3.0 | sum = sum [x | x <- [-0..999], (mod x 5) == 0 || (mod x 3) == 0] | 64 | sum = sum [x | x <- [-0..999], (mod x 5) == 0 || (mod x 3) == 0] | 64 | sum = sum [x | x <- [-0..999], (mod x 5) == 0 || (mod x 3) == 0] | 64 | false | false | 1 | 12 | 18 | 62 | 30 | 32 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Aeson.Encoding.Internal.hs | bsd-3-clause | -------------------------------------------------------------------------------
-- Decimal numbers
-------------------------------------------------------------------------------
int8 :: Int8 -> Encoding
int8 = Encoding . B.int8Dec | 232 | int8 :: Int8 -> Encoding
int8 = Encoding . B.int8Dec | 52 | int8 = Encoding . B.int8Dec | 27 | true | true | 1 | 7 | 15 | 32 | 15 | 17 | null | null |
angerman/HInvoice | UI.hs | bsd-3-clause | invoiceListUI app = do
populateInvoices app
lstFooter <- plainText "add" -- delete"
ui <- (((return (getInvoiceList app)) >>= bordered) <--> (return lstFooter))
fg <- newFocusGroup
_ <- addToFocusGroup fg (getInvoiceList app)
header <- plainText "Invoices" <++> hFill ' ' 1 <++> plainText companyName
footer <- plainText "Clients | Products | Invoices" <++> hFill ' ' 1 <++> plainText version
dui <- (return header) <--> (return ui) <--> (return footer)
return $ (dui, fg)
where populateInvoices app = do
invoices <- allInvoices $ getConn app
mapM_ (\c -> addToList (getInvoiceList app) c =<< (plainText . T.pack $ Models.Invoice.name c)) invoices
{-
showInvoiceAddUI app completion = do
(iaui, iafg) <- newInvoiceAddDialog (getConn app) (allProducts $ getConn app) onAccept onCancel
switchToAdd <- addToCollection (getUIs app) iaui iafg
switchToAdd
where onAccept inv = \_ -> do
-- TODO: add invoice
insertInvoice (getConn app) =<< inv
completion
onCancel _ = const completion
-}
--------------------------------------------------------------------------------
-- invoice validation | 1,174 | invoiceListUI app = do
populateInvoices app
lstFooter <- plainText "add" -- delete"
ui <- (((return (getInvoiceList app)) >>= bordered) <--> (return lstFooter))
fg <- newFocusGroup
_ <- addToFocusGroup fg (getInvoiceList app)
header <- plainText "Invoices" <++> hFill ' ' 1 <++> plainText companyName
footer <- plainText "Clients | Products | Invoices" <++> hFill ' ' 1 <++> plainText version
dui <- (return header) <--> (return ui) <--> (return footer)
return $ (dui, fg)
where populateInvoices app = do
invoices <- allInvoices $ getConn app
mapM_ (\c -> addToList (getInvoiceList app) c =<< (plainText . T.pack $ Models.Invoice.name c)) invoices
{-
showInvoiceAddUI app completion = do
(iaui, iafg) <- newInvoiceAddDialog (getConn app) (allProducts $ getConn app) onAccept onCancel
switchToAdd <- addToCollection (getUIs app) iaui iafg
switchToAdd
where onAccept inv = \_ -> do
-- TODO: add invoice
insertInvoice (getConn app) =<< inv
completion
onCancel _ = const completion
-}
--------------------------------------------------------------------------------
-- invoice validation | 1,174 | invoiceListUI app = do
populateInvoices app
lstFooter <- plainText "add" -- delete"
ui <- (((return (getInvoiceList app)) >>= bordered) <--> (return lstFooter))
fg <- newFocusGroup
_ <- addToFocusGroup fg (getInvoiceList app)
header <- plainText "Invoices" <++> hFill ' ' 1 <++> plainText companyName
footer <- plainText "Clients | Products | Invoices" <++> hFill ' ' 1 <++> plainText version
dui <- (return header) <--> (return ui) <--> (return footer)
return $ (dui, fg)
where populateInvoices app = do
invoices <- allInvoices $ getConn app
mapM_ (\c -> addToList (getInvoiceList app) c =<< (plainText . T.pack $ Models.Invoice.name c)) invoices
{-
showInvoiceAddUI app completion = do
(iaui, iafg) <- newInvoiceAddDialog (getConn app) (allProducts $ getConn app) onAccept onCancel
switchToAdd <- addToCollection (getUIs app) iaui iafg
switchToAdd
where onAccept inv = \_ -> do
-- TODO: add invoice
insertInvoice (getConn app) =<< inv
completion
onCancel _ = const completion
-}
--------------------------------------------------------------------------------
-- invoice validation | 1,174 | false | false | 1 | 15 | 242 | 270 | 126 | 144 | null | null |
ocramz/petsc-hs | src/Numerical/PETSc/Internal/PutGet/KSP.hs | gpl-3.0 | kspGetSolution :: KSP -> IO Vec
kspGetSolution ksp = chk1 (kspGetSolution' ksp) | 79 | kspGetSolution :: KSP -> IO Vec
kspGetSolution ksp = chk1 (kspGetSolution' ksp) | 79 | kspGetSolution ksp = chk1 (kspGetSolution' ksp) | 47 | false | true | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
jsavatgy/hatupist | hatupist-103.hs | gpl-2.0 | zeroResult = Result {
rDate = "0000-00-00 00:00:00",
rMrks = 0, rRank = 0, rErrs = 0 } | 91 | zeroResult = Result {
rDate = "0000-00-00 00:00:00",
rMrks = 0, rRank = 0, rErrs = 0 } | 91 | zeroResult = Result {
rDate = "0000-00-00 00:00:00",
rMrks = 0, rRank = 0, rErrs = 0 } | 91 | false | false | 1 | 6 | 22 | 35 | 20 | 15 | null | null |
nushio3/ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | hpcSrcSpan :: SrcSpan
hpcSrcSpan = mkGeneralSrcSpan (fsLit "Haskell Program Coverage internals") | 96 | hpcSrcSpan :: SrcSpan
hpcSrcSpan = mkGeneralSrcSpan (fsLit "Haskell Program Coverage internals") | 96 | hpcSrcSpan = mkGeneralSrcSpan (fsLit "Haskell Program Coverage internals") | 74 | false | true | 0 | 7 | 10 | 26 | 11 | 15 | null | null |
nicolasbrugneaux/redis-haskell | src/Main.hs | bsd-3-clause | fromBulks :: [Reply] -> [ByteString]
fromBulks bulks = mapMaybe (\(Bulk mb) -> mb) bulks | 88 | fromBulks :: [Reply] -> [ByteString]
fromBulks bulks = mapMaybe (\(Bulk mb) -> mb) bulks | 88 | fromBulks bulks = mapMaybe (\(Bulk mb) -> mb) bulks | 51 | false | true | 0 | 9 | 13 | 48 | 24 | 24 | null | null |
dec9ue/jhc_copygc | src/Cmm/Op.hs | gpl-2.0 | binopType NEq _ _ = TyBool | 27 | binopType NEq _ _ = TyBool | 27 | binopType NEq _ _ = TyBool | 27 | false | false | 1 | 5 | 6 | 15 | 6 | 9 | null | null |
spinda/liquidhaskell | src/Language/Haskell/Liquid/TH/Parse/Logic.hs | bsd-3-clause | iteP :: Parser (Either Pred Expr)
iteP = do
p <- reserved "if" *> (asPred <$> logicP)
b1 <- reserved "then" *> logicP
b2 <- reserved "else" *> logicP
case snd b1 of
Left p1 -> return $ Left $ pIte p p1 $ asPred b2
Right e1 -> Right . EIte p e1 <$> asExprP b2 | 278 | iteP :: Parser (Either Pred Expr)
iteP = do
p <- reserved "if" *> (asPred <$> logicP)
b1 <- reserved "then" *> logicP
b2 <- reserved "else" *> logicP
case snd b1 of
Left p1 -> return $ Left $ pIte p p1 $ asPred b2
Right e1 -> Right . EIte p e1 <$> asExprP b2 | 278 | iteP = do
p <- reserved "if" *> (asPred <$> logicP)
b1 <- reserved "then" *> logicP
b2 <- reserved "else" *> logicP
case snd b1 of
Left p1 -> return $ Left $ pIte p p1 $ asPred b2
Right e1 -> Right . EIte p e1 <$> asExprP b2 | 244 | false | true | 2 | 13 | 76 | 142 | 61 | 81 | null | null |
ProLambda/Times | Skeleton/Kernel/Core/Mail.hs | gpl-3.0 | render' :: (MVar CacheList, MVar CacheList, MVar CacheList)
-> IO (ListOfPostM, ListOfPostM, ListOfPostM)
render' (w, b, a) = do
w <- readMVar w
a <- readMVar a
b <- readMVar b
let news = getValue w
acad = getValue b
asks = getValue a
return (news, acad, asks) | 333 | render' :: (MVar CacheList, MVar CacheList, MVar CacheList)
-> IO (ListOfPostM, ListOfPostM, ListOfPostM)
render' (w, b, a) = do
w <- readMVar w
a <- readMVar a
b <- readMVar b
let news = getValue w
acad = getValue b
asks = getValue a
return (news, acad, asks) | 333 | render' (w, b, a) = do
w <- readMVar w
a <- readMVar a
b <- readMVar b
let news = getValue w
acad = getValue b
asks = getValue a
return (news, acad, asks) | 219 | false | true | 2 | 11 | 120 | 136 | 64 | 72 | null | null |
ddssff/rdf4h | src/Text/RDF/RDF4H/ParserUtils.hs | bsd-3-clause | -- | Parse contents at URL into an 'RDF'.
_parseURL :: RDF rdf => (T.Text -> Either ParseFailure rdf) -> String -> IO (Either ParseFailure rdf)
_parseURL parseFunc url =
maybe
(return (Left (ParseFailure $ "Unable to parse URL: " ++ url)))
doParse
(parseURI url)
where
showRspCode (a, b, c) = map intToDigit [a, b, c]
httpError resp = showRspCode (rspCode resp) ++ " " ++ rspReason resp
doParse url' =
simpleHTTP (request url') >>= \resp ->
case resp of
(Left e) -> return (errResult $ "couldn't retrieve from URL: " ++ show url' ++ " [" ++ show e ++ "]")
(Right res) -> case rspCode res of
(2, 0, 0) -> return $ parseFunc (decodeUtf8 (rspBody res))
_ -> return (errResult $ "couldn't retrieve from URL: " ++ httpError res)
-- | Construct HTTP GET request. | 884 | _parseURL :: RDF rdf => (T.Text -> Either ParseFailure rdf) -> String -> IO (Either ParseFailure rdf)
_parseURL parseFunc url =
maybe
(return (Left (ParseFailure $ "Unable to parse URL: " ++ url)))
doParse
(parseURI url)
where
showRspCode (a, b, c) = map intToDigit [a, b, c]
httpError resp = showRspCode (rspCode resp) ++ " " ++ rspReason resp
doParse url' =
simpleHTTP (request url') >>= \resp ->
case resp of
(Left e) -> return (errResult $ "couldn't retrieve from URL: " ++ show url' ++ " [" ++ show e ++ "]")
(Right res) -> case rspCode res of
(2, 0, 0) -> return $ parseFunc (decodeUtf8 (rspBody res))
_ -> return (errResult $ "couldn't retrieve from URL: " ++ httpError res)
-- | Construct HTTP GET request. | 842 | _parseURL parseFunc url =
maybe
(return (Left (ParseFailure $ "Unable to parse URL: " ++ url)))
doParse
(parseURI url)
where
showRspCode (a, b, c) = map intToDigit [a, b, c]
httpError resp = showRspCode (rspCode resp) ++ " " ++ rspReason resp
doParse url' =
simpleHTTP (request url') >>= \resp ->
case resp of
(Left e) -> return (errResult $ "couldn't retrieve from URL: " ++ show url' ++ " [" ++ show e ++ "]")
(Right res) -> case rspCode res of
(2, 0, 0) -> return $ parseFunc (decodeUtf8 (rspBody res))
_ -> return (errResult $ "couldn't retrieve from URL: " ++ httpError res)
-- | Construct HTTP GET request. | 740 | true | true | 2 | 18 | 265 | 303 | 153 | 150 | null | null |
karamellpelle/grid | source/Game/Run/Helpers/World.hs | gpl-3.0 | runModifyLevelPuzzleWorld :: RunWorld -> (LevelPuzzleWorld -> LevelPuzzleWorld) ->
RunWorld
runModifyLevelPuzzleWorld run f =
run { runLevelPuzzleWorld = f $ runLevelPuzzleWorld run } | 217 | runModifyLevelPuzzleWorld :: RunWorld -> (LevelPuzzleWorld -> LevelPuzzleWorld) ->
RunWorld
runModifyLevelPuzzleWorld run f =
run { runLevelPuzzleWorld = f $ runLevelPuzzleWorld run } | 217 | runModifyLevelPuzzleWorld run f =
run { runLevelPuzzleWorld = f $ runLevelPuzzleWorld run } | 95 | false | true | 0 | 8 | 55 | 46 | 24 | 22 | null | null |
tismith/tlisp | write-yourself-a-scheme/listings/listing9.hs | mit | eqv [(List arg1), (List arg2)] = return $ Bool $ (length arg1 == length arg2) &&
(and $ map eqvPair $ zip arg1 arg2)
where eqvPair (x1, x2) = case eqv [x1, x2] of
Left err -> False
Right (Bool val) -> val | 323 | eqv [(List arg1), (List arg2)] = return $ Bool $ (length arg1 == length arg2) &&
(and $ map eqvPair $ zip arg1 arg2)
where eqvPair (x1, x2) = case eqv [x1, x2] of
Left err -> False
Right (Bool val) -> val | 323 | eqv [(List arg1), (List arg2)] = return $ Bool $ (length arg1 == length arg2) &&
(and $ map eqvPair $ zip arg1 arg2)
where eqvPair (x1, x2) = case eqv [x1, x2] of
Left err -> False
Right (Bool val) -> val | 323 | false | false | 0 | 10 | 161 | 125 | 62 | 63 | null | null |
GaloisInc/halvm-ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | fingerprintDataConName :: Name
fingerprintDataConName =
dcQual gHC_FINGERPRINT_TYPE (fsLit "Fingerprint") fingerprintDataConKey | 131 | fingerprintDataConName :: Name
fingerprintDataConName =
dcQual gHC_FINGERPRINT_TYPE (fsLit "Fingerprint") fingerprintDataConKey | 131 | fingerprintDataConName =
dcQual gHC_FINGERPRINT_TYPE (fsLit "Fingerprint") fingerprintDataConKey | 100 | false | true | 0 | 7 | 13 | 31 | 13 | 18 | null | null |
sdiehl/ghc | compiler/basicTypes/Unique.hs | bsd-3-clause | initExitJoinUnique :: Unique
initExitJoinUnique = mkUnique 's' 0 | 64 | initExitJoinUnique :: Unique
initExitJoinUnique = mkUnique 's' 0 | 64 | initExitJoinUnique = mkUnique 's' 0 | 35 | false | true | 0 | 6 | 7 | 22 | 9 | 13 | null | null |
mcschroeder/ghc | compiler/basicTypes/Id.hs | bsd-3-clause | {-
Make some local @Ids@ for a template @CoreExpr@. These have bogus
@Uniques@, but that's OK because the templates are supposed to be
instantiated before use.
-}
-- | Workers get local names. "CoreTidy" will externalise these if necessary
mkWorkerId :: Unique -> Id -> Type -> Id
mkWorkerId uniq unwrkr ty
= mkLocalIdOrCoVar (mkDerivedInternalName mkWorkerOcc uniq (getName unwrkr)) ty | 390 | mkWorkerId :: Unique -> Id -> Type -> Id
mkWorkerId uniq unwrkr ty
= mkLocalIdOrCoVar (mkDerivedInternalName mkWorkerOcc uniq (getName unwrkr)) ty | 148 | mkWorkerId uniq unwrkr ty
= mkLocalIdOrCoVar (mkDerivedInternalName mkWorkerOcc uniq (getName unwrkr)) ty | 107 | true | true | 0 | 9 | 63 | 57 | 28 | 29 | null | null |
yamadapc/haskell-ascii-progress | lib/System/Console/AsciiProgress/Internal.hs | mit | -- |
-- Creates a new empty progress bar info object.
newProgressBarInfo :: Options -> IO ProgressBarInfo
newProgressBarInfo opts = do
chan <- newChan
mcompleted <- newMVar 0
mfirstTick <- newEmptyMVar
return $ ProgressBarInfo opts chan mcompleted mfirstTick
-- |
-- Gets the string to be printed given the options object and a certain stats
-- object representing the rendering moment. | 403 | newProgressBarInfo :: Options -> IO ProgressBarInfo
newProgressBarInfo opts = do
chan <- newChan
mcompleted <- newMVar 0
mfirstTick <- newEmptyMVar
return $ ProgressBarInfo opts chan mcompleted mfirstTick
-- |
-- Gets the string to be printed given the options object and a certain stats
-- object representing the rendering moment. | 349 | newProgressBarInfo opts = do
chan <- newChan
mcompleted <- newMVar 0
mfirstTick <- newEmptyMVar
return $ ProgressBarInfo opts chan mcompleted mfirstTick
-- |
-- Gets the string to be printed given the options object and a certain stats
-- object representing the rendering moment. | 297 | true | true | 0 | 9 | 77 | 71 | 33 | 38 | null | null |
MP2E/xmonad | tests/Properties/Focus.hs | bsd-3-clause | prop_focus_down_local (x :: T) = hidden_spaces (focusDown x) == hidden_spaces x | 79 | prop_focus_down_local (x :: T) = hidden_spaces (focusDown x) == hidden_spaces x | 79 | prop_focus_down_local (x :: T) = hidden_spaces (focusDown x) == hidden_spaces x | 79 | false | false | 0 | 8 | 10 | 32 | 15 | 17 | null | null |
ganeti-github-testing/ganeti-test-1 | src/Ganeti/Query/Instance.hs | bsd-2-clause | -- | Given an incomplete field definition and values that can complete it,
-- return a fully functional FieldData. Cannot work for all cases, should be
-- extended as necessary.
fillIncompleteFields :: (t1 -> t2 -> FieldDefinition,
t1 -> FieldGetter a b,
QffMode)
-> t1
-> t2
-> FieldData a b
fillIncompleteFields (iDef, iGet, mode) firstVal secondVal =
(iDef firstVal secondVal, iGet firstVal, mode) | 515 | fillIncompleteFields :: (t1 -> t2 -> FieldDefinition,
t1 -> FieldGetter a b,
QffMode)
-> t1
-> t2
-> FieldData a b
fillIncompleteFields (iDef, iGet, mode) firstVal secondVal =
(iDef firstVal secondVal, iGet firstVal, mode) | 337 | fillIncompleteFields (iDef, iGet, mode) firstVal secondVal =
(iDef firstVal secondVal, iGet firstVal, mode) | 109 | true | true | 0 | 8 | 178 | 90 | 49 | 41 | null | null |
ihc/futhark | src/Language/Futhark/TypeChecker/Monad.hs | isc | recursionPermitted :: TypeM Bool
recursionPermitted = asks contextPermitRecursion | 81 | recursionPermitted :: TypeM Bool
recursionPermitted = asks contextPermitRecursion | 81 | recursionPermitted = asks contextPermitRecursion | 48 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
rueshyna/gogol | gogol-storage-transfer/gen/Network/Google/StorageTransfer/Types/Product.hs | mpl-2.0 | -- | Error samples.
esErrorLogEntries :: Lens' ErrorSummary [ErrorLogEntry]
esErrorLogEntries
= lens _esErrorLogEntries
(\ s a -> s{_esErrorLogEntries = a})
. _Default
. _Coerce | 197 | esErrorLogEntries :: Lens' ErrorSummary [ErrorLogEntry]
esErrorLogEntries
= lens _esErrorLogEntries
(\ s a -> s{_esErrorLogEntries = a})
. _Default
. _Coerce | 177 | esErrorLogEntries
= lens _esErrorLogEntries
(\ s a -> s{_esErrorLogEntries = a})
. _Default
. _Coerce | 121 | true | true | 2 | 8 | 43 | 57 | 28 | 29 | null | null |
MichaelXavier/vigilance | src/Utils/Vigilance/Config.hs | bsd-2-clause | loadConfig :: FilePath -> IO Config
loadConfig = convertConfig <=< loadRawConfig | 80 | loadConfig :: FilePath -> IO Config
loadConfig = convertConfig <=< loadRawConfig | 80 | loadConfig = convertConfig <=< loadRawConfig | 44 | false | true | 0 | 7 | 10 | 28 | 12 | 16 | null | null |
KommuSoft/dep-software | Dep.Samples.hs | gpl-3.0 | fsm1t "f" T = slm | 17 | fsm1t "f" T = slm | 17 | fsm1t "f" T = slm | 17 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
mkm/sokoban | src/Graph.hs | gpl-3.0 | getId :: (Eq a) => a -> Graph a b -> Maybe Id
getId x graph = (find ((x ==) . getStateData) . getStates) graph >>= return . getStateId | 134 | getId :: (Eq a) => a -> Graph a b -> Maybe Id
getId x graph = (find ((x ==) . getStateData) . getStates) graph >>= return . getStateId | 134 | getId x graph = (find ((x ==) . getStateData) . getStates) graph >>= return . getStateId | 88 | false | true | 0 | 13 | 28 | 78 | 38 | 40 | null | null |
dysinger/amazonka | amazonka-ecs/gen/Network/AWS/ECS/ListContainerInstances.hs | mpl-2.0 | -- | The maximum number of container instance results returned by 'ListContainerInstances' in paginated output. When this parameter is used, 'ListContainerInstances'
-- only returns 'maxResults' results in a single page along with a 'nextToken'
-- response element. The remaining results of the initial request can be seen by
-- sending another 'ListContainerInstances' request with the returned 'nextToken'
-- value. This value can be between 1 and 100. If this parameter is not used,
-- then 'ListContainerInstances' returns up to 100 results and a 'nextToken' value
-- if applicable.
lciMaxResults :: Lens' ListContainerInstances (Maybe Int)
lciMaxResults = lens _lciMaxResults (\s a -> s { _lciMaxResults = a }) | 715 | lciMaxResults :: Lens' ListContainerInstances (Maybe Int)
lciMaxResults = lens _lciMaxResults (\s a -> s { _lciMaxResults = a }) | 128 | lciMaxResults = lens _lciMaxResults (\s a -> s { _lciMaxResults = a }) | 70 | true | true | 1 | 9 | 106 | 57 | 31 | 26 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Unit.hs | mit | isSpellCaster TerranMarine = False | 34 | isSpellCaster TerranMarine = False | 34 | isSpellCaster TerranMarine = False | 34 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
RefactoringTools/HaRe | test/testdata/TypeUtils/Qualified.hs | bsd-3-clause | main = return TypeUtils.C.baz | 29 | main = return TypeUtils.C.baz | 29 | main = return TypeUtils.C.baz | 29 | false | false | 0 | 6 | 3 | 12 | 6 | 6 | null | null |
kawamuray/ganeti | src/Ganeti/OpParams.hs | gpl-2.0 | pNodeName :: Field
pNodeName =
withDoc "A required node name (for single-node LUs)" $
simpleField "node_name" [t| NonEmptyString |] | 135 | pNodeName :: Field
pNodeName =
withDoc "A required node name (for single-node LUs)" $
simpleField "node_name" [t| NonEmptyString |] | 135 | pNodeName =
withDoc "A required node name (for single-node LUs)" $
simpleField "node_name" [t| NonEmptyString |] | 116 | false | true | 0 | 6 | 22 | 27 | 15 | 12 | null | null |
bvdelft/parac2 | src/Language/Java/Paragon/TypeCheck/TypeMap.hs | bsd-3-clause | emptyTM :: TypeMap
emptyTM = TypeMap {
fields = Map.empty,
methods = Map.empty,
constrs = Map.empty,
locks = Map.empty,
policies = Map.empty,
actors = Map.empty,
typemethods = Map.empty,
types = Map.empty,
packages = Map.empty
} | 422 | emptyTM :: TypeMap
emptyTM = TypeMap {
fields = Map.empty,
methods = Map.empty,
constrs = Map.empty,
locks = Map.empty,
policies = Map.empty,
actors = Map.empty,
typemethods = Map.empty,
types = Map.empty,
packages = Map.empty
} | 422 | emptyTM = TypeMap {
fields = Map.empty,
methods = Map.empty,
constrs = Map.empty,
locks = Map.empty,
policies = Map.empty,
actors = Map.empty,
typemethods = Map.empty,
types = Map.empty,
packages = Map.empty
} | 403 | false | true | 0 | 7 | 228 | 85 | 52 | 33 | null | null |
simonmichael/hledger | hledger-lib/Hledger/Data/Dates.hs | gpl-3.0 | nthweekdayofmonthcontaining :: Int -> WeekDay -> Day -> Day
nthweekdayofmonthcontaining n wd d | nthWeekdaySameMonth <= d = nthWeekdaySameMonth
| otherwise = nthWeekdayPrevMonth
where nthWeekdaySameMonth = advancetonthweekday n wd $ startofmonth d
nthWeekdayPrevMonth = advancetonthweekday n wd $ prevmonth d
-- | Advance to nth weekday wd after given start day s
-- Can call error. | 433 | nthweekdayofmonthcontaining :: Int -> WeekDay -> Day -> Day
nthweekdayofmonthcontaining n wd d | nthWeekdaySameMonth <= d = nthWeekdaySameMonth
| otherwise = nthWeekdayPrevMonth
where nthWeekdaySameMonth = advancetonthweekday n wd $ startofmonth d
nthWeekdayPrevMonth = advancetonthweekday n wd $ prevmonth d
-- | Advance to nth weekday wd after given start day s
-- Can call error. | 433 | nthweekdayofmonthcontaining n wd d | nthWeekdaySameMonth <= d = nthWeekdaySameMonth
| otherwise = nthWeekdayPrevMonth
where nthWeekdaySameMonth = advancetonthweekday n wd $ startofmonth d
nthWeekdayPrevMonth = advancetonthweekday n wd $ prevmonth d
-- | Advance to nth weekday wd after given start day s
-- Can call error. | 373 | false | true | 0 | 8 | 106 | 87 | 42 | 45 | null | null |
bjornbm/astro | test/Astro/Time/AtSpec.hs | bsd-3-clause | allIn :: (Eq a, Ord a) => [a] -> [a] -> Bool
allIn xs ys = allIn' (sort xs) (sort ys) | 85 | allIn :: (Eq a, Ord a) => [a] -> [a] -> Bool
allIn xs ys = allIn' (sort xs) (sort ys) | 85 | allIn xs ys = allIn' (sort xs) (sort ys) | 40 | false | true | 0 | 8 | 20 | 62 | 32 | 30 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.