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
shlevy/ghc
compiler/coreSyn/CoreUtils.hs
bsd-3-clause
tryEtaReduce :: [Var] -> CoreExpr -> Maybe CoreExpr tryEtaReduce bndrs body = go (reverse bndrs) body (mkRepReflCo (exprType body)) where incoming_arity = count isId bndrs go :: [Var] -- Binders, innermost first, types [a3,a2,a1] -> CoreExpr -- Of type tr -> Coercion -- Of type tr ~ ts -> Maybe CoreExpr -- Of type a1 -> a2 -> a3 -> ts -- See Note [Eta reduction with casted arguments] -- for why we have an accumulating coercion go [] fun co | ok_fun fun , let used_vars = exprFreeVars fun `unionVarSet` tyCoVarsOfCo co , not (any (`elemVarSet` used_vars) bndrs) = Just (mkCast fun co) -- Check for any of the binders free in the result -- including the accumulated coercion go bs (Tick t e) co | tickishFloatable t = fmap (Tick t) $ go bs e co -- Float app ticks: \x -> Tick t (e x) ==> Tick t e go (b : bs) (App fun arg) co | Just (co', ticks) <- ok_arg b arg co = fmap (flip (foldr mkTick) ticks) $ go bs fun co' -- Float arg ticks: \x -> e (Tick t x) ==> Tick t e go _ _ _ = Nothing -- Failure! --------------- -- Note [Eta reduction conditions] ok_fun (App fun (Type {})) = ok_fun fun ok_fun (Cast fun _) = ok_fun fun ok_fun (Tick _ expr) = ok_fun expr ok_fun (Var fun_id) = ok_fun_id fun_id || all ok_lam bndrs ok_fun _fun = False --------------- ok_fun_id fun = fun_arity fun >= incoming_arity --------------- fun_arity fun -- See Note [Arity care] | isLocalId fun , isStrongLoopBreaker (idOccInfo fun) = 0 | arity > 0 = arity | isEvaldUnfolding (idUnfolding fun) = 1 -- See Note [Eta reduction of an eval'd function] | otherwise = 0 where arity = idArity fun --------------- ok_lam v = isTyVar v || isEvVar v --------------- ok_arg :: Var -- Of type bndr_t -> CoreExpr -- Of type arg_t -> Coercion -- Of kind (t1~t2) -> Maybe (Coercion -- Of type (arg_t -> t1 ~ bndr_t -> t2) -- (and similarly for tyvars, coercion args) , [Tickish Var]) -- See Note [Eta reduction with casted arguments] ok_arg bndr (Type ty) co | Just tv <- getTyVar_maybe ty , bndr == tv = Just (mkHomoForAllCos [tv] co, []) ok_arg bndr (Var v) co | bndr == v = let reflCo = mkRepReflCo (idType bndr) in Just (mkFunCo Representational reflCo co, []) ok_arg bndr (Cast e co_arg) co | (ticks, Var v) <- stripTicksTop tickishFloatable e , bndr == v = Just (mkFunCo Representational (mkSymCo co_arg) co, ticks) -- The simplifier combines multiple casts into one, -- so we can have a simple-minded pattern match here ok_arg bndr (Tick t arg) co | tickishFloatable t, Just (co', ticks) <- ok_arg bndr arg co = Just (co', t:ticks) ok_arg _ _ _ = Nothing {- Note [Eta reduction of an eval'd function] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In Haskell it is not true that f = \x. f x because f might be bottom, and 'seq' can distinguish them. But it *is* true that f = f `seq` \x. f x and we'd like to simplify the latter to the former. This amounts to the rule that * when there is just *one* value argument, * f is not bottom we can eta-reduce \x. f x ===> f This turned up in Trac #7542. ************************************************************************ * * \subsection{Determining non-updatable right-hand-sides} * * ************************************************************************ Top-level constructor applications can usually be allocated statically, but they can't if the constructor, or any of the arguments, come from another DLL (because we can't refer to static labels in other DLLs). If this happens we simply make the RHS into an updatable thunk, and 'execute' it rather than allocating it statically. -} -- | This function is called only on *top-level* right-hand sides. -- Returns @True@ if the RHS can be allocated statically in the output, -- with no thunks involved at all.
4,506
tryEtaReduce :: [Var] -> CoreExpr -> Maybe CoreExpr tryEtaReduce bndrs body = go (reverse bndrs) body (mkRepReflCo (exprType body)) where incoming_arity = count isId bndrs go :: [Var] -- Binders, innermost first, types [a3,a2,a1] -> CoreExpr -- Of type tr -> Coercion -- Of type tr ~ ts -> Maybe CoreExpr -- Of type a1 -> a2 -> a3 -> ts -- See Note [Eta reduction with casted arguments] -- for why we have an accumulating coercion go [] fun co | ok_fun fun , let used_vars = exprFreeVars fun `unionVarSet` tyCoVarsOfCo co , not (any (`elemVarSet` used_vars) bndrs) = Just (mkCast fun co) -- Check for any of the binders free in the result -- including the accumulated coercion go bs (Tick t e) co | tickishFloatable t = fmap (Tick t) $ go bs e co -- Float app ticks: \x -> Tick t (e x) ==> Tick t e go (b : bs) (App fun arg) co | Just (co', ticks) <- ok_arg b arg co = fmap (flip (foldr mkTick) ticks) $ go bs fun co' -- Float arg ticks: \x -> e (Tick t x) ==> Tick t e go _ _ _ = Nothing -- Failure! --------------- -- Note [Eta reduction conditions] ok_fun (App fun (Type {})) = ok_fun fun ok_fun (Cast fun _) = ok_fun fun ok_fun (Tick _ expr) = ok_fun expr ok_fun (Var fun_id) = ok_fun_id fun_id || all ok_lam bndrs ok_fun _fun = False --------------- ok_fun_id fun = fun_arity fun >= incoming_arity --------------- fun_arity fun -- See Note [Arity care] | isLocalId fun , isStrongLoopBreaker (idOccInfo fun) = 0 | arity > 0 = arity | isEvaldUnfolding (idUnfolding fun) = 1 -- See Note [Eta reduction of an eval'd function] | otherwise = 0 where arity = idArity fun --------------- ok_lam v = isTyVar v || isEvVar v --------------- ok_arg :: Var -- Of type bndr_t -> CoreExpr -- Of type arg_t -> Coercion -- Of kind (t1~t2) -> Maybe (Coercion -- Of type (arg_t -> t1 ~ bndr_t -> t2) -- (and similarly for tyvars, coercion args) , [Tickish Var]) -- See Note [Eta reduction with casted arguments] ok_arg bndr (Type ty) co | Just tv <- getTyVar_maybe ty , bndr == tv = Just (mkHomoForAllCos [tv] co, []) ok_arg bndr (Var v) co | bndr == v = let reflCo = mkRepReflCo (idType bndr) in Just (mkFunCo Representational reflCo co, []) ok_arg bndr (Cast e co_arg) co | (ticks, Var v) <- stripTicksTop tickishFloatable e , bndr == v = Just (mkFunCo Representational (mkSymCo co_arg) co, ticks) -- The simplifier combines multiple casts into one, -- so we can have a simple-minded pattern match here ok_arg bndr (Tick t arg) co | tickishFloatable t, Just (co', ticks) <- ok_arg bndr arg co = Just (co', t:ticks) ok_arg _ _ _ = Nothing {- Note [Eta reduction of an eval'd function] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In Haskell it is not true that f = \x. f x because f might be bottom, and 'seq' can distinguish them. But it *is* true that f = f `seq` \x. f x and we'd like to simplify the latter to the former. This amounts to the rule that * when there is just *one* value argument, * f is not bottom we can eta-reduce \x. f x ===> f This turned up in Trac #7542. ************************************************************************ * * \subsection{Determining non-updatable right-hand-sides} * * ************************************************************************ Top-level constructor applications can usually be allocated statically, but they can't if the constructor, or any of the arguments, come from another DLL (because we can't refer to static labels in other DLLs). If this happens we simply make the RHS into an updatable thunk, and 'execute' it rather than allocating it statically. -} -- | This function is called only on *top-level* right-hand sides. -- Returns @True@ if the RHS can be allocated statically in the output, -- with no thunks involved at all.
4,506
tryEtaReduce bndrs body = go (reverse bndrs) body (mkRepReflCo (exprType body)) where incoming_arity = count isId bndrs go :: [Var] -- Binders, innermost first, types [a3,a2,a1] -> CoreExpr -- Of type tr -> Coercion -- Of type tr ~ ts -> Maybe CoreExpr -- Of type a1 -> a2 -> a3 -> ts -- See Note [Eta reduction with casted arguments] -- for why we have an accumulating coercion go [] fun co | ok_fun fun , let used_vars = exprFreeVars fun `unionVarSet` tyCoVarsOfCo co , not (any (`elemVarSet` used_vars) bndrs) = Just (mkCast fun co) -- Check for any of the binders free in the result -- including the accumulated coercion go bs (Tick t e) co | tickishFloatable t = fmap (Tick t) $ go bs e co -- Float app ticks: \x -> Tick t (e x) ==> Tick t e go (b : bs) (App fun arg) co | Just (co', ticks) <- ok_arg b arg co = fmap (flip (foldr mkTick) ticks) $ go bs fun co' -- Float arg ticks: \x -> e (Tick t x) ==> Tick t e go _ _ _ = Nothing -- Failure! --------------- -- Note [Eta reduction conditions] ok_fun (App fun (Type {})) = ok_fun fun ok_fun (Cast fun _) = ok_fun fun ok_fun (Tick _ expr) = ok_fun expr ok_fun (Var fun_id) = ok_fun_id fun_id || all ok_lam bndrs ok_fun _fun = False --------------- ok_fun_id fun = fun_arity fun >= incoming_arity --------------- fun_arity fun -- See Note [Arity care] | isLocalId fun , isStrongLoopBreaker (idOccInfo fun) = 0 | arity > 0 = arity | isEvaldUnfolding (idUnfolding fun) = 1 -- See Note [Eta reduction of an eval'd function] | otherwise = 0 where arity = idArity fun --------------- ok_lam v = isTyVar v || isEvVar v --------------- ok_arg :: Var -- Of type bndr_t -> CoreExpr -- Of type arg_t -> Coercion -- Of kind (t1~t2) -> Maybe (Coercion -- Of type (arg_t -> t1 ~ bndr_t -> t2) -- (and similarly for tyvars, coercion args) , [Tickish Var]) -- See Note [Eta reduction with casted arguments] ok_arg bndr (Type ty) co | Just tv <- getTyVar_maybe ty , bndr == tv = Just (mkHomoForAllCos [tv] co, []) ok_arg bndr (Var v) co | bndr == v = let reflCo = mkRepReflCo (idType bndr) in Just (mkFunCo Representational reflCo co, []) ok_arg bndr (Cast e co_arg) co | (ticks, Var v) <- stripTicksTop tickishFloatable e , bndr == v = Just (mkFunCo Representational (mkSymCo co_arg) co, ticks) -- The simplifier combines multiple casts into one, -- so we can have a simple-minded pattern match here ok_arg bndr (Tick t arg) co | tickishFloatable t, Just (co', ticks) <- ok_arg bndr arg co = Just (co', t:ticks) ok_arg _ _ _ = Nothing {- Note [Eta reduction of an eval'd function] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In Haskell it is not true that f = \x. f x because f might be bottom, and 'seq' can distinguish them. But it *is* true that f = f `seq` \x. f x and we'd like to simplify the latter to the former. This amounts to the rule that * when there is just *one* value argument, * f is not bottom we can eta-reduce \x. f x ===> f This turned up in Trac #7542. ************************************************************************ * * \subsection{Determining non-updatable right-hand-sides} * * ************************************************************************ Top-level constructor applications can usually be allocated statically, but they can't if the constructor, or any of the arguments, come from another DLL (because we can't refer to static labels in other DLLs). If this happens we simply make the RHS into an updatable thunk, and 'execute' it rather than allocating it statically. -} -- | This function is called only on *top-level* right-hand sides. -- Returns @True@ if the RHS can be allocated statically in the output, -- with no thunks involved at all.
4,454
false
true
5
12
1,478
909
438
471
null
null
spechub/Hets
SoftFOL/PrintTPTP.hs
gpl-2.0
printCommaSeparated :: [SPTerm] -> Doc printCommaSeparated = sepByCommas . map printTPTP
88
printCommaSeparated :: [SPTerm] -> Doc printCommaSeparated = sepByCommas . map printTPTP
88
printCommaSeparated = sepByCommas . map printTPTP
49
false
true
1
7
10
33
14
19
null
null
bitemyapp/ghc
compiler/nativeGen/Dwarf/Types.hs
bsd-3-clause
pprSetUnwind _ Sp (_, uw) = pprByte dW_CFA_def_cfa_expression $$ pprUnwindExpr False uw
92
pprSetUnwind _ Sp (_, uw) = pprByte dW_CFA_def_cfa_expression $$ pprUnwindExpr False uw
92
pprSetUnwind _ Sp (_, uw) = pprByte dW_CFA_def_cfa_expression $$ pprUnwindExpr False uw
92
false
false
0
6
16
31
15
16
null
null
facebookincubator/duckling
Duckling/Distance/PT/Corpus.hs
bsd-3-clause
corpus :: Corpus corpus = (testContext {locale = makeLocale PT Nothing}, testOptions, allExamples)
98
corpus :: Corpus corpus = (testContext {locale = makeLocale PT Nothing}, testOptions, allExamples)
98
corpus = (testContext {locale = makeLocale PT Nothing}, testOptions, allExamples)
81
false
true
0
8
12
33
19
14
null
null
ankhers/haskell-ide-engine
hie-plugin-api/Haskell/Ide/Engine/MonadFunctions.hs
bsd-3-clause
-- | Set the global format used for log timestamps. setLogTimeFormat :: String -> IO () setLogTimeFormat = atomicWriteIORef logTimeFormat
137
setLogTimeFormat :: String -> IO () setLogTimeFormat = atomicWriteIORef logTimeFormat
85
setLogTimeFormat = atomicWriteIORef logTimeFormat
49
true
true
0
7
19
24
12
12
null
null
edsko/hackage-server
Distribution/Server/Util/CabalRevisions.hs
bsd-3-clause
checkForeignLib :: ComponentName -> Check ForeignLib checkForeignLib componentName (ForeignLib nameA typeA optionsA buildInfoA verA verLinuxA modDefA) (ForeignLib nameB typeB optionsB buildInfoB verB verLinuxB modDefB) = do checkSame "Cannot change the foreign library name" nameA nameB checkSame "Cannot change the foreign library type" typeA typeB checkSame "Cannot change the foreign library options" optionsA optionsB checkSame "Cannot change the foreign library version" verA verB checkSame "Cannot change the foreign library version for Linux" verLinuxA verLinuxB checkSame "Cannot change the module definition files" modDefA modDefB checkBuildInfo componentName buildInfoA buildInfoB
730
checkForeignLib :: ComponentName -> Check ForeignLib checkForeignLib componentName (ForeignLib nameA typeA optionsA buildInfoA verA verLinuxA modDefA) (ForeignLib nameB typeB optionsB buildInfoB verB verLinuxB modDefB) = do checkSame "Cannot change the foreign library name" nameA nameB checkSame "Cannot change the foreign library type" typeA typeB checkSame "Cannot change the foreign library options" optionsA optionsB checkSame "Cannot change the foreign library version" verA verB checkSame "Cannot change the foreign library version for Linux" verLinuxA verLinuxB checkSame "Cannot change the module definition files" modDefA modDefB checkBuildInfo componentName buildInfoA buildInfoB
730
checkForeignLib componentName (ForeignLib nameA typeA optionsA buildInfoA verA verLinuxA modDefA) (ForeignLib nameB typeB optionsB buildInfoB verB verLinuxB modDefB) = do checkSame "Cannot change the foreign library name" nameA nameB checkSame "Cannot change the foreign library type" typeA typeB checkSame "Cannot change the foreign library options" optionsA optionsB checkSame "Cannot change the foreign library version" verA verB checkSame "Cannot change the foreign library version for Linux" verLinuxA verLinuxB checkSame "Cannot change the module definition files" modDefA modDefB checkBuildInfo componentName buildInfoA buildInfoB
677
false
true
0
7
125
131
58
73
null
null
MfesGA/Smtlib
Smtlib/Parsers/CommonParsers.hs
mit
bin :: ParsecT String u Identity Char bin = char '0' <|> char '1'
65
bin :: ParsecT String u Identity Char bin = char '0' <|> char '1'
65
bin = char '0' <|> char '1'
27
false
true
0
6
13
30
14
16
null
null
mgsloan/slogger
Slog.hs
bsd-3-clause
getNextId :: MonadIO m => SloggerT m LogId getNextId = do ref <- SloggerT (gets nextIdRef) liftIO $ atomicModifyIORef ref (\i -> (i + 1, i))
148
getNextId :: MonadIO m => SloggerT m LogId getNextId = do ref <- SloggerT (gets nextIdRef) liftIO $ atomicModifyIORef ref (\i -> (i + 1, i))
148
getNextId = do ref <- SloggerT (gets nextIdRef) liftIO $ atomicModifyIORef ref (\i -> (i + 1, i))
105
false
true
0
13
33
75
35
40
null
null
Megaleo/Minehack
src/Tile.hs
bsd-3-clause
isTileMob tile = isTileMob $ mainTile tile
49
isTileMob tile = isTileMob $ mainTile tile
49
isTileMob tile = isTileMob $ mainTile tile
49
false
false
0
6
13
16
7
9
null
null
enolan/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LAnd (ITFixed ty)) [x, y] = bitOp v "And" ty [x, y]
59
doOp v (LAnd (ITFixed ty)) [x, y] = bitOp v "And" ty [x, y]
59
doOp v (LAnd (ITFixed ty)) [x, y] = bitOp v "And" ty [x, y]
59
false
false
1
9
13
49
24
25
null
null
danr/hipspec
examples/old-examples/quickspec/ProductiveUseOfFailure.hs
gpl-3.0
prop_T39 :: Nat -> Nat -> [Nat] -> Prop Bool prop_T39 x y z = proveBool (x `elem` drop y z --> x `elem` z)
107
prop_T39 :: Nat -> Nat -> [Nat] -> Prop Bool prop_T39 x y z = proveBool (x `elem` drop y z --> x `elem` z)
107
prop_T39 x y z = proveBool (x `elem` drop y z --> x `elem` z)
62
false
true
0
10
25
63
33
30
null
null
ownclo/jpeg-on-steroids
src/Graphics/JPG/Decoder.hs
bsd-3-clause
getMaxSampFactors :: [FullCompSpec] -> (Int, Int) getMaxSampFactors fullCompSpecs = (maxYsf, maxXsf) where maxYsf = fI . maximum $! map (getY . getSF) fullCompSpecs maxXsf = fI . maximum $! map (getX . getSF) fullCompSpecs getSF (FullCompSpec (FrameCompSpec _ sf _) _) = sf
285
getMaxSampFactors :: [FullCompSpec] -> (Int, Int) getMaxSampFactors fullCompSpecs = (maxYsf, maxXsf) where maxYsf = fI . maximum $! map (getY . getSF) fullCompSpecs maxXsf = fI . maximum $! map (getX . getSF) fullCompSpecs getSF (FullCompSpec (FrameCompSpec _ sf _) _) = sf
285
getMaxSampFactors fullCompSpecs = (maxYsf, maxXsf) where maxYsf = fI . maximum $! map (getY . getSF) fullCompSpecs maxXsf = fI . maximum $! map (getX . getSF) fullCompSpecs getSF (FullCompSpec (FrameCompSpec _ sf _) _) = sf
235
false
true
0
11
54
111
59
52
null
null
kmate/HaRe
old/editors/GenEditorInterfaces.hs
bsd-3-clause
hereToLet :: String -> Int -> Int -> IO () whereToLet f re ce = putStrLn $ ">whereToLet: " ++ f ++ " line: " ++ show re ++ " column: " ++ show ce
150
whereToLet :: String -> Int -> Int -> IO () whereToLet f re ce = putStrLn $ ">whereToLet: " ++ f ++ " line: " ++ show re ++ " column: " ++ show ce
150
whereToLet f re ce = putStrLn $ ">whereToLet: " ++ f ++ " line: " ++ show re ++ " column: " ++ show ce
106
false
true
2
9
39
66
31
35
null
null
Michaelt293/Lipid-Haskell
src/Lipid/Parsers/KnownSn/Glycerolipid.hs
gpl-3.0
dgMaybeOmegaP :: Parser (DG (Maybe OmegaPosition)) dgMaybeOmegaP = dgP radylMaybeOmegaP
87
dgMaybeOmegaP :: Parser (DG (Maybe OmegaPosition)) dgMaybeOmegaP = dgP radylMaybeOmegaP
87
dgMaybeOmegaP = dgP radylMaybeOmegaP
36
false
true
0
9
9
29
14
15
null
null
glguy/tt-ratings
server.hs
bsd-3-clause
defaultHandler :: Handler App App () defaultHandler = sendHtml =<< matchEntryPage Nothing "" "1" "" "0"
103
defaultHandler :: Handler App App () defaultHandler = sendHtml =<< matchEntryPage Nothing "" "1" "" "0"
103
defaultHandler = sendHtml =<< matchEntryPage Nothing "" "1" "" "0"
66
false
true
0
6
15
35
17
18
null
null
kyagrd/micronax
src/Parser.hs
bsd-2-clause
tm2Term (S.Alt Nothing cs) = Alt [ Case (UIdent c) (map (LIdent . show) as) (tm2Term e) | (c,(as,e)) <- map (\(nm,bnd) -> (show nm, unsafeUnbind bnd)) cs ]
163
tm2Term (S.Alt Nothing cs) = Alt [ Case (UIdent c) (map (LIdent . show) as) (tm2Term e) | (c,(as,e)) <- map (\(nm,bnd) -> (show nm, unsafeUnbind bnd)) cs ]
163
tm2Term (S.Alt Nothing cs) = Alt [ Case (UIdent c) (map (LIdent . show) as) (tm2Term e) | (c,(as,e)) <- map (\(nm,bnd) -> (show nm, unsafeUnbind bnd)) cs ]
163
false
false
0
13
36
110
58
52
null
null
DougBurke/swish
tests/RDFProofTest.hs
lgpl-2.1
rul11 :: RDFRule rul11 = makeN3ClosureSimpleRule scope1 "rul11" query11str result11str
86
rul11 :: RDFRule rul11 = makeN3ClosureSimpleRule scope1 "rul11" query11str result11str
86
rul11 = makeN3ClosureSimpleRule scope1 "rul11" query11str result11str
69
false
true
0
5
9
20
10
10
null
null
bos/statistics
Statistics/Distribution/StudentT.hs
bsd-2-clause
cumulative :: StudentT -> Double -> Double cumulative (StudentT ndf) x | x > 0 = 1 - 0.5 * ibeta | otherwise = 0.5 * ibeta where ibeta = incompleteBeta (0.5 * ndf) 0.5 (ndf / (ndf + x*x))
201
cumulative :: StudentT -> Double -> Double cumulative (StudentT ndf) x | x > 0 = 1 - 0.5 * ibeta | otherwise = 0.5 * ibeta where ibeta = incompleteBeta (0.5 * ndf) 0.5 (ndf / (ndf + x*x))
201
cumulative (StudentT ndf) x | x > 0 = 1 - 0.5 * ibeta | otherwise = 0.5 * ibeta where ibeta = incompleteBeta (0.5 * ndf) 0.5 (ndf / (ndf + x*x))
158
false
true
1
10
53
99
50
49
null
null
ekmett/hmpfr
src/Data/Number/MPFR/Arithmetic.hs
bsd-3-clause
divi_ :: RoundMode -> Precision -> MPFR -> Int -> (MPFR, Int) divi_ r p d1 d = withMPFRBAsi r p d1 (fromIntegral d) mpfr_div_si
136
divi_ :: RoundMode -> Precision -> MPFR -> Int -> (MPFR, Int) divi_ r p d1 d = withMPFRBAsi r p d1 (fromIntegral d) mpfr_div_si
136
divi_ r p d1 d = withMPFRBAsi r p d1 (fromIntegral d) mpfr_div_si
65
false
true
0
11
33
64
31
33
null
null
SAdams601/HaRe
old/testing/introNewDef/Oops.hs
bsd-3-clause
-- highlight >x +< in f, then select IntroNewDef main = print ((f 1) 2, gaga True) where f x y = x + y gaga h = ("g: " ++) (show h)
143
main = print ((f 1) 2, gaga True) where f x y = x + y gaga h = ("g: " ++) (show h)
93
main = print ((f 1) 2, gaga True) where f x y = x + y gaga h = ("g: " ++) (show h)
93
true
false
5
8
44
77
33
44
null
null
jwvg0425/d3d11binding
examples/Cube.hs
mit
windowWidth :: (Num a) => a windowWidth = 640
45
windowWidth :: (Num a) => a windowWidth = 640
45
windowWidth = 640
17
false
true
0
7
8
27
12
15
null
null
olsner/ghc
compiler/basicTypes/Module.hs
bsd-3-clause
plusModuleEnv :: ModuleEnv a -> ModuleEnv a -> ModuleEnv a plusModuleEnv (ModuleEnv e1) (ModuleEnv e2) = ModuleEnv (Map.union e1 e2)
132
plusModuleEnv :: ModuleEnv a -> ModuleEnv a -> ModuleEnv a plusModuleEnv (ModuleEnv e1) (ModuleEnv e2) = ModuleEnv (Map.union e1 e2)
132
plusModuleEnv (ModuleEnv e1) (ModuleEnv e2) = ModuleEnv (Map.union e1 e2)
73
false
true
0
8
19
58
27
31
null
null
keithodulaigh/Hets
HasCASL/Subst.hs
gpl-2.0
substLetEq :: ProgEq -> State Subst ProgEq substLetEq (ProgEq lh rh rg) = do s <- get let scs = map toSC (Set.toList $ freeVars lh) ++ mapMaybe toSConst (Set.toList $ opsInTerm lh) {- IMPORTANT REMARK: The ops contain also constructors which are used to form patterns. These constructors shouldn't be substituted at all, so it should be no problem if we remove them from the substitution. -} put $ inScope scs $ removeListC s scs return (ProgEq lh (subst s rh) rg)
492
substLetEq :: ProgEq -> State Subst ProgEq substLetEq (ProgEq lh rh rg) = do s <- get let scs = map toSC (Set.toList $ freeVars lh) ++ mapMaybe toSConst (Set.toList $ opsInTerm lh) {- IMPORTANT REMARK: The ops contain also constructors which are used to form patterns. These constructors shouldn't be substituted at all, so it should be no problem if we remove them from the substitution. -} put $ inScope scs $ removeListC s scs return (ProgEq lh (subst s rh) rg)
492
substLetEq (ProgEq lh rh rg) = do s <- get let scs = map toSC (Set.toList $ freeVars lh) ++ mapMaybe toSConst (Set.toList $ opsInTerm lh) {- IMPORTANT REMARK: The ops contain also constructors which are used to form patterns. These constructors shouldn't be substituted at all, so it should be no problem if we remove them from the substitution. -} put $ inScope scs $ removeListC s scs return (ProgEq lh (subst s rh) rg)
449
false
true
0
15
110
136
62
74
null
null
abhin4v/hastron
src/Hastron/Game/Engine.hs
mit
turn :: (Direction -> Direction) -> GameEngine () turn turnFn = modify . second $ \player@Player{ playerVelocity = Velocity speed dir } -> player { playerVelocity = Velocity speed $ turnFn dir }
196
turn :: (Direction -> Direction) -> GameEngine () turn turnFn = modify . second $ \player@Player{ playerVelocity = Velocity speed dir } -> player { playerVelocity = Velocity speed $ turnFn dir }
196
turn turnFn = modify . second $ \player@Player{ playerVelocity = Velocity speed dir } -> player { playerVelocity = Velocity speed $ turnFn dir }
146
false
true
0
11
34
78
40
38
null
null
frantisekfarka/ghc-dsi
compiler/vectorise/Vectorise/Convert.hs
bsd-3-clause
identityConv (LitTy {}) = noV $ text "identityConv: not sure about literal types under vectorisation"
104
identityConv (LitTy {}) = noV $ text "identityConv: not sure about literal types under vectorisation"
104
identityConv (LitTy {}) = noV $ text "identityConv: not sure about literal types under vectorisation"
104
false
false
0
7
17
23
11
12
null
null
roldugin/LiveFusion
Data/LiveFusion/Loop/Expr.hs
bsd-3-clause
fun6 :: (Elt a, Elt b, Elt c, Elt d, Elt e, Elt f, Elt g) => (Term a -> Term b -> Term c -> Term d -> Term e -> Term f -> Term g) -> Var -> Var -> Var -> Var -> Var -> Var -> Expr fun6 fun a b c d e f = foldl apply (TermE (lam6 fun)) [a,b,c,d,e,f] where apply :: Expr -> Var -> Expr apply e v = e `AppE` (VarE v) -- | This can go as soon as we make internal scalar language fully typed
407
fun6 :: (Elt a, Elt b, Elt c, Elt d, Elt e, Elt f, Elt g) => (Term a -> Term b -> Term c -> Term d -> Term e -> Term f -> Term g) -> Var -> Var -> Var -> Var -> Var -> Var -> Expr fun6 fun a b c d e f = foldl apply (TermE (lam6 fun)) [a,b,c,d,e,f] where apply :: Expr -> Var -> Expr apply e v = e `AppE` (VarE v) -- | This can go as soon as we make internal scalar language fully typed
407
fun6 fun a b c d e f = foldl apply (TermE (lam6 fun)) [a,b,c,d,e,f] where apply :: Expr -> Var -> Expr apply e v = e `AppE` (VarE v) -- | This can go as soon as we make internal scalar language fully typed
217
false
true
0
15
118
234
115
119
null
null
AKST/Data-mining
haskell/src/Localise.hs
mit
defaultLocaliseState :: LocaliseState defaultLocaliseState = LocaliseState { _scoreCount = Map.empty , _topScore = Nothing }
132
defaultLocaliseState :: LocaliseState defaultLocaliseState = LocaliseState { _scoreCount = Map.empty , _topScore = Nothing }
132
defaultLocaliseState = LocaliseState { _scoreCount = Map.empty , _topScore = Nothing }
94
false
true
0
7
22
27
16
11
null
null
imalsogreg/arte-ephys
arte-spike-viewer/src/System/Arte/SpikeViewer.hs
gpl-3.0
cyan' = PixelRGBA8 255 255 255 0
35
cyan' = PixelRGBA8 255 255 255 0
35
cyan' = PixelRGBA8 255 255 255 0
35
false
false
1
5
9
18
7
11
null
null
oldmanmike/ghc
compiler/parser/ApiAnnotation.hs
bsd-3-clause
unicodeAnn Annrarrowtail = AnnrarrowtailU
41
unicodeAnn Annrarrowtail = AnnrarrowtailU
41
unicodeAnn Annrarrowtail = AnnrarrowtailU
41
false
false
0
5
3
9
4
5
null
null
lupuionut/homedmanager
src/Auth.hs
bsd-3-clause
grantWithCode (Just c) = do response <- doRequest (Config.authTokenUrl c) c [ ("grant_type", Just "authorization_code"), ("code", Just (C8.pack $ Config.authCode c)), ("client_id", Just (C8.pack $ Config.client_id c)), ("client_secret", Just (C8.pack $ Config.client_secret c))] case response of Left err -> fail err Right r -> return $ pure r -- | retrieve access_token using stored refresh token from the tokens.cache file -- https://dev.strato.com/hidrive/content.php?r=150--OAuth2-Authentication#token
661
grantWithCode (Just c) = do response <- doRequest (Config.authTokenUrl c) c [ ("grant_type", Just "authorization_code"), ("code", Just (C8.pack $ Config.authCode c)), ("client_id", Just (C8.pack $ Config.client_id c)), ("client_secret", Just (C8.pack $ Config.client_secret c))] case response of Left err -> fail err Right r -> return $ pure r -- | retrieve access_token using stored refresh token from the tokens.cache file -- https://dev.strato.com/hidrive/content.php?r=150--OAuth2-Authentication#token
661
grantWithCode (Just c) = do response <- doRequest (Config.authTokenUrl c) c [ ("grant_type", Just "authorization_code"), ("code", Just (C8.pack $ Config.authCode c)), ("client_id", Just (C8.pack $ Config.client_id c)), ("client_secret", Just (C8.pack $ Config.client_secret c))] case response of Left err -> fail err Right r -> return $ pure r -- | retrieve access_token using stored refresh token from the tokens.cache file -- https://dev.strato.com/hidrive/content.php?r=150--OAuth2-Authentication#token
661
false
false
0
15
217
164
83
81
null
null
shlevy/ghc
compiler/main/TidyPgm.hs
bsd-3-clause
tidyTopName :: Module -> IORef NameCache -> Maybe Id -> TidyOccEnv -> Id -> IO (TidyOccEnv, Name) tidyTopName mod nc_var maybe_ref occ_env id | global && internal = return (occ_env, localiseName name) | global && external = return (occ_env, name) -- Global names are assumed to have been allocated by the renamer, -- so they already have the "right" unique -- And it's a system-wide unique too -- Now we get to the real reason that all this is in the IO Monad: -- we have to update the name cache in a nice atomic fashion | local && internal = do { new_local_name <- atomicModifyIORef' nc_var mk_new_local ; return (occ_env', new_local_name) } -- Even local, internal names must get a unique occurrence, because -- if we do -split-objs we externalise the name later, in the code generator -- -- Similarly, we must make sure it has a system-wide Unique, because -- the byte-code generator builds a system-wide Name->BCO symbol table | local && external = do { new_external_name <- atomicModifyIORef' nc_var mk_new_external ; return (occ_env', new_external_name) } | otherwise = panic "tidyTopName" where name = idName id external = isJust maybe_ref global = isExternalName name local = not global internal = not external loc = nameSrcSpan name old_occ = nameOccName name new_occ | Just ref <- maybe_ref , ref /= id = mkOccName (occNameSpace old_occ) $ let ref_str = occNameString (getOccName ref) occ_str = occNameString old_occ in case occ_str of '$':'w':_ -> occ_str -- workers: the worker for a function already -- includes the occname for its parent, so there's -- no need to prepend the referrer. _other | isSystemName name -> ref_str | otherwise -> ref_str ++ '_' : occ_str -- If this name was system-generated, then don't bother -- to retain its OccName, just use the referrer. These -- system-generated names will become "f1", "f2", etc. for -- a referrer "f". | otherwise = old_occ (occ_env', occ') = tidyOccName occ_env new_occ mk_new_local nc = (nc { nsUniqs = us }, mkInternalName uniq occ' loc) where (uniq, us) = takeUniqFromSupply (nsUniqs nc) mk_new_external nc = allocateGlobalBinder nc mod occ' loc -- If we want to externalise a currently-local name, check -- whether we have already assigned a unique for it. -- If so, use it; if not, extend the table. -- All this is done by allcoateGlobalBinder. -- This is needed when *re*-compiling a module in GHCi; we must -- use the same name for externally-visible things as we did before. {- ************************************************************************ * * \subsection{Step 2: top-level tidying} * * ************************************************************************ -} -- TopTidyEnv: when tidying we need to know -- * nc_var: The NameCache, containing a unique supply and any pre-ordained Names. -- These may have arisen because the -- renamer read in an interface file mentioning M.$wf, say, -- and assigned it unique r77. If, on this compilation, we've -- invented an Id whose name is $wf (but with a different unique) -- we want to rename it to have unique r77, so that we can do easy -- comparisons with stuff from the interface file -- -- * occ_env: The TidyOccEnv, which tells us which local occurrences -- are 'used' -- -- * subst_env: A Var->Var mapping that substitutes the new Var for the old
4,190
tidyTopName :: Module -> IORef NameCache -> Maybe Id -> TidyOccEnv -> Id -> IO (TidyOccEnv, Name) tidyTopName mod nc_var maybe_ref occ_env id | global && internal = return (occ_env, localiseName name) | global && external = return (occ_env, name) -- Global names are assumed to have been allocated by the renamer, -- so they already have the "right" unique -- And it's a system-wide unique too -- Now we get to the real reason that all this is in the IO Monad: -- we have to update the name cache in a nice atomic fashion | local && internal = do { new_local_name <- atomicModifyIORef' nc_var mk_new_local ; return (occ_env', new_local_name) } -- Even local, internal names must get a unique occurrence, because -- if we do -split-objs we externalise the name later, in the code generator -- -- Similarly, we must make sure it has a system-wide Unique, because -- the byte-code generator builds a system-wide Name->BCO symbol table | local && external = do { new_external_name <- atomicModifyIORef' nc_var mk_new_external ; return (occ_env', new_external_name) } | otherwise = panic "tidyTopName" where name = idName id external = isJust maybe_ref global = isExternalName name local = not global internal = not external loc = nameSrcSpan name old_occ = nameOccName name new_occ | Just ref <- maybe_ref , ref /= id = mkOccName (occNameSpace old_occ) $ let ref_str = occNameString (getOccName ref) occ_str = occNameString old_occ in case occ_str of '$':'w':_ -> occ_str -- workers: the worker for a function already -- includes the occname for its parent, so there's -- no need to prepend the referrer. _other | isSystemName name -> ref_str | otherwise -> ref_str ++ '_' : occ_str -- If this name was system-generated, then don't bother -- to retain its OccName, just use the referrer. These -- system-generated names will become "f1", "f2", etc. for -- a referrer "f". | otherwise = old_occ (occ_env', occ') = tidyOccName occ_env new_occ mk_new_local nc = (nc { nsUniqs = us }, mkInternalName uniq occ' loc) where (uniq, us) = takeUniqFromSupply (nsUniqs nc) mk_new_external nc = allocateGlobalBinder nc mod occ' loc -- If we want to externalise a currently-local name, check -- whether we have already assigned a unique for it. -- If so, use it; if not, extend the table. -- All this is done by allcoateGlobalBinder. -- This is needed when *re*-compiling a module in GHCi; we must -- use the same name for externally-visible things as we did before. {- ************************************************************************ * * \subsection{Step 2: top-level tidying} * * ************************************************************************ -} -- TopTidyEnv: when tidying we need to know -- * nc_var: The NameCache, containing a unique supply and any pre-ordained Names. -- These may have arisen because the -- renamer read in an interface file mentioning M.$wf, say, -- and assigned it unique r77. If, on this compilation, we've -- invented an Id whose name is $wf (but with a different unique) -- we want to rename it to have unique r77, so that we can do easy -- comparisons with stuff from the interface file -- -- * occ_env: The TidyOccEnv, which tells us which local occurrences -- are 'used' -- -- * subst_env: A Var->Var mapping that substitutes the new Var for the old
4,190
tidyTopName mod nc_var maybe_ref occ_env id | global && internal = return (occ_env, localiseName name) | global && external = return (occ_env, name) -- Global names are assumed to have been allocated by the renamer, -- so they already have the "right" unique -- And it's a system-wide unique too -- Now we get to the real reason that all this is in the IO Monad: -- we have to update the name cache in a nice atomic fashion | local && internal = do { new_local_name <- atomicModifyIORef' nc_var mk_new_local ; return (occ_env', new_local_name) } -- Even local, internal names must get a unique occurrence, because -- if we do -split-objs we externalise the name later, in the code generator -- -- Similarly, we must make sure it has a system-wide Unique, because -- the byte-code generator builds a system-wide Name->BCO symbol table | local && external = do { new_external_name <- atomicModifyIORef' nc_var mk_new_external ; return (occ_env', new_external_name) } | otherwise = panic "tidyTopName" where name = idName id external = isJust maybe_ref global = isExternalName name local = not global internal = not external loc = nameSrcSpan name old_occ = nameOccName name new_occ | Just ref <- maybe_ref , ref /= id = mkOccName (occNameSpace old_occ) $ let ref_str = occNameString (getOccName ref) occ_str = occNameString old_occ in case occ_str of '$':'w':_ -> occ_str -- workers: the worker for a function already -- includes the occname for its parent, so there's -- no need to prepend the referrer. _other | isSystemName name -> ref_str | otherwise -> ref_str ++ '_' : occ_str -- If this name was system-generated, then don't bother -- to retain its OccName, just use the referrer. These -- system-generated names will become "f1", "f2", etc. for -- a referrer "f". | otherwise = old_occ (occ_env', occ') = tidyOccName occ_env new_occ mk_new_local nc = (nc { nsUniqs = us }, mkInternalName uniq occ' loc) where (uniq, us) = takeUniqFromSupply (nsUniqs nc) mk_new_external nc = allocateGlobalBinder nc mod occ' loc -- If we want to externalise a currently-local name, check -- whether we have already assigned a unique for it. -- If so, use it; if not, extend the table. -- All this is done by allcoateGlobalBinder. -- This is needed when *re*-compiling a module in GHCi; we must -- use the same name for externally-visible things as we did before. {- ************************************************************************ * * \subsection{Step 2: top-level tidying} * * ************************************************************************ -} -- TopTidyEnv: when tidying we need to know -- * nc_var: The NameCache, containing a unique supply and any pre-ordained Names. -- These may have arisen because the -- renamer read in an interface file mentioning M.$wf, say, -- and assigned it unique r77. If, on this compilation, we've -- invented an Id whose name is $wf (but with a different unique) -- we want to rename it to have unique r77, so that we can do easy -- comparisons with stuff from the interface file -- -- * occ_env: The TidyOccEnv, which tells us which local occurrences -- are 'used' -- -- * subst_env: A Var->Var mapping that substitutes the new Var for the old
4,080
false
true
18
16
1,448
474
254
220
null
null
pmiddend/jumpie
research/platform_math_proto.hs
gpl-3.0
grv = 0.21875
13
grv = 0.21875
13
grv = 0.21875
13
false
false
0
4
2
6
3
3
null
null
kliuchnikau/project-euler
045/Main.hs
apache-2.0
main = print $ round $ substituteUnknown (triangle 0.0) (fromIntegral foundNumber) where foundNumber = head $ filter triangleAndPentagonalAndHexagonal [286..]
164
main = print $ round $ substituteUnknown (triangle 0.0) (fromIntegral foundNumber) where foundNumber = head $ filter triangleAndPentagonalAndHexagonal [286..]
164
main = print $ round $ substituteUnknown (triangle 0.0) (fromIntegral foundNumber) where foundNumber = head $ filter triangleAndPentagonalAndHexagonal [286..]
164
false
false
0
8
24
51
25
26
null
null
msakai/icfpc2013
src/GenProgram/BruteForce.hs
bsd-2-clause
ibind :: Gen a -> (a -> Gen a) -> Gen a ibind g f = StateT $ \s -> interleaveN [runStateT (f a) s' | (a, s') <- runStateT g s]
128
ibind :: Gen a -> (a -> Gen a) -> Gen a ibind g f = StateT $ \s -> interleaveN [runStateT (f a) s' | (a, s') <- runStateT g s]
128
ibind g f = StateT $ \s -> interleaveN [runStateT (f a) s' | (a, s') <- runStateT g s]
88
false
true
2
10
33
91
43
48
null
null
danoctavian/shepherd
src/Network/BitTorrent/Shepherd.hs
gpl-2.0
errorCodeToStatus code = case code of INVALID_REQUEST_TYPE -> Status 100 "Invalid Request type" MISSING_INFO_HASH -> Status 101 "Missing info_hash field" MISSING_PEER_ID -> Status 102 "Missing peer_id field" MISSING_PORT -> Status 103 "Missing port field" INVALID_INFO_HASH -> Status 150 $ DBC.pack $ "info_hash is not " ++ (show infoHashLen) ++ " bytes" INVALID_PEER_ID -> Status 151 $ DBC.pack $ "peer_id is not " ++ (show peerIdLen) ++ " bytes" INVALID_NUMWANT -> Status 152 $ DBC.pack $ "peers more than " ++ (show maxAllowedPeers) ++ " is not allowed" GENERIC_ERROR -> Status 900 $ DBC.pack $ "Error in request"
672
errorCodeToStatus code = case code of INVALID_REQUEST_TYPE -> Status 100 "Invalid Request type" MISSING_INFO_HASH -> Status 101 "Missing info_hash field" MISSING_PEER_ID -> Status 102 "Missing peer_id field" MISSING_PORT -> Status 103 "Missing port field" INVALID_INFO_HASH -> Status 150 $ DBC.pack $ "info_hash is not " ++ (show infoHashLen) ++ " bytes" INVALID_PEER_ID -> Status 151 $ DBC.pack $ "peer_id is not " ++ (show peerIdLen) ++ " bytes" INVALID_NUMWANT -> Status 152 $ DBC.pack $ "peers more than " ++ (show maxAllowedPeers) ++ " is not allowed" GENERIC_ERROR -> Status 900 $ DBC.pack $ "Error in request"
672
errorCodeToStatus code = case code of INVALID_REQUEST_TYPE -> Status 100 "Invalid Request type" MISSING_INFO_HASH -> Status 101 "Missing info_hash field" MISSING_PEER_ID -> Status 102 "Missing peer_id field" MISSING_PORT -> Status 103 "Missing port field" INVALID_INFO_HASH -> Status 150 $ DBC.pack $ "info_hash is not " ++ (show infoHashLen) ++ " bytes" INVALID_PEER_ID -> Status 151 $ DBC.pack $ "peer_id is not " ++ (show peerIdLen) ++ " bytes" INVALID_NUMWANT -> Status 152 $ DBC.pack $ "peers more than " ++ (show maxAllowedPeers) ++ " is not allowed" GENERIC_ERROR -> Status 900 $ DBC.pack $ "Error in request"
672
false
false
1
12
152
179
83
96
null
null
alexbaluta/courseography
app/Css/Constants.hs
gpl-3.0
{- Node and rectangle constants, - including sizes, strokes, fills, - opacities, colors and alignments. -} -- Stroke & fill fill :: Text -> Css fill = (-:) "fill"
165
fill :: Text -> Css fill = (-:) "fill"
38
fill = (-:) "fill"
18
true
true
0
7
31
28
14
14
null
null
fizruk/replay-free
examples/AskForkHalt.hs
bsd-3-clause
-- | Halt computation. halt :: MonadFree F m => m a halt = liftF Halt
69
halt :: MonadFree F m => m a halt = liftF Halt
46
halt = liftF Halt
17
true
true
0
7
15
33
14
19
null
null
petabricks/petabricks
scripts/oldtuner2/src/Main.hs
mit
printOption :: Show a => String -> a -> IO () printOption msg = (printString msg) . show
88
printOption :: Show a => String -> a -> IO () printOption msg = (printString msg) . show
88
printOption msg = (printString msg) . show
42
false
true
0
10
17
49
22
27
null
null
iteratee/haskell-tracker
PeerFinderTest.hs
mit
prop_get_correct_peers :: RandomPeerList -> Gen Bool prop_get_correct_peers rpl = do (peers, _, count) <- getSomePeers rpl return $ length peers == min count (peerSize rpl)
176
prop_get_correct_peers :: RandomPeerList -> Gen Bool prop_get_correct_peers rpl = do (peers, _, count) <- getSomePeers rpl return $ length peers == min count (peerSize rpl)
176
prop_get_correct_peers rpl = do (peers, _, count) <- getSomePeers rpl return $ length peers == min count (peerSize rpl)
123
false
true
0
11
28
70
32
38
null
null
fpco/cabal
Cabal/Distribution/PackageDescription/Configuration.hs
bsd-3-clause
toDepMap :: [Dependency] -> DependencyMap toDepMap ds = DependencyMap $ fromListWith intersectVersionRanges [ (p,vr) | Dependency p vr <- ds ]
144
toDepMap :: [Dependency] -> DependencyMap toDepMap ds = DependencyMap $ fromListWith intersectVersionRanges [ (p,vr) | Dependency p vr <- ds ]
144
toDepMap ds = DependencyMap $ fromListWith intersectVersionRanges [ (p,vr) | Dependency p vr <- ds ]
102
false
true
2
9
22
58
28
30
null
null
PierreR/basic-prelude
test-is-a-prelude.hs
mit
odd = P.odd
11
odd = P.odd
11
odd = P.odd
11
false
false
1
6
2
12
4
8
null
null
helino/wham
src/Wham/SignExc.hs
bsd-3-clause
NonNegative `add` NonNegative = NonNegative
43
NonNegative `add` NonNegative = NonNegative
43
NonNegative `add` NonNegative = NonNegative
43
false
false
0
5
4
14
7
7
null
null
brendanhay/gogol
gogol-cloudkms/gen/Network/Google/CloudKMS/Types/Product.hs
mpl-2.0
-- | Specifies the identities requesting access for a Cloud Platform -- resource. \`members\` can have the following values: * \`allUsers\`: A -- special identifier that represents anyone who is on the internet; with -- or without a Google account. * \`allAuthenticatedUsers\`: A special -- identifier that represents anyone who is authenticated with a Google -- account or a service account. * \`user:{emailid}\`: An email address -- that represents a specific Google account. For example, -- \`alice\'example.com\` . * \`serviceAccount:{emailid}\`: An email -- address that represents a service account. For example, -- \`my-other-app\'appspot.gserviceaccount.com\`. * \`group:{emailid}\`: An -- email address that represents a Google group. For example, -- \`admins\'example.com\`. * \`deleted:user:{emailid}?uid={uniqueid}\`: An -- email address (plus unique identifier) representing a user that has been -- recently deleted. For example, -- \`alice\'example.com?uid=123456789012345678901\`. If the user is -- recovered, this value reverts to \`user:{emailid}\` and the recovered -- user retains the role in the binding. * -- \`deleted:serviceAccount:{emailid}?uid={uniqueid}\`: An email address -- (plus unique identifier) representing a service account that has been -- recently deleted. For example, -- \`my-other-app\'appspot.gserviceaccount.com?uid=123456789012345678901\`. -- If the service account is undeleted, this value reverts to -- \`serviceAccount:{emailid}\` and the undeleted service account retains -- the role in the binding. * \`deleted:group:{emailid}?uid={uniqueid}\`: -- An email address (plus unique identifier) representing a Google group -- that has been recently deleted. For example, -- \`admins\'example.com?uid=123456789012345678901\`. If the group is -- recovered, this value reverts to \`group:{emailid}\` and the recovered -- group retains the role in the binding. * \`domain:{domain}\`: The G -- Suite domain (primary) that represents all the users of that domain. For -- example, \`google.com\` or \`example.com\`. bMembers :: Lens' Binding [Text] bMembers = lens _bMembers (\ s a -> s{_bMembers = a}) . _Default . _Coerce
2,173
bMembers :: Lens' Binding [Text] bMembers = lens _bMembers (\ s a -> s{_bMembers = a}) . _Default . _Coerce
121
bMembers = lens _bMembers (\ s a -> s{_bMembers = a}) . _Default . _Coerce
88
true
true
0
11
301
83
58
25
null
null
elieux/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
mkHsStringPrimLit :: FastString -> HsLit mkHsStringPrimLit fs = HsStringPrim (unpackFS fs) (fastStringToByteString fs)
120
mkHsStringPrimLit :: FastString -> HsLit mkHsStringPrimLit fs = HsStringPrim (unpackFS fs) (fastStringToByteString fs)
120
mkHsStringPrimLit fs = HsStringPrim (unpackFS fs) (fastStringToByteString fs)
79
false
true
0
7
14
42
18
24
null
null
tjakway/ghcjvm
compiler/typecheck/TcGenDeriv.hs
bsd-3-clause
dataCast1_RDR = varQual_RDR gENERICS (fsLit "dataCast1")
58
dataCast1_RDR = varQual_RDR gENERICS (fsLit "dataCast1")
58
dataCast1_RDR = varQual_RDR gENERICS (fsLit "dataCast1")
58
false
false
0
7
7
17
8
9
null
null
zeyuanxy/haskell-playground
write-yourself-a-scheme/chap5/main.hs
mit
equal :: [LispVal] -> ThrowsError LispVal equal [arg1, arg2] = do primitiveEquals <- liftM or $ mapM (unpackEquals arg1 arg2) [AnyUnpacker unpackNum, AnyUnpacker unpackStr, AnyUnpacker unpackBool] eqvEquals <- eqv [arg1, arg2] return $ Bool $ (primitiveEquals || let (Bool x) = eqvEquals in x)
299
equal :: [LispVal] -> ThrowsError LispVal equal [arg1, arg2] = do primitiveEquals <- liftM or $ mapM (unpackEquals arg1 arg2) [AnyUnpacker unpackNum, AnyUnpacker unpackStr, AnyUnpacker unpackBool] eqvEquals <- eqv [arg1, arg2] return $ Bool $ (primitiveEquals || let (Bool x) = eqvEquals in x)
299
equal [arg1, arg2] = do primitiveEquals <- liftM or $ mapM (unpackEquals arg1 arg2) [AnyUnpacker unpackNum, AnyUnpacker unpackStr, AnyUnpacker unpackBool] eqvEquals <- eqv [arg1, arg2] return $ Bool $ (primitiveEquals || let (Bool x) = eqvEquals in x)
257
false
true
0
16
49
132
63
69
null
null
google/haskell-trainings
haskell_101/codelab/04_abstractions/src/Codelab.hs
apache-2.0
-- CODELAB 04: Abstractions -- -- Have you noticed that we keep using the same pattern? If the list is -- empty we return a specific value. If it is not, we call a function to -- combine the element with the result of the recursive calls. -- -- This is Haskell: if there is a pattern, it can (must) be abstracted! -- Fortunately, some useful functions are here for us. -- -- To understand the difference between foldr and foldl, remember that the -- last letter indicates if the "reduction" function is left associative or -- right associative: foldr goes from right to left, foldl goes from left -- to right. -- -- foldl :: (a -> x -> a) -> a -> [x] -> a -- foldr :: (x -> a -> a) -> a -> [x] -> a -- foldl (-) 0 [1,2,3,4] == (((0 - 1) - 2) - 3) - 4 == -10 -- foldr (-) 0 [1,2,3,4] == 1 - (2 - (3 - (4 - 0))) == -2 -- You probably remember this one? Nothing extraordinary here. map :: (a -> b) -> [a] -> [b] map _ [] = codelab
952
map :: (a -> b) -> [a] -> [b] map _ [] = codelab
52
map _ [] = codelab
22
true
true
0
7
222
58
40
18
null
null
ocharles/iCalendar
Text/ICalendar/Parser/Properties.hs
bsd-3-clause
parseRelatedTo x = throwError $ "parseRelatedTo: " ++ show x
60
parseRelatedTo x = throwError $ "parseRelatedTo: " ++ show x
60
parseRelatedTo x = throwError $ "parseRelatedTo: " ++ show x
60
false
false
0
6
9
20
9
11
null
null
chadaustin/battery
src/Battery/Test.hs
bsd-3-clause
makeAssert :: Int -> Name -> Q Exp makeAssert arity checkConstructor = do names <- replicateM arity $ newName "x" a <- assert return $ LamE (fmap VarP names) $ AppE a $ multiApp (ConE checkConstructor) $ fmap VarE names
231
makeAssert :: Int -> Name -> Q Exp makeAssert arity checkConstructor = do names <- replicateM arity $ newName "x" a <- assert return $ LamE (fmap VarP names) $ AppE a $ multiApp (ConE checkConstructor) $ fmap VarE names
231
makeAssert arity checkConstructor = do names <- replicateM arity $ newName "x" a <- assert return $ LamE (fmap VarP names) $ AppE a $ multiApp (ConE checkConstructor) $ fmap VarE names
196
false
true
0
13
51
98
44
54
null
null
dbp/analyze
src/Worker.hs
bsd-3-clause
onlineVariance :: Double -> Double -> Int -> [Double] -> Double onlineVariance oldv _oldm _oldn [] = oldv
105
onlineVariance :: Double -> Double -> Int -> [Double] -> Double onlineVariance oldv _oldm _oldn [] = oldv
105
onlineVariance oldv _oldm _oldn [] = oldv
41
false
true
0
11
17
47
22
25
null
null
chemist/highlighter
src/Text/Highlighter/Lexers/Modula2.hs
bsd-3-clause
whitespace' :: TokenMatcher whitespace' = [ tok "\\n+" (Arbitrary "Text") , tok "\\s+" (Arbitrary "Text") ]
119
whitespace' :: TokenMatcher whitespace' = [ tok "\\n+" (Arbitrary "Text") , tok "\\s+" (Arbitrary "Text") ]
119
whitespace' = [ tok "\\n+" (Arbitrary "Text") , tok "\\s+" (Arbitrary "Text") ]
91
false
true
0
8
27
39
20
19
null
null
comraq/scheme-interpreter
app/Main.hs
bsd-3-clause
evalAndPrint env str = evalInputT env str >>= outputStrLn
57
evalAndPrint env str = evalInputT env str >>= outputStrLn
57
evalAndPrint env str = evalInputT env str >>= outputStrLn
57
false
false
0
6
8
20
9
11
null
null
ideas-edu/ideas
src/Ideas/Utils/TestSuite.hs
apache-2.0
subResults :: Result -> [(String, Result)] subResults = toList . suites
72
subResults :: Result -> [(String, Result)] subResults = toList . suites
71
subResults = toList . suites
28
false
true
1
9
11
36
17
19
null
null
hephaestus-pl/hephaestus
alexandre/feature-modeling/TestSetup.hs
mit
fmMobilePhone_old = Old.FeatureModel treeMobilePhone_old []
59
fmMobilePhone_old = Old.FeatureModel treeMobilePhone_old []
59
fmMobilePhone_old = Old.FeatureModel treeMobilePhone_old []
59
false
false
0
6
4
15
7
8
null
null
shicks/shsh
System/Console/ShSh/Builtins/Test.hs
bsd-3-clause
isGroup _ = return False
24
isGroup _ = return False
24
isGroup _ = return False
24
false
false
0
4
4
13
5
8
null
null
forsyde/forsyde-atom
src/ForSyDe/Atom/MoC/CT/Lib.hs
bsd-3-clause
stated33 ns i = MoC.stated33 ns (unit3 i)
41
stated33 ns i = MoC.stated33 ns (unit3 i)
41
stated33 ns i = MoC.stated33 ns (unit3 i)
41
false
false
1
7
7
29
11
18
null
null
gbataille/pandoc
src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs
gpl-2.0
maybeToEither Nothing = Left ()
33
maybeToEither Nothing = Left ()
33
maybeToEither Nothing = Left ()
33
false
false
1
6
6
18
6
12
null
null
input-output-hk/pos-haskell-prototype
wallet/test/integration/Test/Integration/Framework/DSL.hs
mit
(</>) :: ToHttpApiData a => Text -> a -> Text base </> next = mconcat [base, "/", toQueryParam next]
100
(</>) :: ToHttpApiData a => Text -> a -> Text base </> next = mconcat [base, "/", toQueryParam next]
100
base </> next = mconcat [base, "/", toQueryParam next]
54
false
true
0
10
18
53
26
27
null
null
sdiehl/ghc
compiler/main/DynFlags.hs
bsd-3-clause
setInteractivePrint f d = d { interactivePrint = Just f}
56
setInteractivePrint f d = d { interactivePrint = Just f}
56
setInteractivePrint f d = d { interactivePrint = Just f}
56
false
false
0
7
9
22
11
11
null
null
wxwxwwxxx/ghc
compiler/vectorise/Vectorise/Type/Classify.hs
bsd-3-clause
-- Compute mutually recursive groups of tycons in topological order. -- tyConGroups :: [TyCon] -> [TyConGroup] tyConGroups tcs = map mk_grp (stronglyConnCompFromEdgedVertices edges) where edges = [((tc, ds), tc, uniqSetToList ds) | tc <- tcs , let ds = tyConsOfTyCon tc] mk_grp (AcyclicSCC (tc, ds)) = ([tc], ds) mk_grp (CyclicSCC els) = (tcs, unionManyUniqSets dss) where (tcs, dss) = unzip els -- |Collect the set of TyCons used by the representation of some data type. --
542
tyConGroups :: [TyCon] -> [TyConGroup] tyConGroups tcs = map mk_grp (stronglyConnCompFromEdgedVertices edges) where edges = [((tc, ds), tc, uniqSetToList ds) | tc <- tcs , let ds = tyConsOfTyCon tc] mk_grp (AcyclicSCC (tc, ds)) = ([tc], ds) mk_grp (CyclicSCC els) = (tcs, unionManyUniqSets dss) where (tcs, dss) = unzip els -- |Collect the set of TyCons used by the representation of some data type. --
470
tyConGroups tcs = map mk_grp (stronglyConnCompFromEdgedVertices edges) where edges = [((tc, ds), tc, uniqSetToList ds) | tc <- tcs , let ds = tyConsOfTyCon tc] mk_grp (AcyclicSCC (tc, ds)) = ([tc], ds) mk_grp (CyclicSCC els) = (tcs, unionManyUniqSets dss) where (tcs, dss) = unzip els -- |Collect the set of TyCons used by the representation of some data type. --
431
true
true
1
10
143
171
88
83
null
null
Philonous/xmpp-daemon
client/Main.hs
mit
getIP :: String -> IO () getIP peer = do con <- connectBus Session (\_ _ _ -> return ()) (\_ _ _ -> return ()) eitherIP <- callMethod' "xmpp.daemon" (objectPath "/pontarius/xmpp/connection") "pontarius.xmpp" "getAddr" [DBV . DBVString $ Text.pack peer] [] con case eitherIP of Right ip -> putStrLn $ Text.unpack ip Left error -> hPutStrLn stderr $ Text.unpack error
477
getIP :: String -> IO () getIP peer = do con <- connectBus Session (\_ _ _ -> return ()) (\_ _ _ -> return ()) eitherIP <- callMethod' "xmpp.daemon" (objectPath "/pontarius/xmpp/connection") "pontarius.xmpp" "getAddr" [DBV . DBVString $ Text.pack peer] [] con case eitherIP of Right ip -> putStrLn $ Text.unpack ip Left error -> hPutStrLn stderr $ Text.unpack error
477
getIP peer = do con <- connectBus Session (\_ _ _ -> return ()) (\_ _ _ -> return ()) eitherIP <- callMethod' "xmpp.daemon" (objectPath "/pontarius/xmpp/connection") "pontarius.xmpp" "getAddr" [DBV . DBVString $ Text.pack peer] [] con case eitherIP of Right ip -> putStrLn $ Text.unpack ip Left error -> hPutStrLn stderr $ Text.unpack error
452
false
true
0
13
171
168
78
90
null
null
konn/persistent-kvs
Database/Persist/KVS/Internal.hs
bsd-3-clause
buildInteger n = fromWord8 1 `mappend` fromWord8 (fromIntegral $ signum n) `mappend` fromInt64le (fromIntegral $ length bts) `mappend` fromByteString bts where bts = unfoldr step $ abs n step 0 = Nothing step i = Just (fromIntegral i, i `shiftR` 8)
320
buildInteger n = fromWord8 1 `mappend` fromWord8 (fromIntegral $ signum n) `mappend` fromInt64le (fromIntegral $ length bts) `mappend` fromByteString bts where bts = unfoldr step $ abs n step 0 = Nothing step i = Just (fromIntegral i, i `shiftR` 8)
320
buildInteger n = fromWord8 1 `mappend` fromWord8 (fromIntegral $ signum n) `mappend` fromInt64le (fromIntegral $ length bts) `mappend` fromByteString bts where bts = unfoldr step $ abs n step 0 = Nothing step i = Just (fromIntegral i, i `shiftR` 8)
320
false
false
4
11
112
124
56
68
null
null
craigbilner/advent-of-code-2016
day-5.hs
apache-2.0
iterateIndx :: DoorID -> Indx -> Password -> Password iterateIndx doorID indx password | length password == 8 = password | otherwise = let hash = stringToMD5Hex $ doorID ++ show indx next = iterateIndx doorID $ indx + 1 in if take 5 hash == "00000" then next $ (hash !! 5) : password else next password
397
iterateIndx :: DoorID -> Indx -> Password -> Password iterateIndx doorID indx password | length password == 8 = password | otherwise = let hash = stringToMD5Hex $ doorID ++ show indx next = iterateIndx doorID $ indx + 1 in if take 5 hash == "00000" then next $ (hash !! 5) : password else next password
397
iterateIndx doorID indx password | length password == 8 = password | otherwise = let hash = stringToMD5Hex $ doorID ++ show indx next = iterateIndx doorID $ indx + 1 in if take 5 hash == "00000" then next $ (hash !! 5) : password else next password
343
false
true
0
12
152
125
60
65
null
null
sourcewave/pg-schema-diff
Util.hs
unlicense
compareIgnoringWhiteSpace :: String -> String -> Bool compareIgnoringWhiteSpace x y = ciws (trim x) (trim y) where ciws x@(a:p) y@(b:q) = if (isSpace a && isSpace b) then ciws (trim p) (trim q) else if (a == b) then ciws p q else False ciws x [] = null (trim x) ciws [] y = null (trim y)
331
compareIgnoringWhiteSpace :: String -> String -> Bool compareIgnoringWhiteSpace x y = ciws (trim x) (trim y) where ciws x@(a:p) y@(b:q) = if (isSpace a && isSpace b) then ciws (trim p) (trim q) else if (a == b) then ciws p q else False ciws x [] = null (trim x) ciws [] y = null (trim y)
331
compareIgnoringWhiteSpace x y = ciws (trim x) (trim y) where ciws x@(a:p) y@(b:q) = if (isSpace a && isSpace b) then ciws (trim p) (trim q) else if (a == b) then ciws p q else False ciws x [] = null (trim x) ciws [] y = null (trim y)
277
false
true
2
9
101
172
88
84
null
null
olsner/ghc
compiler/main/TidyPgm.hs
bsd-3-clause
dffvExpr (Tick _other e) = dffvExpr e
40
dffvExpr (Tick _other e) = dffvExpr e
40
dffvExpr (Tick _other e) = dffvExpr e
40
false
false
0
6
9
21
9
12
null
null
philipturnbull/quenelle
test/TestReplace.hs
gpl-2.0
testDoReplacement sexpr srule sreplacement sexpected = case parseExpr sexpr "" of Left _ -> fail $ "Failed to parse sexpr: " ++ sexpr Right (expr, _) -> case parseExprRule srule of Left _ -> fail $ "Failed to parse srule: " ++ srule Right rule -> case parseExpr sexpected "" of Left _ -> fail $ "Failed to parse sexpected: " ++ sexpected Right (expected, _) -> case parseExprReplacement sreplacement of Left _ -> fail $ "Failed to parse sreplacement: " ++ sreplacement Right replacement -> case matchExprRule rule (normalizeExpr expr) of [] -> fail $ "Failed matchExprRule for: " ++ matchMsg [match] -> TestCase $ assertEqual assertString (normalizeExpr expected) (doReplacement replacement match) matches -> fail $ "Found " ++ show (length matches) ++ " matches for: " ++ matchMsg where matchMsg = srule ++ " -> " ++ sexpr assertString = intercalate " -> " [sexpr, srule, sreplacement, sexpected]
1,291
testDoReplacement sexpr srule sreplacement sexpected = case parseExpr sexpr "" of Left _ -> fail $ "Failed to parse sexpr: " ++ sexpr Right (expr, _) -> case parseExprRule srule of Left _ -> fail $ "Failed to parse srule: " ++ srule Right rule -> case parseExpr sexpected "" of Left _ -> fail $ "Failed to parse sexpected: " ++ sexpected Right (expected, _) -> case parseExprReplacement sreplacement of Left _ -> fail $ "Failed to parse sreplacement: " ++ sreplacement Right replacement -> case matchExprRule rule (normalizeExpr expr) of [] -> fail $ "Failed matchExprRule for: " ++ matchMsg [match] -> TestCase $ assertEqual assertString (normalizeExpr expected) (doReplacement replacement match) matches -> fail $ "Found " ++ show (length matches) ++ " matches for: " ++ matchMsg where matchMsg = srule ++ " -> " ++ sexpr assertString = intercalate " -> " [sexpr, srule, sreplacement, sexpected]
1,291
testDoReplacement sexpr srule sreplacement sexpected = case parseExpr sexpr "" of Left _ -> fail $ "Failed to parse sexpr: " ++ sexpr Right (expr, _) -> case parseExprRule srule of Left _ -> fail $ "Failed to parse srule: " ++ srule Right rule -> case parseExpr sexpected "" of Left _ -> fail $ "Failed to parse sexpected: " ++ sexpected Right (expected, _) -> case parseExprReplacement sreplacement of Left _ -> fail $ "Failed to parse sreplacement: " ++ sreplacement Right replacement -> case matchExprRule rule (normalizeExpr expr) of [] -> fail $ "Failed matchExprRule for: " ++ matchMsg [match] -> TestCase $ assertEqual assertString (normalizeExpr expected) (doReplacement replacement match) matches -> fail $ "Found " ++ show (length matches) ++ " matches for: " ++ matchMsg where matchMsg = srule ++ " -> " ++ sexpr assertString = intercalate " -> " [sexpr, srule, sreplacement, sexpected]
1,291
false
false
0
25
543
297
145
152
null
null
brendanhay/gogol
gogol-cloudidentity/gen/Network/Google/Resource/CloudIdentity/Groups/Memberships/CheckTransitiveMembership.hs
mpl-2.0
-- | [Resource -- name](https:\/\/cloud.google.com\/apis\/design\/resource_names) of the -- group to check the transitive membership in. Format: -- \`groups\/{group_id}\`, where \`group_id\` is the unique id assigned to -- the Group to which the Membership belongs to. gmctmParent :: Lens' GroupsMembershipsCheckTransitiveMembership Text gmctmParent = lens _gmctmParent (\ s a -> s{_gmctmParent = a})
402
gmctmParent :: Lens' GroupsMembershipsCheckTransitiveMembership Text gmctmParent = lens _gmctmParent (\ s a -> s{_gmctmParent = a})
133
gmctmParent = lens _gmctmParent (\ s a -> s{_gmctmParent = a})
64
true
true
1
9
52
50
26
24
null
null
hansbugge/cubicaltt
Eval.hs
mit
transNegLine :: Val -> Val -> Val transNegLine u v = transNeg i (u @@ i) v where i = fresh (u,v)
98
transNegLine :: Val -> Val -> Val transNegLine u v = transNeg i (u @@ i) v where i = fresh (u,v)
98
transNegLine u v = transNeg i (u @@ i) v where i = fresh (u,v)
64
false
true
0
7
23
55
28
27
null
null
aristidb/datastorage
src/TypedBinary.hs
bsd-3-clause
encodeVarUInt :: (Integral a, Bits a) => a -> B.Builder encodeVarUInt n | n < 0 = error "Negative numbers cannot be encoded by encodeVarUInt" | n < 0x80 = B.word8 (fromIntegral n) | otherwise = B.word8 (0x80 .|. fromIntegral (n .&. 0x7F)) <> encodeVarUInt (n `shiftR` 7)
302
encodeVarUInt :: (Integral a, Bits a) => a -> B.Builder encodeVarUInt n | n < 0 = error "Negative numbers cannot be encoded by encodeVarUInt" | n < 0x80 = B.word8 (fromIntegral n) | otherwise = B.word8 (0x80 .|. fromIntegral (n .&. 0x7F)) <> encodeVarUInt (n `shiftR` 7)
302
encodeVarUInt n | n < 0 = error "Negative numbers cannot be encoded by encodeVarUInt" | n < 0x80 = B.word8 (fromIntegral n) | otherwise = B.word8 (0x80 .|. fromIntegral (n .&. 0x7F)) <> encodeVarUInt (n `shiftR` 7)
246
false
true
0
12
79
119
58
61
null
null
ozataman/shpider
Network/Shpider/Links.hs
mit
-- | Parse all links from a list of tags. gatherLinks :: [ Tag String ] -> [ Link ] gatherLinks = tParse allLinks
116
gatherLinks :: [ Tag String ] -> [ Link ] gatherLinks = tParse allLinks
74
gatherLinks = tParse allLinks
32
true
true
0
7
26
28
15
13
null
null
OpenXT/manager
xenmgr/Vm/State.hs
gpl-2.0
stateToStr CreatingDomain = "creating-domain"
45
stateToStr CreatingDomain = "creating-domain"
45
stateToStr CreatingDomain = "creating-domain"
45
false
false
0
4
3
10
4
6
null
null
holzensp/ghc
compiler/cmm/PprC.hs
bsd-3-clause
isStrangeTypeReg (CmmGlobal g) = isStrangeTypeGlobal g
55
isStrangeTypeReg (CmmGlobal g) = isStrangeTypeGlobal g
55
isStrangeTypeReg (CmmGlobal g) = isStrangeTypeGlobal g
55
false
false
0
7
6
18
8
10
null
null
silkapp/cassava
Data/Csv/Encoding.hs
bsd-3-clause
decodeWithP :: AL.Parser a -> L.ByteString -> Either String a decodeWithP p s = case AL.parse p s of AL.Done _ v -> Right v AL.Fail left _ msg -> Left errMsg where errMsg = "parse error (" ++ msg ++ ") at " ++ (if BL8.length left > 100 then (take 100 $ BL8.unpack left) ++ " (truncated)" else show (BL8.unpack left))
414
decodeWithP :: AL.Parser a -> L.ByteString -> Either String a decodeWithP p s = case AL.parse p s of AL.Done _ v -> Right v AL.Fail left _ msg -> Left errMsg where errMsg = "parse error (" ++ msg ++ ") at " ++ (if BL8.length left > 100 then (take 100 $ BL8.unpack left) ++ " (truncated)" else show (BL8.unpack left))
414
decodeWithP p s = case AL.parse p s of AL.Done _ v -> Right v AL.Fail left _ msg -> Left errMsg where errMsg = "parse error (" ++ msg ++ ") at " ++ (if BL8.length left > 100 then (take 100 $ BL8.unpack left) ++ " (truncated)" else show (BL8.unpack left))
352
false
true
0
17
160
150
72
78
null
null
michalkonecny/aern
aern-ivp/demos/simple-events-locate-polyint.hs
bsd-3-clause
runWithArgs :: [String] -> IO () runWithArgs [ivpName, tEndS, maybePlotDimensS, maybePDFfilenameS, topLevelStrategyS, basicStepTypeS, locMaxDepthS, locMinDepthS, maxDegS, maxSizeS, odeMaxDepthS, odeMinDepthS] = do putStrLn $ hybivp_description ivp solveEventsPrintSteps ivp maybePlotDimens maybePDFfilename (topLevelStrategy, basicStepType, locMaxDepth, locMinDepth) (maxDeg, maxSize, odeMaxDepth, odeMinDepth) return () where ivp = ivpByNameReportError ivpName tEndD samplePoly topLevelStrategy = topLevelStrategyFromS topLevelStrategyS basicStepType = basicStepTypeFromS basicStepTypeS maybePlotDimens = readPlotParams maybePlotDimensS :: Maybe PlotParams maybePDFfilename = readPDFfilename maybePDFfilenameS :: Maybe String maxDeg = read maxDegS :: Int maxSize = read maxSizeS :: Int odeMaxDepth = read odeMaxDepthS :: Int odeMinDepth = read odeMinDepthS :: Int locMaxDepth = read locMaxDepthS :: Int locMinDepth = read locMinDepthS :: Int tEndD = read tEndS :: Double readPDFfilename "GUI" = Nothing readPDFfilename pdfilename | ".pdf" `isSuffixOf` pdfilename = Just pdfilename readPDFfilename filename = error $ "Unsupported output file format: " ++ filename
1,303
runWithArgs :: [String] -> IO () runWithArgs [ivpName, tEndS, maybePlotDimensS, maybePDFfilenameS, topLevelStrategyS, basicStepTypeS, locMaxDepthS, locMinDepthS, maxDegS, maxSizeS, odeMaxDepthS, odeMinDepthS] = do putStrLn $ hybivp_description ivp solveEventsPrintSteps ivp maybePlotDimens maybePDFfilename (topLevelStrategy, basicStepType, locMaxDepth, locMinDepth) (maxDeg, maxSize, odeMaxDepth, odeMinDepth) return () where ivp = ivpByNameReportError ivpName tEndD samplePoly topLevelStrategy = topLevelStrategyFromS topLevelStrategyS basicStepType = basicStepTypeFromS basicStepTypeS maybePlotDimens = readPlotParams maybePlotDimensS :: Maybe PlotParams maybePDFfilename = readPDFfilename maybePDFfilenameS :: Maybe String maxDeg = read maxDegS :: Int maxSize = read maxSizeS :: Int odeMaxDepth = read odeMaxDepthS :: Int odeMinDepth = read odeMinDepthS :: Int locMaxDepth = read locMaxDepthS :: Int locMinDepth = read locMinDepthS :: Int tEndD = read tEndS :: Double readPDFfilename "GUI" = Nothing readPDFfilename pdfilename | ".pdf" `isSuffixOf` pdfilename = Just pdfilename readPDFfilename filename = error $ "Unsupported output file format: " ++ filename
1,303
runWithArgs [ivpName, tEndS, maybePlotDimensS, maybePDFfilenameS, topLevelStrategyS, basicStepTypeS, locMaxDepthS, locMinDepthS, maxDegS, maxSizeS, odeMaxDepthS, odeMinDepthS] = do putStrLn $ hybivp_description ivp solveEventsPrintSteps ivp maybePlotDimens maybePDFfilename (topLevelStrategy, basicStepType, locMaxDepth, locMinDepth) (maxDeg, maxSize, odeMaxDepth, odeMinDepth) return () where ivp = ivpByNameReportError ivpName tEndD samplePoly topLevelStrategy = topLevelStrategyFromS topLevelStrategyS basicStepType = basicStepTypeFromS basicStepTypeS maybePlotDimens = readPlotParams maybePlotDimensS :: Maybe PlotParams maybePDFfilename = readPDFfilename maybePDFfilenameS :: Maybe String maxDeg = read maxDegS :: Int maxSize = read maxSizeS :: Int odeMaxDepth = read odeMaxDepthS :: Int odeMinDepth = read odeMinDepthS :: Int locMaxDepth = read locMaxDepthS :: Int locMinDepth = read locMinDepthS :: Int tEndD = read tEndS :: Double readPDFfilename "GUI" = Nothing readPDFfilename pdfilename | ".pdf" `isSuffixOf` pdfilename = Just pdfilename readPDFfilename filename = error $ "Unsupported output file format: " ++ filename
1,270
false
true
6
8
274
334
163
171
null
null
chwthewke/horbits
src/horbits/Horbits/Time/KerbalDateTime.hs
bsd-3-clause
decompose :: Integral a => DecompState a -> Maybe (a, DecompState a) decompose Nothing = Nothing
96
decompose :: Integral a => DecompState a -> Maybe (a, DecompState a) decompose Nothing = Nothing
96
decompose Nothing = Nothing
27
false
true
0
10
15
45
20
25
null
null
stappit/okasaki-pfds
src/Chap03/Exercise10.hs
gpl-3.0
rbalance c l x r = T c l x r
28
rbalance c l x r = T c l x r
28
rbalance c l x r = T c l x r
28
false
false
0
5
10
24
11
13
null
null
bravit/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
reifyNativeTy x = fail $ "Couldn't reify reflected NativeTy " ++ show x
71
reifyNativeTy x = fail $ "Couldn't reify reflected NativeTy " ++ show x
71
reifyNativeTy x = fail $ "Couldn't reify reflected NativeTy " ++ show x
71
false
false
3
6
12
24
9
15
null
null
tjakway/ghcjvm
compiler/vectorise/Vectorise/Convert.hs
bsd-3-clause
fromVect :: Type -- ^ The type of the original binding. -> CoreExpr -- ^ Expression giving the closure to use, eg @$v_foo@. -> VM CoreExpr -- Convert the type to the core view if it isn't already. -- fromVect ty expr | Just ty' <- coreView ty = fromVect ty' expr
295
fromVect :: Type -- ^ The type of the original binding. -> CoreExpr -- ^ Expression giving the closure to use, eg @$v_foo@. -> VM CoreExpr fromVect ty expr | Just ty' <- coreView ty = fromVect ty' expr
233
fromVect ty expr | Just ty' <- coreView ty = fromVect ty' expr
66
true
true
0
9
84
52
25
27
null
null
Solonarv/Zipper
ZipperN.hs
mit
posZ, sizeZ :: ZipperN n a -> Vector n Integer posZ = _pos
58
posZ, sizeZ :: ZipperN n a -> Vector n Integer posZ = _pos
58
posZ = _pos
11
false
true
2
7
12
34
14
20
null
null
JohnLato/iteratee
src/Data/Iteratee/Base.hs
bsd-3-clause
-- | Wrap a continuation return into an iteratee. This may cause data loss -- if not used properly. wrapCont :: ContReturn s m a -> Iteratee s m a wrapCont (ContDone a _) = idone a
181
wrapCont :: ContReturn s m a -> Iteratee s m a wrapCont (ContDone a _) = idone a
80
wrapCont (ContDone a _) = idone a
33
true
true
0
7
37
45
22
23
null
null
Philonous/hs-otr
source/Otr/Serialize.hs
mit
getMessageBody :: OtrByte -> Get OtrMessageBody getMessageBody messageType = case messageType of 0x02 -> DHCommitMessage <$> label "getDHCommitMessage" get 0x0a -> DHKeyMessage <$> label "getDHKeyMessage" get 0x11 -> RevealSignatureMessage <$> label "getRevealSignatureMessage" get 0x12 -> SignatureMessage <$> label "getSignatureMessage" get 0x03 -> DataMessage <$> label "getDataMessage" get _ -> fail "unknown message type"
453
getMessageBody :: OtrByte -> Get OtrMessageBody getMessageBody messageType = case messageType of 0x02 -> DHCommitMessage <$> label "getDHCommitMessage" get 0x0a -> DHKeyMessage <$> label "getDHKeyMessage" get 0x11 -> RevealSignatureMessage <$> label "getRevealSignatureMessage" get 0x12 -> SignatureMessage <$> label "getSignatureMessage" get 0x03 -> DataMessage <$> label "getDataMessage" get _ -> fail "unknown message type"
453
getMessageBody messageType = case messageType of 0x02 -> DHCommitMessage <$> label "getDHCommitMessage" get 0x0a -> DHKeyMessage <$> label "getDHKeyMessage" get 0x11 -> RevealSignatureMessage <$> label "getRevealSignatureMessage" get 0x12 -> SignatureMessage <$> label "getSignatureMessage" get 0x03 -> DataMessage <$> label "getDataMessage" get _ -> fail "unknown message type"
405
false
true
0
9
79
113
52
61
null
null
airt/Haskell-99
src/NinetyNine/P6X.hs
mit
parseDs _ = ("", Nothing)
25
parseDs _ = ("", Nothing)
25
parseDs _ = ("", Nothing)
25
false
false
0
5
4
16
8
8
null
null
tomwadeson/cis194
week7/JoinList.hs
mit
_ !!? i | i < 0 = Nothing
30
_ !!? i | i < 0 = Nothing
30
_ !!? i | i < 0 = Nothing
30
false
false
0
8
13
22
9
13
null
null
well-typed/json-sop
src/Generics/SOP/JSON.hs
bsd-3-clause
gparseJSON' :: forall (xss :: [[Type]]). All2 FromJSON xss => Value -> NP JsonInfo xss -> Parser (SOP I xss) gparseJSON' v info = runPartial failWith . msum . hcollapse $ hcliftA2 allpf (parseConstructor v) info injs where failWith :: [String] -> Parser (SOP I xss) failWith [] = fail $ "Unknown error" failWith errs = fail $ intercalate " or " errs -- Necessary type annotation. Don't know why. injs :: NP (Injection (NP I) xss) xss injs = injections
540
gparseJSON' :: forall (xss :: [[Type]]). All2 FromJSON xss => Value -> NP JsonInfo xss -> Parser (SOP I xss) gparseJSON' v info = runPartial failWith . msum . hcollapse $ hcliftA2 allpf (parseConstructor v) info injs where failWith :: [String] -> Parser (SOP I xss) failWith [] = fail $ "Unknown error" failWith errs = fail $ intercalate " or " errs -- Necessary type annotation. Don't know why. injs :: NP (Injection (NP I) xss) xss injs = injections
540
gparseJSON' v info = runPartial failWith . msum . hcollapse $ hcliftA2 allpf (parseConstructor v) info injs where failWith :: [String] -> Parser (SOP I xss) failWith [] = fail $ "Unknown error" failWith errs = fail $ intercalate " or " errs -- Necessary type annotation. Don't know why. injs :: NP (Injection (NP I) xss) xss injs = injections
428
false
true
0
11
169
183
92
91
null
null
deontologician/orbRPG
Game/OrbRPG/Types.hs
gpl-3.0
applyConfig :: GameConfig -> Adv () applyConfig gc = do (if getL overrideGlobalActions gc then setS globalActions else addGlobalActions) $ getL newGlobalActions gc modifyInv (++ (getL initialInventory gc)) setS config gc
236
applyConfig :: GameConfig -> Adv () applyConfig gc = do (if getL overrideGlobalActions gc then setS globalActions else addGlobalActions) $ getL newGlobalActions gc modifyInv (++ (getL initialInventory gc)) setS config gc
236
applyConfig gc = do (if getL overrideGlobalActions gc then setS globalActions else addGlobalActions) $ getL newGlobalActions gc modifyInv (++ (getL initialInventory gc)) setS config gc
200
false
true
0
10
46
80
38
42
null
null
phischu/fragnix
benchmarks/containers/Data.Sequence.hs
bsd-3-clause
------------------------------------------------------------------------ -- Deconstruction ------------------------------------------------------------------------ -- | /O(1)/. Is this the empty sequence? null :: Seq a -> Bool null (Seq Empty) = True
262
null :: Seq a -> Bool null (Seq Empty) = True
56
null (Seq Empty) = True
23
true
true
0
9
34
37
18
19
null
null
dawedawe/kripkeweb
src/Model.hs
bsd-3-clause
termAsLamType _ BdyRaw _ t = return t
45
termAsLamType _ BdyRaw _ t = return t
45
termAsLamType _ BdyRaw _ t = return t
45
false
false
1
5
15
16
7
9
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_60 x = happyTcHack x happyFail
37
action_60 x = happyTcHack x happyFail
37
action_60 x = happyTcHack x happyFail
37
false
false
0
5
5
14
6
8
null
null
danidiaz/process-streaming
src/System/Process/Streaming.hs
bsd-3-clause
feedFallibleProducer :: Producer ByteString (ExceptT e IO) () -> Streams e () feedFallibleProducer = feedProducerM runExceptT
125
feedFallibleProducer :: Producer ByteString (ExceptT e IO) () -> Streams e () feedFallibleProducer = feedProducerM runExceptT
125
feedFallibleProducer = feedProducerM runExceptT
47
false
true
0
8
15
42
20
22
null
null
ezrosent/s-explore
src/UTLC.hs
bsd-3-clause
bigStep r@(Lam _) = return r
30
bigStep r@(Lam _) = return r
30
bigStep r@(Lam _) = return r
30
false
false
1
7
7
27
10
17
null
null
nevrenato/HyLoRes_Source
2.4/src/HyLoRes/ClauseSet/InUse.hs
gpl-2.0
keys :: InUseIdx f k -> [(NomSym, k)] keys idx = [(i,k) | (i,m) <- Map.toList (asMap idx), k <- Map.keys m]
108
keys :: InUseIdx f k -> [(NomSym, k)] keys idx = [(i,k) | (i,m) <- Map.toList (asMap idx), k <- Map.keys m]
108
keys idx = [(i,k) | (i,m) <- Map.toList (asMap idx), k <- Map.keys m]
70
false
true
0
11
22
83
43
40
null
null
hguenther/smtlib2
Language/SMTLib2/Internals/Type.hs
gpl-3.0
typeFiniteDomain (BitVecRepr bw) = Just [ BitVecValue n bw | n <- [0..2^(bwSize bw)-1] ]
128
typeFiniteDomain (BitVecRepr bw) = Just [ BitVecValue n bw | n <- [0..2^(bwSize bw)-1] ]
128
typeFiniteDomain (BitVecRepr bw) = Just [ BitVecValue n bw | n <- [0..2^(bwSize bw)-1] ]
128
false
false
0
13
54
54
26
28
null
null
michaelficarra/purescript
src/Language/PureScript/AST/Declarations.hs
mit
-- | -- Test if a declaration is a data type foreign import -- isExternDataDecl :: Declaration -> Bool isExternDataDecl ExternDataDeclaration{} = True
150
isExternDataDecl :: Declaration -> Bool isExternDataDecl ExternDataDeclaration{} = True
87
isExternDataDecl ExternDataDeclaration{} = True
47
true
true
0
6
22
25
14
11
null
null
diogob/haskell-tools
src/HaskellTools/Github.hs
bsd-3-clause
baseUrl :: String baseUrl = "https://api.github.com/"
53
baseUrl :: String baseUrl = "https://api.github.com/"
53
baseUrl = "https://api.github.com/"
35
false
true
0
6
5
18
7
11
null
null
jml/hodor
Tests/ParserSpec.hs
apache-2.0
spec :: Spec spec = describe "Parser" $ do lineParserSpec fileParserSpec unparseSpec
90
spec :: Spec spec = describe "Parser" $ do lineParserSpec fileParserSpec unparseSpec
90
spec = describe "Parser" $ do lineParserSpec fileParserSpec unparseSpec
77
false
true
0
7
17
27
12
15
null
null
ublubu/streamstats
src/Streaming.hs
mit
stringAccum0 :: StringAccum stringAccum0 = StringAccum 0 0 meanFolder0
70
stringAccum0 :: StringAccum stringAccum0 = StringAccum 0 0 meanFolder0
70
stringAccum0 = StringAccum 0 0 meanFolder0
42
false
true
0
5
8
18
9
9
null
null
abakst/liquidhaskell
benchmarks/bytestring-0.9.2.1/Data/ByteString.T.hs
bsd-3-clause
rng :: Int -> Int -> [Int] rng lo hi = go (1 + hi - lo) lo where {- LIQUID WITNESS -} go (d::Int) i | i > hi = [] | otherwise = i : go (d-1) (i+1) -- | /O(n)/ Return all final segments of the given 'ByteString', longest first. {- tails :: b:ByteString -> {v:[{v1:ByteString | (bLength v1) <= (bLength b)}] | (len v) = 1 + (bLength b)} @-}
382
rng :: Int -> Int -> [Int] rng lo hi = go (1 + hi - lo) lo where {- LIQUID WITNESS -} go (d::Int) i | i > hi = [] | otherwise = i : go (d-1) (i+1) -- | /O(n)/ Return all final segments of the given 'ByteString', longest first. {- tails :: b:ByteString -> {v:[{v1:ByteString | (bLength v1) <= (bLength b)}] | (len v) = 1 + (bLength b)} @-}
382
rng lo hi = go (1 + hi - lo) lo where {- LIQUID WITNESS -} go (d::Int) i | i > hi = [] | otherwise = i : go (d-1) (i+1) -- | /O(n)/ Return all final segments of the given 'ByteString', longest first. {- tails :: b:ByteString -> {v:[{v1:ByteString | (bLength v1) <= (bLength b)}] | (len v) = 1 + (bLength b)} @-}
355
false
true
2
9
117
123
59
64
null
null
DavidAlphaFox/ghc
libraries/transformers/Control/Monad/Trans/Maybe.hs
bsd-3-clause
-- | Lift a @listen@ operation to the new monad. liftListen :: (Monad m) => Listen w m (Maybe a) -> Listen w (MaybeT m) a liftListen listen = mapMaybeT $ \ m -> do (a, w) <- listen m return $! fmap (\ r -> (r, w)) a -- | Lift a @pass@ operation to the new monad.
271
liftListen :: (Monad m) => Listen w m (Maybe a) -> Listen w (MaybeT m) a liftListen listen = mapMaybeT $ \ m -> do (a, w) <- listen m return $! fmap (\ r -> (r, w)) a -- | Lift a @pass@ operation to the new monad.
222
liftListen listen = mapMaybeT $ \ m -> do (a, w) <- listen m return $! fmap (\ r -> (r, w)) a -- | Lift a @pass@ operation to the new monad.
149
true
true
0
13
67
106
55
51
null
null
exercism/xhaskell
exercises/practice/run-length-encoding/test/Tests.hs
mit
specs :: Spec specs = do describe "decode" $ for_ decodeCases $ test decode describe "encode" $ for_ encodeCases $ test encode describe "both" $ for_ bothCases $ test (decode . encode) where test f Case{..} = it description $ f input `shouldBe` expected
293
specs :: Spec specs = do describe "decode" $ for_ decodeCases $ test decode describe "encode" $ for_ encodeCases $ test encode describe "both" $ for_ bothCases $ test (decode . encode) where test f Case{..} = it description $ f input `shouldBe` expected
293
specs = do describe "decode" $ for_ decodeCases $ test decode describe "encode" $ for_ encodeCases $ test encode describe "both" $ for_ bothCases $ test (decode . encode) where test f Case{..} = it description $ f input `shouldBe` expected
279
false
true
1
10
83
127
53
74
null
null
holzensp/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
doPrefetchAddrOp ::Int -> [LocalReg] -> [CmmExpr] -> FCode () doPrefetchAddrOp locality res [addr,idx] = mkBasicPrefetch locality 0 res addr idx
199
doPrefetchAddrOp ::Int -> [LocalReg] -> [CmmExpr] -> FCode () doPrefetchAddrOp locality res [addr,idx] = mkBasicPrefetch locality 0 res addr idx
199
doPrefetchAddrOp locality res [addr,idx] = mkBasicPrefetch locality 0 res addr idx
86
false
true
0
9
74
58
30
28
null
null