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
marcmo/hsDiagnosis
other/TestSender.hs
bsd-3-clause
diagConnect :: DiagConfig -> IO DiagConnection diagConnect c = notify $ do h <- connectTo (host c) (PortNumber $ fromIntegral (port c)) hSetBuffering h NoBuffering return (DiagConnection h (verbose c)) where notify | verbose c = bracket_ (printf "Connecting to %s ... " (host c) >> hFlush stdout) (putStrLn "done.") | otherwise = bracket_ (return ()) (return ())
392
diagConnect :: DiagConfig -> IO DiagConnection diagConnect c = notify $ do h <- connectTo (host c) (PortNumber $ fromIntegral (port c)) hSetBuffering h NoBuffering return (DiagConnection h (verbose c)) where notify | verbose c = bracket_ (printf "Connecting to %s ... " (host c) >> hFlush stdout) (putStrLn "done.") | otherwise = bracket_ (return ()) (return ())
392
diagConnect c = notify $ do h <- connectTo (host c) (PortNumber $ fromIntegral (port c)) hSetBuffering h NoBuffering return (DiagConnection h (verbose c)) where notify | verbose c = bracket_ (printf "Connecting to %s ... " (host c) >> hFlush stdout) (putStrLn "done.") | otherwise = bracket_ (return ()) (return ())
345
false
true
0
14
87
166
76
90
null
null
urbanslug/ghc
compiler/iface/IfaceEnv.hs
bsd-3-clause
tcIfaceTyVar :: FastString -> IfL TyVar tcIfaceTyVar occ = do { lcl <- getLclEnv ; case (lookupUFM (if_tv_env lcl) occ) of Just ty_var -> return ty_var Nothing -> failIfM (text "Iface type variable out of scope: " <+> ppr occ) }
275
tcIfaceTyVar :: FastString -> IfL TyVar tcIfaceTyVar occ = do { lcl <- getLclEnv ; case (lookupUFM (if_tv_env lcl) occ) of Just ty_var -> return ty_var Nothing -> failIfM (text "Iface type variable out of scope: " <+> ppr occ) }
275
tcIfaceTyVar occ = do { lcl <- getLclEnv ; case (lookupUFM (if_tv_env lcl) occ) of Just ty_var -> return ty_var Nothing -> failIfM (text "Iface type variable out of scope: " <+> ppr occ) }
235
false
true
0
13
87
86
41
45
null
null
anttisalonen/cgen
src/CppGen.hs
bsd-3-clause
isConstructor _ = False
65
isConstructor _ = False
65
isConstructor _ = False
65
false
false
0
5
45
9
4
5
null
null
blast-hardcheese/git-dag-graph
src/GitParsers.hs
mit
parseCatCommit :: GitObject -> String -> Either ParseError GitObject parseCatCommit init x = runParser catCommitLines init "" x
127
parseCatCommit :: GitObject -> String -> Either ParseError GitObject parseCatCommit init x = runParser catCommitLines init "" x
127
parseCatCommit init x = runParser catCommitLines init "" x
58
false
true
0
8
17
42
19
23
null
null
ecaustin/haskhol-math
src/HaskHOL/Lib/IndTypesPre.hs
bsd-2-clause
defCONSTR :: IndTypesPreCtxt thry => HOL cls thry HOLThm defCONSTR = cacheProof "defCONSTR" ctxtIndTypesPre $ getDefinition "CONSTR"
132
defCONSTR :: IndTypesPreCtxt thry => HOL cls thry HOLThm defCONSTR = cacheProof "defCONSTR" ctxtIndTypesPre $ getDefinition "CONSTR"
132
defCONSTR = cacheProof "defCONSTR" ctxtIndTypesPre $ getDefinition "CONSTR"
75
false
true
0
7
16
43
18
25
null
null
mgrabmueller/harpy
Harpy/X86CodeGen.hs
bsd-3-clause
x86_mul_sse_reg_membase :: X86_SSE_PFX -> Word8 -> Word8 -> Word32 -> CodeGen e s () x86_mul_sse_reg_membase pfx dreg basereg disp = do emit_sse pfx emit8 0x0f emit8 0x59 x86_membase_emit dreg basereg disp
230
x86_mul_sse_reg_membase :: X86_SSE_PFX -> Word8 -> Word8 -> Word32 -> CodeGen e s () x86_mul_sse_reg_membase pfx dreg basereg disp = do emit_sse pfx emit8 0x0f emit8 0x59 x86_membase_emit dreg basereg disp
230
x86_mul_sse_reg_membase pfx dreg basereg disp = do emit_sse pfx emit8 0x0f emit8 0x59 x86_membase_emit dreg basereg disp
145
false
true
0
10
55
73
32
41
null
null
bixuanzju/stack
src/Stack/Options.hs
bsd-3-clause
addCoverageFlags :: BuildOpts -> BuildOpts addCoverageFlags bopts | toCoverage $ boptsTestOpts bopts = bopts { boptsGhcOptions = "-fhpc" : boptsGhcOptions bopts } | otherwise = bopts
198
addCoverageFlags :: BuildOpts -> BuildOpts addCoverageFlags bopts | toCoverage $ boptsTestOpts bopts = bopts { boptsGhcOptions = "-fhpc" : boptsGhcOptions bopts } | otherwise = bopts
198
addCoverageFlags bopts | toCoverage $ boptsTestOpts bopts = bopts { boptsGhcOptions = "-fhpc" : boptsGhcOptions bopts } | otherwise = bopts
155
false
true
0
9
41
66
29
37
null
null
psibi/yesod
yesod-core/bench/widget.hs
mit
bigTableHtml :: Show a => [[a]] -> Int64 bigTableHtml rows = L.length $ Utf8.renderHtml $ ($ id) [hamlet| <table> $forall row <- rows <tr> $forall cell <- row <td>#{show cell} |]
218
bigTableHtml :: Show a => [[a]] -> Int64 bigTableHtml rows = L.length $ Utf8.renderHtml $ ($ id) [hamlet| <table> $forall row <- rows <tr> $forall cell <- row <td>#{show cell} |]
218
bigTableHtml rows = L.length $ Utf8.renderHtml $ ($ id) [hamlet| <table> $forall row <- rows <tr> $forall cell <- row <td>#{show cell} |]
177
false
true
0
8
70
54
30
24
null
null
amcphail/hmatrix-gsl-stats
lib/Numeric/GSL/Distribution/Continuous.hs
bsd-3-clause
random_2p_s :: RNG -- ^ the random number generator -> TwoParamDist -- ^ distribution type -> Double -- ^ parameter 1 -> Double -- ^ parameter 2 -> IO Double -- ^ result random_2p_s (RNG rng) d p1 p2 = alloca $ \r -> do check "random_2p_s" $ withForeignPtr rng $ \rg -> distribution_random_two_param_s rg (fromei d) p1 p2 r r' <- peek r return r' -- | draw samples from a two parameter distribution
492
random_2p_s :: RNG -- ^ the random number generator -> TwoParamDist -- ^ distribution type -> Double -- ^ parameter 1 -> Double -- ^ parameter 2 -> IO Double random_2p_s (RNG rng) d p1 p2 = alloca $ \r -> do check "random_2p_s" $ withForeignPtr rng $ \rg -> distribution_random_two_param_s rg (fromei d) p1 p2 r r' <- peek r return r' -- | draw samples from a two parameter distribution
474
random_2p_s (RNG rng) d p1 p2 = alloca $ \r -> do check "random_2p_s" $ withForeignPtr rng $ \rg -> distribution_random_two_param_s rg (fromei d) p1 p2 r r' <- peek r return r' -- | draw samples from a two parameter distribution
235
true
true
0
13
168
115
57
58
null
null
plumlife/cabal
Cabal/Distribution/Simple/BuildTarget.hs
bsd-3-clause
componentStringName _ (CExeName name) = name
48
componentStringName _ (CExeName name) = name
48
componentStringName _ (CExeName name) = name
48
false
false
0
7
9
17
8
9
null
null
samfoy/adventOfCode
src/Day2.hs
bsd-3-clause
bowAmount :: String -> Integer bowAmount xs = sum $ map getRibbon (lines xs)
76
bowAmount :: String -> Integer bowAmount xs = sum $ map getRibbon (lines xs)
76
bowAmount xs = sum $ map getRibbon (lines xs)
45
false
true
0
8
13
33
16
17
null
null
snapframework/snap
src/Snap/Snaplet/Internal/Initializer.hs
bsd-3-clause
isSnapletsDir _ = False
23
isSnapletsDir _ = False
23
isSnapletsDir _ = False
23
false
false
0
5
3
9
4
5
null
null
toonn/quintessence
src/Lexer.hs
bsd-2-clause
varsym :: Parser String varsym = try ((((:) <$> (symbol >>= checkColon) <*> many symbol) >>= checkReservedOp) >>= checkDashes) where checkColon = checkFail (== ':') [ "value operator cannot start with '" , "' symbol" ] checkDashes x = case x of ('-':'-':dashes) -> checkFail (all (== '-')) [ "operator \"" , "\" cannot be distinguished from a line comment" ] dashes _ -> return x
531
varsym :: Parser String varsym = try ((((:) <$> (symbol >>= checkColon) <*> many symbol) >>= checkReservedOp) >>= checkDashes) where checkColon = checkFail (== ':') [ "value operator cannot start with '" , "' symbol" ] checkDashes x = case x of ('-':'-':dashes) -> checkFail (all (== '-')) [ "operator \"" , "\" cannot be distinguished from a line comment" ] dashes _ -> return x
531
varsym = try ((((:) <$> (symbol >>= checkColon) <*> many symbol) >>= checkReservedOp) >>= checkDashes) where checkColon = checkFail (== ':') [ "value operator cannot start with '" , "' symbol" ] checkDashes x = case x of ('-':'-':dashes) -> checkFail (all (== '-')) [ "operator \"" , "\" cannot be distinguished from a line comment" ] dashes _ -> return x
507
false
true
0
14
217
138
74
64
null
null
kowey/pandoc-old
src/Text/Pandoc/Writers/Markdown.hs
gpl-2.0
blockToMarkdown opts (CodeBlock _ str) = return $ (nest (writerTabStop opts) $ vcat $ map text (lines str)) <> text "\n"
122
blockToMarkdown opts (CodeBlock _ str) = return $ (nest (writerTabStop opts) $ vcat $ map text (lines str)) <> text "\n"
122
blockToMarkdown opts (CodeBlock _ str) = return $ (nest (writerTabStop opts) $ vcat $ map text (lines str)) <> text "\n"
122
false
false
0
12
22
61
29
32
null
null
wouwouwou/2017_module_8
src/haskell/PP-project-2016/lib/sprockell/Simulation.hs
apache-2.0
sprockellSim instrs s (i:is) | instr /= EndProg = (instr,s',o) : sprockellSim instrs s' is | otherwise = [] where (s',o) = sprockell instrs s i instr = instrs ! pc s
260
sprockellSim instrs s (i:is) | instr /= EndProg = (instr,s',o) : sprockellSim instrs s' is | otherwise = [] where (s',o) = sprockell instrs s i instr = instrs ! pc s
260
sprockellSim instrs s (i:is) | instr /= EndProg = (instr,s',o) : sprockellSim instrs s' is | otherwise = [] where (s',o) = sprockell instrs s i instr = instrs ! pc s
260
false
false
0
8
126
94
47
47
null
null
sleexyz/haskell-fun
Adjunctions.hs
bsd-3-clause
convertFrom ∷ ∀l r. Adjunction2 l r → Adjunction l r convertFrom MkAdjunction2 { unit, counit } = MkAdjunction { to, from } where to ∷ ∀a b. (Functor r, Functor l) ⇒ (l a → b) → (a → r b) to f = fmap f . unit from ∷ ∀a b. (Functor r, Functor l) ⇒ (a → r b) → (l a → b) from g = counit . fmap g
312
convertFrom ∷ ∀l r. Adjunction2 l r → Adjunction l r convertFrom MkAdjunction2 { unit, counit } = MkAdjunction { to, from } where to ∷ ∀a b. (Functor r, Functor l) ⇒ (l a → b) → (a → r b) to f = fmap f . unit from ∷ ∀a b. (Functor r, Functor l) ⇒ (a → r b) → (l a → b) from g = counit . fmap g
312
convertFrom MkAdjunction2 { unit, counit } = MkAdjunction { to, from } where to ∷ ∀a b. (Functor r, Functor l) ⇒ (l a → b) → (a → r b) to f = fmap f . unit from ∷ ∀a b. (Functor r, Functor l) ⇒ (a → r b) → (l a → b) from g = counit . fmap g
259
false
true
0
12
92
183
96
87
null
null
spechub/Hets
Adl/Sign.hs
gpl-2.0
symOf :: Sign -> Set.Set Symbol symOf = Set.unions . map (\ (i, l) -> Set.fromList . concatMap (\ y -> let s = relSrc y t = relTrg y in [Con s, Con t, Rel $ Sgn (idToSimpleId i) y]) $ Set.toList l) . Map.toList . rels
330
symOf :: Sign -> Set.Set Symbol symOf = Set.unions . map (\ (i, l) -> Set.fromList . concatMap (\ y -> let s = relSrc y t = relTrg y in [Con s, Con t, Rel $ Sgn (idToSimpleId i) y]) $ Set.toList l) . Map.toList . rels
330
symOf = Set.unions . map (\ (i, l) -> Set.fromList . concatMap (\ y -> let s = relSrc y t = relTrg y in [Con s, Con t, Rel $ Sgn (idToSimpleId i) y]) $ Set.toList l) . Map.toList . rels
298
false
true
0
22
160
131
66
65
null
null
mightymoose/liquidhaskell
benchmarks/containers-0.5.0.0/Data/IntSet/Base.hs
bsd-3-clause
equal (Tip kx1 bm1) (Tip kx2 bm2) = kx1 == kx2 && bm1 == bm2
62
equal (Tip kx1 bm1) (Tip kx2 bm2) = kx1 == kx2 && bm1 == bm2
62
equal (Tip kx1 bm1) (Tip kx2 bm2) = kx1 == kx2 && bm1 == bm2
62
false
false
2
6
16
44
20
24
null
null
phylake/AS3-AST
Data/AS3/AST/Grammar/Expressions.hs
bsd-3-clause
array_literal :: As3Parser Expression array_literal = liftM ArrayLiteral $ between_brackets comma_expression
108
array_literal :: As3Parser Expression array_literal = liftM ArrayLiteral $ between_brackets comma_expression
108
array_literal = liftM ArrayLiteral $ between_brackets comma_expression
70
false
true
0
6
10
24
11
13
null
null
nick8325/kbc
src/Twee/Term.hs
bsd-3-clause
substSize :: Subst f -> Int substSize (Subst sub) | IntMap.null sub = 0 | otherwise = fst (IntMap.findMax sub) + 1
118
substSize :: Subst f -> Int substSize (Subst sub) | IntMap.null sub = 0 | otherwise = fst (IntMap.findMax sub) + 1
118
substSize (Subst sub) | IntMap.null sub = 0 | otherwise = fst (IntMap.findMax sub) + 1
90
false
true
1
9
25
61
28
33
null
null
sheganinans/plugins
src/System/Plugins/Utils.hs
lgpl-2.1
encode_ch '&' = "za"
21
encode_ch '&' = "za"
21
encode_ch '&' = "za"
21
false
false
0
4
4
10
4
6
null
null
zaxtax/hakaru
haskell/Examples/SlamEmbed.hs
bsd-3-clause
newPhi :: (Embed repr) => repr Dims -> repr Coords -> repr Steering -> repr DelTime -> repr Angle newPhi ds cds s delT = (vPhi cds) + delT*(vel s)*(tan (alpha s)) / (dimL ds)
181
newPhi :: (Embed repr) => repr Dims -> repr Coords -> repr Steering -> repr DelTime -> repr Angle newPhi ds cds s delT = (vPhi cds) + delT*(vel s)*(tan (alpha s)) / (dimL ds)
181
newPhi ds cds s delT = (vPhi cds) + delT*(vel s)*(tan (alpha s)) / (dimL ds)
76
false
true
0
10
41
106
51
55
null
null
Thell/pandoc
src/Text/Pandoc/Writers/OpenDocument.hs
gpl-2.0
when :: Bool -> Doc -> Doc when p a = if p then a else empty
60
when :: Bool -> Doc -> Doc when p a = if p then a else empty
60
when p a = if p then a else empty
33
false
true
0
6
16
32
17
15
null
null
psibi/cassava
Data/Csv/Encoding.hs
bsd-3-clause
-- | Like 'encodeByName', but header and field order is dictated by -- the 'Conversion.header' method. encodeDefaultOrderedByName :: (Conversion.DefaultOrdered a, ToNamedRecord a) => [a] -> L.ByteString encodeDefaultOrderedByName = encodeDefaultOrderedByNameWith defaultEncodeOptions
313
encodeDefaultOrderedByName :: (Conversion.DefaultOrdered a, ToNamedRecord a) => [a] -> L.ByteString encodeDefaultOrderedByName = encodeDefaultOrderedByNameWith defaultEncodeOptions
210
encodeDefaultOrderedByName = encodeDefaultOrderedByNameWith defaultEncodeOptions
80
true
true
0
7
59
42
23
19
null
null
alexliew/learn_you_a_haskell
code/hof.hs
unlicense
map' :: (a -> b) -> [a] -> [b] map' _ [] = []
45
map' :: (a -> b) -> [a] -> [b] map' _ [] = []
45
map' _ [] = []
14
false
true
0
7
13
41
22
19
null
null
shlevy/ghc
compiler/iface/BuildTyCl.hs
bsd-3-clause
buildPatSyn :: Name -> Bool -> (Id,Bool) -> Maybe (Id, Bool) -> ([TyVarBinder], ThetaType) -- ^ Univ and req -> ([TyVarBinder], ThetaType) -- ^ Ex and prov -> [Type] -- ^ Argument types -> Type -- ^ Result type -> [FieldLabel] -- ^ Field labels for -- a record pattern synonym -> PatSyn buildPatSyn src_name declared_infix matcher@(matcher_id,_) builder (univ_tvs, req_theta) (ex_tvs, prov_theta) arg_tys pat_ty field_labels = -- The assertion checks that the matcher is -- compatible with the pattern synonym ASSERT2((and [ univ_tvs `equalLength` univ_tvs1 , ex_tvs `equalLength` ex_tvs1 , pat_ty `eqType` substTy subst pat_ty1 , prov_theta `eqTypes` substTys subst prov_theta1 , req_theta `eqTypes` substTys subst req_theta1 , compareArgTys arg_tys (substTys subst arg_tys1) ]) , (vcat [ ppr univ_tvs <+> twiddle <+> ppr univ_tvs1 , ppr ex_tvs <+> twiddle <+> ppr ex_tvs1 , ppr pat_ty <+> twiddle <+> ppr pat_ty1 , ppr prov_theta <+> twiddle <+> ppr prov_theta1 , ppr req_theta <+> twiddle <+> ppr req_theta1 , ppr arg_tys <+> twiddle <+> ppr arg_tys1])) mkPatSyn src_name declared_infix (univ_tvs, req_theta) (ex_tvs, prov_theta) arg_tys pat_ty matcher builder field_labels where ((_:_:univ_tvs1), req_theta1, tau) = tcSplitSigmaTy $ idType matcher_id ([pat_ty1, cont_sigma, _], _) = tcSplitFunTys tau (ex_tvs1, prov_theta1, cont_tau) = tcSplitSigmaTy cont_sigma (arg_tys1, _) = (tcSplitFunTys cont_tau) twiddle = char '~' subst = zipTvSubst (univ_tvs1 ++ ex_tvs1) (mkTyVarTys (binderVars (univ_tvs ++ ex_tvs))) -- For a nullary pattern synonym we add a single void argument to the -- matcher to preserve laziness in the case of unlifted types. -- See #12746 compareArgTys :: [Type] -> [Type] -> Bool compareArgTys [] [x] = x `eqType` voidPrimTy compareArgTys arg_tys matcher_arg_tys = arg_tys `eqTypes` matcher_arg_tys ------------------------------------------------------
2,411
buildPatSyn :: Name -> Bool -> (Id,Bool) -> Maybe (Id, Bool) -> ([TyVarBinder], ThetaType) -- ^ Univ and req -> ([TyVarBinder], ThetaType) -- ^ Ex and prov -> [Type] -- ^ Argument types -> Type -- ^ Result type -> [FieldLabel] -- ^ Field labels for -- a record pattern synonym -> PatSyn buildPatSyn src_name declared_infix matcher@(matcher_id,_) builder (univ_tvs, req_theta) (ex_tvs, prov_theta) arg_tys pat_ty field_labels = -- The assertion checks that the matcher is -- compatible with the pattern synonym ASSERT2((and [ univ_tvs `equalLength` univ_tvs1 , ex_tvs `equalLength` ex_tvs1 , pat_ty `eqType` substTy subst pat_ty1 , prov_theta `eqTypes` substTys subst prov_theta1 , req_theta `eqTypes` substTys subst req_theta1 , compareArgTys arg_tys (substTys subst arg_tys1) ]) , (vcat [ ppr univ_tvs <+> twiddle <+> ppr univ_tvs1 , ppr ex_tvs <+> twiddle <+> ppr ex_tvs1 , ppr pat_ty <+> twiddle <+> ppr pat_ty1 , ppr prov_theta <+> twiddle <+> ppr prov_theta1 , ppr req_theta <+> twiddle <+> ppr req_theta1 , ppr arg_tys <+> twiddle <+> ppr arg_tys1])) mkPatSyn src_name declared_infix (univ_tvs, req_theta) (ex_tvs, prov_theta) arg_tys pat_ty matcher builder field_labels where ((_:_:univ_tvs1), req_theta1, tau) = tcSplitSigmaTy $ idType matcher_id ([pat_ty1, cont_sigma, _], _) = tcSplitFunTys tau (ex_tvs1, prov_theta1, cont_tau) = tcSplitSigmaTy cont_sigma (arg_tys1, _) = (tcSplitFunTys cont_tau) twiddle = char '~' subst = zipTvSubst (univ_tvs1 ++ ex_tvs1) (mkTyVarTys (binderVars (univ_tvs ++ ex_tvs))) -- For a nullary pattern synonym we add a single void argument to the -- matcher to preserve laziness in the case of unlifted types. -- See #12746 compareArgTys :: [Type] -> [Type] -> Bool compareArgTys [] [x] = x `eqType` voidPrimTy compareArgTys arg_tys matcher_arg_tys = arg_tys `eqTypes` matcher_arg_tys ------------------------------------------------------
2,411
buildPatSyn src_name declared_infix matcher@(matcher_id,_) builder (univ_tvs, req_theta) (ex_tvs, prov_theta) arg_tys pat_ty field_labels = -- The assertion checks that the matcher is -- compatible with the pattern synonym ASSERT2((and [ univ_tvs `equalLength` univ_tvs1 , ex_tvs `equalLength` ex_tvs1 , pat_ty `eqType` substTy subst pat_ty1 , prov_theta `eqTypes` substTys subst prov_theta1 , req_theta `eqTypes` substTys subst req_theta1 , compareArgTys arg_tys (substTys subst arg_tys1) ]) , (vcat [ ppr univ_tvs <+> twiddle <+> ppr univ_tvs1 , ppr ex_tvs <+> twiddle <+> ppr ex_tvs1 , ppr pat_ty <+> twiddle <+> ppr pat_ty1 , ppr prov_theta <+> twiddle <+> ppr prov_theta1 , ppr req_theta <+> twiddle <+> ppr req_theta1 , ppr arg_tys <+> twiddle <+> ppr arg_tys1])) mkPatSyn src_name declared_infix (univ_tvs, req_theta) (ex_tvs, prov_theta) arg_tys pat_ty matcher builder field_labels where ((_:_:univ_tvs1), req_theta1, tau) = tcSplitSigmaTy $ idType matcher_id ([pat_ty1, cont_sigma, _], _) = tcSplitFunTys tau (ex_tvs1, prov_theta1, cont_tau) = tcSplitSigmaTy cont_sigma (arg_tys1, _) = (tcSplitFunTys cont_tau) twiddle = char '~' subst = zipTvSubst (univ_tvs1 ++ ex_tvs1) (mkTyVarTys (binderVars (univ_tvs ++ ex_tvs))) -- For a nullary pattern synonym we add a single void argument to the -- matcher to preserve laziness in the case of unlifted types. -- See #12746 compareArgTys :: [Type] -> [Type] -> Bool compareArgTys [] [x] = x `eqType` voidPrimTy compareArgTys arg_tys matcher_arg_tys = arg_tys `eqTypes` matcher_arg_tys ------------------------------------------------------
1,964
false
true
0
14
801
567
313
254
null
null
romanb/amazonka
amazonka-storagegateway/gen/Network/AWS/StorageGateway/Types.hs
mpl-2.0
sscsivPreservedExistingData :: Lens' StorediSCSIVolume (Maybe Bool) sscsivPreservedExistingData = lens _sscsivPreservedExistingData (\s a -> s { _sscsivPreservedExistingData = a })
192
sscsivPreservedExistingData :: Lens' StorediSCSIVolume (Maybe Bool) sscsivPreservedExistingData = lens _sscsivPreservedExistingData (\s a -> s { _sscsivPreservedExistingData = a })
192
sscsivPreservedExistingData = lens _sscsivPreservedExistingData (\s a -> s { _sscsivPreservedExistingData = a })
124
false
true
0
9
30
45
24
21
null
null
nikai3d/ce-challenges
easy/working_experience.hs
bsd-3-clause
workm (x:xs) = [(month y)..(month z)] ++ workm xs where [y, z] = splitOn "-" x
91
workm (x:xs) = [(month y)..(month z)] ++ workm xs where [y, z] = splitOn "-" x
91
workm (x:xs) = [(month y)..(month z)] ++ workm xs where [y, z] = splitOn "-" x
91
false
false
0
8
28
59
30
29
null
null
supermitch/learn-haskell
edx-fp101x/5_hw.hs
mit
merge :: Ord a => [a] -> [a] -> [a] test_merge = do print("[1,2,3,4,5,6]", merge [2,5,6] [1,3,4])
103
merge :: Ord a => [a] -> [a] -> [a] test_merge = do print("[1,2,3,4,5,6]", merge [2,5,6] [1,3,4])
101
test_merge = do print("[1,2,3,4,5,6]", merge [2,5,6] [1,3,4])
65
false
true
0
11
22
74
40
34
null
null
johannesgerer/buchhaltung
src/Buchhaltung/Uniques.hs
mit
prettyPrint :: Maybe Int -> FilledEntry -> Aged Entry -> TL.Text -- ^ Message -> Int -- ^ Remaining -> T.Text prettyPrint cost new (Aged age old) msg remain = let union2 = f . second unzip . unzip . M.toList $ M.mergeWithKey g (fmap $ flip (,) "<empty>") (fmap $ (,) "<empty>") (either (const mempty) sourceToMap $ oldSource) $ sourceToMap $ ieSource new g _ x y | x == y = Just $ (x, "") | True = Just $ (x, y) f (k,(old,new)) = T.pack $ P.render $ table [20, 25, 25] header [k, old, new] oldName Old = "Old" oldName New = "Imported earlier" header = ["Field", oldName age, "New"] oldSource = ieSource old showError (Left x) = ["" ,"Error retrieving old transaction's source:" , T.pack x] showError (Right _) = [] def _ Nothing = "n.a." def f (Just x) = f x in L.unlines $ [ union2 ] ++ [ sformat ("changes: "%F.s%"/"%F.s%"\n"%F.t%"Remaining existing duplicates: "%F.d) (def (show . negate) cost) (def (show . TL.length . json) $ eitherToMaybe $ ieSource old) msg remain ] ++ showError oldSource
1,372
prettyPrint :: Maybe Int -> FilledEntry -> Aged Entry -> TL.Text -- ^ Message -> Int -- ^ Remaining -> T.Text prettyPrint cost new (Aged age old) msg remain = let union2 = f . second unzip . unzip . M.toList $ M.mergeWithKey g (fmap $ flip (,) "<empty>") (fmap $ (,) "<empty>") (either (const mempty) sourceToMap $ oldSource) $ sourceToMap $ ieSource new g _ x y | x == y = Just $ (x, "") | True = Just $ (x, y) f (k,(old,new)) = T.pack $ P.render $ table [20, 25, 25] header [k, old, new] oldName Old = "Old" oldName New = "Imported earlier" header = ["Field", oldName age, "New"] oldSource = ieSource old showError (Left x) = ["" ,"Error retrieving old transaction's source:" , T.pack x] showError (Right _) = [] def _ Nothing = "n.a." def f (Just x) = f x in L.unlines $ [ union2 ] ++ [ sformat ("changes: "%F.s%"/"%F.s%"\n"%F.t%"Remaining existing duplicates: "%F.d) (def (show . negate) cost) (def (show . TL.length . json) $ eitherToMaybe $ ieSource old) msg remain ] ++ showError oldSource
1,372
prettyPrint cost new (Aged age old) msg remain = let union2 = f . second unzip . unzip . M.toList $ M.mergeWithKey g (fmap $ flip (,) "<empty>") (fmap $ (,) "<empty>") (either (const mempty) sourceToMap $ oldSource) $ sourceToMap $ ieSource new g _ x y | x == y = Just $ (x, "") | True = Just $ (x, y) f (k,(old,new)) = T.pack $ P.render $ table [20, 25, 25] header [k, old, new] oldName Old = "Old" oldName New = "Imported earlier" header = ["Field", oldName age, "New"] oldSource = ieSource old showError (Left x) = ["" ,"Error retrieving old transaction's source:" , T.pack x] showError (Right _) = [] def _ Nothing = "n.a." def f (Just x) = f x in L.unlines $ [ union2 ] ++ [ sformat ("changes: "%F.s%"/"%F.s%"\n"%F.t%"Remaining existing duplicates: "%F.d) (def (show . negate) cost) (def (show . TL.length . json) $ eitherToMaybe $ ieSource old) msg remain ] ++ showError oldSource
1,238
false
true
0
19
559
502
258
244
null
null
deweyvm/kayvee
src/Database/Kayvee/Common.hs
mit
readWord :: Get a -> Get (Maybe a) readWord get' = do empty <- isEmpty if empty then return Nothing else do word <- get' return $ Just word
167
readWord :: Get a -> Get (Maybe a) readWord get' = do empty <- isEmpty if empty then return Nothing else do word <- get' return $ Just word
167
readWord get' = do empty <- isEmpty if empty then return Nothing else do word <- get' return $ Just word
132
false
true
0
11
56
68
31
37
null
null
tcrayford/hitcask
Database/Hitcask/Compact.hs
bsd-3-clause
readImmutableLog :: LogFile -> IO B.ByteString readImmutableLog (LogFile h _) = do s <- hFileSize h hSeek h AbsoluteSeek 0 B.hGetNonBlocking h (fromIntegral s)
165
readImmutableLog :: LogFile -> IO B.ByteString readImmutableLog (LogFile h _) = do s <- hFileSize h hSeek h AbsoluteSeek 0 B.hGetNonBlocking h (fromIntegral s)
165
readImmutableLog (LogFile h _) = do s <- hFileSize h hSeek h AbsoluteSeek 0 B.hGetNonBlocking h (fromIntegral s)
118
false
true
0
9
29
71
31
40
null
null
tabemann/botwars
src/Robots/Genetic/HunterKiller/VM.hs
bsd-3-clause
castToBool (RobotIntrinsic _) = True
36
castToBool (RobotIntrinsic _) = True
36
castToBool (RobotIntrinsic _) = True
36
false
false
0
6
4
16
7
9
null
null
korczis/haskell-world
lib/Statistics.hs
mit
-- | Harmonic mean of values harmonic :: (Floating a) => [a] -> a harmonic xs = 1 / (sum [1 / x | x <- xs] / fromIntegral(length xs))
133
harmonic :: (Floating a) => [a] -> a harmonic xs = 1 / (sum [1 / x | x <- xs] / fromIntegral(length xs))
104
harmonic xs = 1 / (sum [1 / x | x <- xs] / fromIntegral(length xs))
67
true
true
2
11
29
76
37
39
null
null
coolhacks/scripts-hacks
examples/shellcheck-master/ShellCheck/Parser.hs
mit
prop_readExtglob4 = isOk readExtglob "+(foo \\) bar)"
53
prop_readExtglob4 = isOk readExtglob "+(foo \\) bar)"
53
prop_readExtglob4 = isOk readExtglob "+(foo \\) bar)"
53
false
false
0
5
6
11
5
6
null
null
GaloisInc/verification-game
web-prover/exes/SolveEasy.hs
bsd-3-clause
isCopyMulti :: Stats -> Bool isCopyMulti Stats { .. } = case solvedState of Solved -> usedDrag && not singleGoal && not usedFuns _ -> False
154
isCopyMulti :: Stats -> Bool isCopyMulti Stats { .. } = case solvedState of Solved -> usedDrag && not singleGoal && not usedFuns _ -> False
154
isCopyMulti Stats { .. } = case solvedState of Solved -> usedDrag && not singleGoal && not usedFuns _ -> False
125
false
true
0
10
40
59
27
32
null
null
brendanhay/gogol
gogol-androidmanagement/gen/Network/Google/AndroidManagement/Types/Product.hs
mpl-2.0
dspAddtional :: Lens' DeviceSystemProperties (HashMap Text Text) dspAddtional = lens _dspAddtional (\ s a -> s{_dspAddtional = a}) . _Coerce
148
dspAddtional :: Lens' DeviceSystemProperties (HashMap Text Text) dspAddtional = lens _dspAddtional (\ s a -> s{_dspAddtional = a}) . _Coerce
148
dspAddtional = lens _dspAddtional (\ s a -> s{_dspAddtional = a}) . _Coerce
83
false
true
2
9
27
57
27
30
null
null
dzotokan/minions-api
src/lib/MinionsApi/Config.hs
mit
makePool Production = do connStr <- lookupDatabaseUrl runStdoutLoggingT $ createPostgresqlPool connStr (envPool Production)
128
makePool Production = do connStr <- lookupDatabaseUrl runStdoutLoggingT $ createPostgresqlPool connStr (envPool Production)
128
makePool Production = do connStr <- lookupDatabaseUrl runStdoutLoggingT $ createPostgresqlPool connStr (envPool Production)
128
false
false
0
10
17
34
15
19
null
null
skedgeme/wrecker
src/Wrecker/Recorder.hs
bsd-3-clause
{- | 'record' is a low level function for collecting timing information. Wrap each action of interest in a call to record. > record recorder $ threadDelay 1000000 'record' measures the elapsed time of the call, and catches 'HttpException' in the case of failure. This means failures must be thrown if they are to be properly recorded. -} record :: forall a. Recorder -> String -> IO a -> IO a record recorder key action = do startTime <- getTime Monotonic let recordAction :: IO a recordAction = do r <- action endTime <- getTime Monotonic let !elapsedTime' = diffSeconds endTime startTime addEvent recorder $ Success { resultTime = elapsedTime' , name = key } return r recordException :: HTTP.HttpException -> IO a recordException e = do endTime <- getTime Monotonic case e of #if MIN_VERSION_http_client(0,5,0) HTTP.HttpExceptionRequest _ (HTTP.StatusCodeException resp _) -> do let code = HTTP.statusCode $ HTTP.responseStatus resp #else HTTP.StatusCodeException stat _ _ -> do let code = HTTP.statusCode stat #endif addEvent recorder $ ErrorStatus { resultTime = diffSeconds endTime startTime , errorCode = code , name = key } _ -> addEvent recorder $ Error { resultTime = diffSeconds endTime startTime , exception = toException e , name = key } -- rethrow no matter what throwIO e handle recordException recordAction
1,882
record :: forall a. Recorder -> String -> IO a -> IO a record recorder key action = do startTime <- getTime Monotonic let recordAction :: IO a recordAction = do r <- action endTime <- getTime Monotonic let !elapsedTime' = diffSeconds endTime startTime addEvent recorder $ Success { resultTime = elapsedTime' , name = key } return r recordException :: HTTP.HttpException -> IO a recordException e = do endTime <- getTime Monotonic case e of #if MIN_VERSION_http_client(0,5,0) HTTP.HttpExceptionRequest _ (HTTP.StatusCodeException resp _) -> do let code = HTTP.statusCode $ HTTP.responseStatus resp #else HTTP.StatusCodeException stat _ _ -> do let code = HTTP.statusCode stat #endif addEvent recorder $ ErrorStatus { resultTime = diffSeconds endTime startTime , errorCode = code , name = key } _ -> addEvent recorder $ Error { resultTime = diffSeconds endTime startTime , exception = toException e , name = key } -- rethrow no matter what throwIO e handle recordException recordAction
1,530
record recorder key action = do startTime <- getTime Monotonic let recordAction :: IO a recordAction = do r <- action endTime <- getTime Monotonic let !elapsedTime' = diffSeconds endTime startTime addEvent recorder $ Success { resultTime = elapsedTime' , name = key } return r recordException :: HTTP.HttpException -> IO a recordException e = do endTime <- getTime Monotonic case e of #if MIN_VERSION_http_client(0,5,0) HTTP.HttpExceptionRequest _ (HTTP.StatusCodeException resp _) -> do let code = HTTP.statusCode $ HTTP.responseStatus resp #else HTTP.StatusCodeException stat _ _ -> do let code = HTTP.statusCode stat #endif addEvent recorder $ ErrorStatus { resultTime = diffSeconds endTime startTime , errorCode = code , name = key } _ -> addEvent recorder $ Error { resultTime = diffSeconds endTime startTime , exception = toException e , name = key } -- rethrow no matter what throwIO e handle recordException recordAction
1,475
true
true
0
23
774
313
150
163
null
null
erikd/hs-tls
core/Tests/Connection.hs
bsd-3-clause
arbitraryHashSignaturePair :: Gen ([HashAndSignatureAlgorithm], [HashAndSignatureAlgorithm]) arbitraryHashSignaturePair = do serverHashSignatures <- shuffle knownHashSignatures clientHashSignatures <- shuffle knownHashSignatures return (clientHashSignatures, serverHashSignatures)
292
arbitraryHashSignaturePair :: Gen ([HashAndSignatureAlgorithm], [HashAndSignatureAlgorithm]) arbitraryHashSignaturePair = do serverHashSignatures <- shuffle knownHashSignatures clientHashSignatures <- shuffle knownHashSignatures return (clientHashSignatures, serverHashSignatures)
292
arbitraryHashSignaturePair = do serverHashSignatures <- shuffle knownHashSignatures clientHashSignatures <- shuffle knownHashSignatures return (clientHashSignatures, serverHashSignatures)
199
false
true
0
9
30
64
30
34
null
null
adarqui/Codex
src/Codex/Lib/LoadBalancer/List.hs
bsd-3-clause
add'shards :: Wrapper a -> [[a]] -> Wrapper a add'shards w@Wrapper{..} shards = w { _list = new_shards, _shards = length new_shards } where new_shards = _list ++ shards
171
add'shards :: Wrapper a -> [[a]] -> Wrapper a add'shards w@Wrapper{..} shards = w { _list = new_shards, _shards = length new_shards } where new_shards = _list ++ shards
171
add'shards w@Wrapper{..} shards = w { _list = new_shards, _shards = length new_shards } where new_shards = _list ++ shards
125
false
true
0
8
31
74
39
35
null
null
JacquesCarette/literate-scientific-software
code/drasil-example/Drasil/SWHS/Assumptions.hs
bsd-2-clause
assumpS19 = foldlSent [ S "The pressure in the", phrase tank, S "is atmospheric" `sC` S "so the", phrase meltPt `sAnd` phrase boilPt `sAre` S (show (0 :: Integer)) :+: Sy (unit_symb temp) `sAnd` S (show (100 :: Integer)) :+: Sy (unit_symb temp) `sC` S "respectively"]
275
assumpS19 = foldlSent [ S "The pressure in the", phrase tank, S "is atmospheric" `sC` S "so the", phrase meltPt `sAnd` phrase boilPt `sAre` S (show (0 :: Integer)) :+: Sy (unit_symb temp) `sAnd` S (show (100 :: Integer)) :+: Sy (unit_symb temp) `sC` S "respectively"]
275
assumpS19 = foldlSent [ S "The pressure in the", phrase tank, S "is atmospheric" `sC` S "so the", phrase meltPt `sAnd` phrase boilPt `sAre` S (show (0 :: Integer)) :+: Sy (unit_symb temp) `sAnd` S (show (100 :: Integer)) :+: Sy (unit_symb temp) `sC` S "respectively"]
275
false
false
0
15
53
128
67
61
null
null
mikeizbicki/HerbiePlugin
test/SpecialFunctions.hs
bsd-3-clause
test3 :: Double -> Double test3 a = exp a - 1
45
test3 :: Double -> Double test3 a = exp a - 1
45
test3 a = exp a - 1
19
false
true
0
6
11
25
12
13
null
null
ennocramer/hindent
src/HIndent/Styles/ChrisDone.hs
bsd-3-clause
-- | Column limit: 50 smallColumnLimit :: Int64 smallColumnLimit = 50
69
smallColumnLimit :: Int64 smallColumnLimit = 50
47
smallColumnLimit = 50
21
true
true
0
4
10
12
7
5
null
null
recursion-ninja/megaparsec
tests/Text/Megaparsec/ByteSpec.hs
bsd-2-clause
checkStrLit :: String -> ByteString -> Parser ByteString -> SpecWith () checkStrLit name ts p = do context ("when stream begins with " ++ name) $ it ("parses the " ++ name) $ property $ \s -> do let s' = ts <> s prs p s' `shouldParse` ts prs' p s' `succeedsLeaving` s context ("when stream does not begin with " ++ name) $ it "signals correct parse error" $ property $ \ch s -> ch /= B.head ts ==> do let s' = B.cons ch s us = B.unpack $ B.take (B.length ts) s' ps = B.unpack ts prs p s' `shouldFailWith` err posI (utoks us <> etoks ps) prs' p s' `failsLeaving` s' context "when stream is empty" $ it "signals correct parse error" $ prs p "" `shouldFailWith` err posI (ueof <> etoks (B.unpack ts))
808
checkStrLit :: String -> ByteString -> Parser ByteString -> SpecWith () checkStrLit name ts p = do context ("when stream begins with " ++ name) $ it ("parses the " ++ name) $ property $ \s -> do let s' = ts <> s prs p s' `shouldParse` ts prs' p s' `succeedsLeaving` s context ("when stream does not begin with " ++ name) $ it "signals correct parse error" $ property $ \ch s -> ch /= B.head ts ==> do let s' = B.cons ch s us = B.unpack $ B.take (B.length ts) s' ps = B.unpack ts prs p s' `shouldFailWith` err posI (utoks us <> etoks ps) prs' p s' `failsLeaving` s' context "when stream is empty" $ it "signals correct parse error" $ prs p "" `shouldFailWith` err posI (ueof <> etoks (B.unpack ts))
808
checkStrLit name ts p = do context ("when stream begins with " ++ name) $ it ("parses the " ++ name) $ property $ \s -> do let s' = ts <> s prs p s' `shouldParse` ts prs' p s' `succeedsLeaving` s context ("when stream does not begin with " ++ name) $ it "signals correct parse error" $ property $ \ch s -> ch /= B.head ts ==> do let s' = B.cons ch s us = B.unpack $ B.take (B.length ts) s' ps = B.unpack ts prs p s' `shouldFailWith` err posI (utoks us <> etoks ps) prs' p s' `failsLeaving` s' context "when stream is empty" $ it "signals correct parse error" $ prs p "" `shouldFailWith` err posI (ueof <> etoks (B.unpack ts))
736
false
true
0
19
249
316
152
164
null
null
aviaviavi/confetti
src/Confetti.hs
mit
concatVariantExists :: [ApplyError a] -> ApplyError a concatVariantExists = foldr appendVariantExists (VariantAlreadyExists [])
127
concatVariantExists :: [ApplyError a] -> ApplyError a concatVariantExists = foldr appendVariantExists (VariantAlreadyExists [])
127
concatVariantExists = foldr appendVariantExists (VariantAlreadyExists [])
73
false
true
0
8
12
37
18
19
null
null
beastaugh/hatt
src/hatt.hs
bsd-3-clause
parseCommand :: String -> Command parseCommand input = case cmd . words $ input of "" -> Error "you must enter an expression or a command." "exit" -> Exit "help" -> Help "pretty" -> Pretty "colour" -> Coloured "nnf" -> eval_ (Convert NNF) (getExpr input) "cnf" -> eval_ (Convert CNF) (getExpr input) "dnf" -> eval_ (Convert DNF) (getExpr input) _ -> eval_ Eval input where cmd [] = "" cmd ws = map toLower . head $ ws eval_ dt str = case parseExpr "hatt" str of Left err -> Error $ "parse error at " ++ show err Right expr -> dt expr getExpr = unwords . tail . words
878
parseCommand :: String -> Command parseCommand input = case cmd . words $ input of "" -> Error "you must enter an expression or a command." "exit" -> Exit "help" -> Help "pretty" -> Pretty "colour" -> Coloured "nnf" -> eval_ (Convert NNF) (getExpr input) "cnf" -> eval_ (Convert CNF) (getExpr input) "dnf" -> eval_ (Convert DNF) (getExpr input) _ -> eval_ Eval input where cmd [] = "" cmd ws = map toLower . head $ ws eval_ dt str = case parseExpr "hatt" str of Left err -> Error $ "parse error at " ++ show err Right expr -> dt expr getExpr = unwords . tail . words
878
parseCommand input = case cmd . words $ input of "" -> Error "you must enter an expression or a command." "exit" -> Exit "help" -> Help "pretty" -> Pretty "colour" -> Coloured "nnf" -> eval_ (Convert NNF) (getExpr input) "cnf" -> eval_ (Convert CNF) (getExpr input) "dnf" -> eval_ (Convert DNF) (getExpr input) _ -> eval_ Eval input where cmd [] = "" cmd ws = map toLower . head $ ws eval_ dt str = case parseExpr "hatt" str of Left err -> Error $ "parse error at " ++ show err Right expr -> dt expr getExpr = unwords . tail . words
844
false
true
0
10
422
245
115
130
null
null
bitemyapp/hakaru
Examples/Slam.hs
bsd-3-clause
hakvec :: (Mochastic repr) => repr (Measure (Vector H.Real)) hakvec = plate $ vector 11 (const (normal 0 1))
108
hakvec :: (Mochastic repr) => repr (Measure (Vector H.Real)) hakvec = plate $ vector 11 (const (normal 0 1))
108
hakvec = plate $ vector 11 (const (normal 0 1))
47
false
true
0
11
18
60
30
30
null
null
SkemaPlatform/skema-common
src/Skema/Util.hs
agpl-3.0
graphNodes :: Eq a => [(a,a)] -> [a] graphNodes = nub . uncurry (++) . unzip
76
graphNodes :: Eq a => [(a,a)] -> [a] graphNodes = nub . uncurry (++) . unzip
76
graphNodes = nub . uncurry (++) . unzip
39
false
true
0
8
15
47
26
21
null
null
ganeti/ganeti
src/Ganeti/Types.hs
bsd-2-clause
diskTemplateMovable DTBlock = False
41
diskTemplateMovable DTBlock = False
41
diskTemplateMovable DTBlock = False
41
false
false
0
5
9
9
4
5
null
null
UU-ComputerScience/uulib
src/UU/Parsing/Offside.hs
bsd-3-clause
operatorr f g (OP p) = OP (f g p)
33
operatorr f g (OP p) = OP (f g p)
33
operatorr f g (OP p) = OP (f g p)
33
false
false
0
7
9
30
14
16
null
null
brendanhay/gogol
gogol-games/gen/Network/Google/Games/Types/Product.hs
mpl-2.0
-- | Number of days since the player last played this game. E.g., 0, 1, 5, -- 10, ... . Not populated if there is not enough information. srDaysSinceLastPlayed :: Lens' StatsResponse (Maybe Int32) srDaysSinceLastPlayed = lens _srDaysSinceLastPlayed (\ s a -> s{_srDaysSinceLastPlayed = a}) . mapping _Coerce
321
srDaysSinceLastPlayed :: Lens' StatsResponse (Maybe Int32) srDaysSinceLastPlayed = lens _srDaysSinceLastPlayed (\ s a -> s{_srDaysSinceLastPlayed = a}) . mapping _Coerce
183
srDaysSinceLastPlayed = lens _srDaysSinceLastPlayed (\ s a -> s{_srDaysSinceLastPlayed = a}) . mapping _Coerce
124
true
true
0
10
61
56
29
27
null
null
aedanlombardo/HaskellPS
DSP-PBE/src/Types/Common.hs
bsd-3-clause
--gets 2nd item of triple getAmp :: Peak -> Double getAmp (_,amp) = amp
71
getAmp :: Peak -> Double getAmp (_,amp) = amp
45
getAmp (_,amp) = amp
20
true
true
0
6
13
25
14
11
null
null
tamaralipowski/courseography
hs/WebParsing/TimeConverter.hs
gpl-3.0
-- | Extends functionality of makeSlots halfHourSlots :: Double -> Double -> [Double] halfHourSlots start end = let hours = [start .. end - 1] in concatMap (\h -> [h, h + 0.5]) hours
191
halfHourSlots :: Double -> Double -> [Double] halfHourSlots start end = let hours = [start .. end - 1] in concatMap (\h -> [h, h + 0.5]) hours
151
halfHourSlots start end = let hours = [start .. end - 1] in concatMap (\h -> [h, h + 0.5]) hours
105
true
true
0
11
42
72
39
33
null
null
antonlogvinenko/algorithms-at-hand
algorithms-at-hand-haskell/test/AlgorithmsAtHandHaskell/Swallow/Test.hs
mit
swallowSuite :: TestTree swallowSuite = testGroup "Swallow" [testCase "swallow test" testSwallow]
101
swallowSuite :: TestTree swallowSuite = testGroup "Swallow" [testCase "swallow test" testSwallow]
101
swallowSuite = testGroup "Swallow" [testCase "swallow test" testSwallow]
76
false
true
0
7
14
24
12
12
null
null
bitonic/kyotocabinet
Database/KyotoCabinet/Operations.hs
bsd-3-clause
-- | Scan each record in parallel scanPara :: WithDB db => db -> VisitorFull -> Int -> IO () scanPara = withFor2 (unDB . getDB) kcdbscanpara
140
scanPara :: WithDB db => db -> VisitorFull -> Int -> IO () scanPara = withFor2 (unDB . getDB) kcdbscanpara
106
scanPara = withFor2 (unDB . getDB) kcdbscanpara
47
true
true
0
10
26
48
24
24
null
null
RNCryptor/rncryptor-hs
src/Crypto/RNCryptor/Types.hs
mit
-------------------------------------------------------------------------------- blockSize :: Int blockSize = 16
112
blockSize :: Int blockSize = 16
31
blockSize = 16
14
true
true
0
4
6
12
7
5
null
null
ssaavedra/liquidhaskell
src/Language/Haskell/Liquid/Types/RefType.hs
bsd-3-clause
mkRApp m s c ts rs r r' | isFun c, [t1, t2] <- ts = RFun dummySymbol t1 t2 $ refAppTyToFun r' | otherwise = subsFrees m s zs $ RApp c ts rs $ r `meet` r' -- (refAppTyToApp r') where zs = [(tv, toRSort t, t) | (tv, t) <- zip (freeVars c) ts]
254
mkRApp m s c ts rs r r' | isFun c, [t1, t2] <- ts = RFun dummySymbol t1 t2 $ refAppTyToFun r' | otherwise = subsFrees m s zs $ RApp c ts rs $ r `meet` r' -- (refAppTyToApp r') where zs = [(tv, toRSort t, t) | (tv, t) <- zip (freeVars c) ts]
254
mkRApp m s c ts rs r r' | isFun c, [t1, t2] <- ts = RFun dummySymbol t1 t2 $ refAppTyToFun r' | otherwise = subsFrees m s zs $ RApp c ts rs $ r `meet` r' -- (refAppTyToApp r') where zs = [(tv, toRSort t, t) | (tv, t) <- zip (freeVars c) ts]
254
false
false
3
11
70
164
74
90
null
null
urbanslug/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
eqClass_RDR, numClass_RDR, ordClass_RDR, enumClass_RDR, monadClass_RDR :: RdrName eqClass_RDR = nameRdrName eqClassName
135
eqClass_RDR, numClass_RDR, ordClass_RDR, enumClass_RDR, monadClass_RDR :: RdrName eqClass_RDR = nameRdrName eqClassName
135
eqClass_RDR = nameRdrName eqClassName
49
false
true
0
5
26
22
15
7
null
null
FranklinChen/twenty-four-days2015-of-hackage
src/MultisetExample.hs
bsd-3-clause
replaceNonLetterWithSpace :: Char -> Char replaceNonLetterWithSpace c | Char.isLetter c = c | otherwise = ' '
113
replaceNonLetterWithSpace :: Char -> Char replaceNonLetterWithSpace c | Char.isLetter c = c | otherwise = ' '
113
replaceNonLetterWithSpace c | Char.isLetter c = c | otherwise = ' '
71
false
true
0
9
20
38
17
21
null
null
apyrgio/ganeti
src/Ganeti/Logging/Lifted.hs
bsd-2-clause
-- | Log at debug level. logDebug :: (MonadLog b, MonadBase b m) => String -> m () logDebug = logAt DEBUG
105
logDebug :: (MonadLog b, MonadBase b m) => String -> m () logDebug = logAt DEBUG
80
logDebug = logAt DEBUG
22
true
true
0
8
21
41
21
20
null
null
dgonyeo/hydrazine
src/Hydrazine/Client/UI.hs
mit
-- Behaves the same as Brick.Widgets.Center.center, but without filling in -- the background with spaces. Useful when layering widgets. nonFillingCenter :: Widget -> Widget nonFillingCenter w = Widget (hSize w) (vSize w) $ do result <- render w c <- getContext let availableWidth = c^.availWidthL availableHeight = c^.availHeightL widgWidth = result^.imageL.to V.imageWidth widgHeight = result^.imageL.to V.imageHeight translateW = (availableWidth `div` 2) - (widgWidth `div` 2) translateH = (availableHeight `div` 2) - (widgHeight `div` 2) render $ translateBy (Location (translateW,translateH)) w
716
nonFillingCenter :: Widget -> Widget nonFillingCenter w = Widget (hSize w) (vSize w) $ do result <- render w c <- getContext let availableWidth = c^.availWidthL availableHeight = c^.availHeightL widgWidth = result^.imageL.to V.imageWidth widgHeight = result^.imageL.to V.imageHeight translateW = (availableWidth `div` 2) - (widgWidth `div` 2) translateH = (availableHeight `div` 2) - (widgHeight `div` 2) render $ translateBy (Location (translateW,translateH)) w
580
nonFillingCenter w = Widget (hSize w) (vSize w) $ do result <- render w c <- getContext let availableWidth = c^.availWidthL availableHeight = c^.availHeightL widgWidth = result^.imageL.to V.imageWidth widgHeight = result^.imageL.to V.imageHeight translateW = (availableWidth `div` 2) - (widgWidth `div` 2) translateH = (availableHeight `div` 2) - (widgHeight `div` 2) render $ translateBy (Location (translateW,translateH)) w
543
true
true
0
13
197
190
101
89
null
null
suhailshergill/liboleg
Data/Symbolic/DiffTest.hs
bsd-3-clause
test1' = $(reflectQC test1r) 2.0
32
test1' = $(reflectQC test1r) 2.0
32
test1' = $(reflectQC test1r) 2.0
32
false
false
0
8
4
19
8
11
null
null
lucasbraun/mt-rewrite
src/MtRewriteSelect.hs
bsd-3-clause
consolidateSelectItems (Pa.SelectItem ann e (Pa.Nmc n): items) prov = -- for the examples we look at, we know e is in universal format --> only add provenance for its new name let (p, newItems) = consolidateSelectItems items prov (provItems, _) = getProvenanceItem e p consolidate [provItem] = addToProvenance n provItem p consolidate _ = p in (consolidate provItems, Pa.SelectItem ann e (Pa.Nmc n):newItems)
474
consolidateSelectItems (Pa.SelectItem ann e (Pa.Nmc n): items) prov = -- for the examples we look at, we know e is in universal format --> only add provenance for its new name let (p, newItems) = consolidateSelectItems items prov (provItems, _) = getProvenanceItem e p consolidate [provItem] = addToProvenance n provItem p consolidate _ = p in (consolidate provItems, Pa.SelectItem ann e (Pa.Nmc n):newItems)
474
consolidateSelectItems (Pa.SelectItem ann e (Pa.Nmc n): items) prov = -- for the examples we look at, we know e is in universal format --> only add provenance for its new name let (p, newItems) = consolidateSelectItems items prov (provItems, _) = getProvenanceItem e p consolidate [provItem] = addToProvenance n provItem p consolidate _ = p in (consolidate provItems, Pa.SelectItem ann e (Pa.Nmc n):newItems)
474
false
false
0
12
128
132
66
66
null
null
nushio3/Paraiso
attic/newexp/test1.hs
bsd-3-clause
σ _ = "tensor rank mismatch in σ"
33
σ _ = "tensor rank mismatch in σ"
33
σ _ = "tensor rank mismatch in σ"
33
false
false
0
4
7
10
4
6
null
null
xcv-/hfind
src/System/HFind/Expr/Error.hs
mit
renderError :: Doc -> Text renderError = toStrict . PP.displayT . PP.renderPretty 0.5 90
88
renderError :: Doc -> Text renderError = toStrict . PP.displayT . PP.renderPretty 0.5 90
88
renderError = toStrict . PP.displayT . PP.renderPretty 0.5 90
61
false
true
0
7
13
38
17
21
null
null
manugunther/sat
Sat/GUI/FileStatusbar.hs
gpl-3.0
updateFileStatusbarFileSave :: GuiMonad () updateFileStatusbarFileSave = getGState >>= \st -> do let mfp = st ^. gSatFile msg = maybe fileWithoutName (^. gname) mfp updateFileStatusbar $ msg
217
updateFileStatusbarFileSave :: GuiMonad () updateFileStatusbarFileSave = getGState >>= \st -> do let mfp = st ^. gSatFile msg = maybe fileWithoutName (^. gname) mfp updateFileStatusbar $ msg
217
updateFileStatusbarFileSave = getGState >>= \st -> do let mfp = st ^. gSatFile msg = maybe fileWithoutName (^. gname) mfp updateFileStatusbar $ msg
174
false
true
1
13
53
65
31
34
null
null
micknelso/language-c
src/Language/CFamily/CXX/DefTable.hs
bsd-3-clause
enterLocalScope :: DefTable -> DefTable enterLocalScope deftbl = deftbl { identDecls = enterNewScope (identDecls deftbl), tagDecls = enterNewScope (tagDecls deftbl) }
186
enterLocalScope :: DefTable -> DefTable enterLocalScope deftbl = deftbl { identDecls = enterNewScope (identDecls deftbl), tagDecls = enterNewScope (tagDecls deftbl) }
186
enterLocalScope deftbl = deftbl { identDecls = enterNewScope (identDecls deftbl), tagDecls = enterNewScope (tagDecls deftbl) }
146
false
true
0
9
40
50
26
24
null
null
ntc2/cryptol
src/Cryptol/ModuleSystem/Base.hs
bsd-3-clause
checkModule :: FilePath -> P.Module -> ModuleM T.Module checkModule path m = do -- remove includes first e <- io (removeIncludesModule path m) nim <- case e of Right nim -> return nim Left ierrs -> noIncludeErrors ierrs -- remove pattern bindings npm <- noPat nim -- rename everything scm <- renameModule npm let act = TCAction { tcAction = T.tcModule , tcLinter = moduleLinter (P.thing (P.mName m)) } -- typecheck tcm <- typecheck act scm =<< importIfacesTc (map thing (P.mImports scm)) return (Cryptol.Transform.MonoValues.rewModule tcm)
611
checkModule :: FilePath -> P.Module -> ModuleM T.Module checkModule path m = do -- remove includes first e <- io (removeIncludesModule path m) nim <- case e of Right nim -> return nim Left ierrs -> noIncludeErrors ierrs -- remove pattern bindings npm <- noPat nim -- rename everything scm <- renameModule npm let act = TCAction { tcAction = T.tcModule , tcLinter = moduleLinter (P.thing (P.mName m)) } -- typecheck tcm <- typecheck act scm =<< importIfacesTc (map thing (P.mImports scm)) return (Cryptol.Transform.MonoValues.rewModule tcm)
611
checkModule path m = do -- remove includes first e <- io (removeIncludesModule path m) nim <- case e of Right nim -> return nim Left ierrs -> noIncludeErrors ierrs -- remove pattern bindings npm <- noPat nim -- rename everything scm <- renameModule npm let act = TCAction { tcAction = T.tcModule , tcLinter = moduleLinter (P.thing (P.mName m)) } -- typecheck tcm <- typecheck act scm =<< importIfacesTc (map thing (P.mImports scm)) return (Cryptol.Transform.MonoValues.rewModule tcm)
555
false
true
0
18
156
208
98
110
null
null
marcellussiegburg/icfp-2015
Translate.hs
mit
west = "p'!.03"
15
west = "p'!.03"
15
west = "p'!.03"
15
false
false
0
4
2
6
3
3
null
null
osa1/rho-torrent
src/Rho/Utils.hs
bsd-3-clause
-- | Make a `Word16` from bytes. First argument is most-significant byte. -- -- >>> mkWord16 0x1 0x0 -- 256 -- -- >>> mkWord16 0x0 0x1 -- 1 -- mkWord16 :: Word8 -> Word8 -> Word16 mkWord16 w1 w2 = fromIntegral w1 `shiftL` 8 + fromIntegral w2
247
mkWord16 :: Word8 -> Word8 -> Word16 mkWord16 w1 w2 = fromIntegral w1 `shiftL` 8 + fromIntegral w2
104
mkWord16 w1 w2 = fromIntegral w1 `shiftL` 8 + fromIntegral w2
67
true
true
2
6
52
49
28
21
null
null
markuspf/Idris-dev
src/Idris/Docs.hs
bsd-3-clause
pprintDocs :: IState -> Docs -> Doc OutputAnnotation pprintDocs ist (FunDoc d) = pprintFDWithTotality ist True d
112
pprintDocs :: IState -> Docs -> Doc OutputAnnotation pprintDocs ist (FunDoc d) = pprintFDWithTotality ist True d
112
pprintDocs ist (FunDoc d) = pprintFDWithTotality ist True d
59
false
true
0
7
16
40
19
21
null
null
loganbraga/hunch
app/Hunch/Constants.hs
mit
maintainerName :: String maintainerName = "Logan Braga"
55
maintainerName :: String maintainerName = "Logan Braga"
55
maintainerName = "Logan Braga"
30
false
true
0
6
6
18
7
11
null
null
mcmaniac/ghc
compiler/cmm/OptimizationFuel.hs
bsd-3-clause
fuelConsumingPass :: String -> FuelConsumer a -> FuelUniqSM a fuelConsumingPass name f = do setFuelPass name fuel <- fuelGet let (a, fuel') = f fuel fuelSet fuel' return a
291
fuelConsumingPass :: String -> FuelConsumer a -> FuelUniqSM a fuelConsumingPass name f = do setFuelPass name fuel <- fuelGet let (a, fuel') = f fuel fuelSet fuel' return a
291
fuelConsumingPass name f = do setFuelPass name fuel <- fuelGet let (a, fuel') = f fuel fuelSet fuel' return a
229
false
true
0
10
148
74
32
42
null
null
m-alvarez/jhc
src/Grin/Noodle.hs
mit
funcDefBody_uM f fd@FuncDef { funcDefBody = b } = do b' <- f b return $ updateFuncDefProps fd { funcDefBody = b' }
123
funcDefBody_uM f fd@FuncDef { funcDefBody = b } = do b' <- f b return $ updateFuncDefProps fd { funcDefBody = b' }
123
funcDefBody_uM f fd@FuncDef { funcDefBody = b } = do b' <- f b return $ updateFuncDefProps fd { funcDefBody = b' }
123
false
false
0
10
31
51
25
26
null
null
tolysz/prepare-ghcjs
spec-lts8/base-pure/GHC/TopHandler.hs
bsd-3-clause
exitInterrupted :: IO a exitInterrupted = #ifdef mingw32_HOST_OS safeExit 252
79
exitInterrupted :: IO a exitInterrupted = #ifdef mingw32_HOST_OS safeExit 252
79
exitInterrupted = #ifdef mingw32_HOST_OS safeExit 252
55
false
true
0
5
11
18
9
9
null
null
aisamanra/matterhorn
src/Types/DirectionalSeq.hs
bsd-3-clause
onDirectedSeq :: SeqDirection dir => (Seq a -> Seq b) -> DirectionalSeq dir a -> DirectionalSeq dir b onDirectedSeq f = DSeq . f . dseq
149
onDirectedSeq :: SeqDirection dir => (Seq a -> Seq b) -> DirectionalSeq dir a -> DirectionalSeq dir b onDirectedSeq f = DSeq . f . dseq
149
onDirectedSeq f = DSeq . f . dseq
33
false
true
0
10
39
65
29
36
null
null
bstamour/wordstream
src/Text/WordStream/Tests.hs
bsd-3-clause
------------------------------------------------------------------------------------- -- Testing stuff clean :: String -> String clean = map toLower . filter isAlpha
166
clean :: String -> String clean = map toLower . filter isAlpha
62
clean = map toLower . filter isAlpha
36
true
true
0
7
16
33
15
18
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
390 = 389
9
390 = 389
9
390 = 389
9
false
false
1
5
2
10
3
7
null
null
kmels/hledger
hledger/Hledger/Cli/Options.hs
gpl-3.0
stripAddonExtension :: String -> String stripAddonExtension = regexReplace re "" where re = "\\.(" ++ intercalate "|" addonExtensions ++ ")$"
141
stripAddonExtension :: String -> String stripAddonExtension = regexReplace re "" where re = "\\.(" ++ intercalate "|" addonExtensions ++ ")$"
141
stripAddonExtension = regexReplace re "" where re = "\\.(" ++ intercalate "|" addonExtensions ++ ")$"
101
false
true
0
9
19
40
20
20
null
null
alexander-at-github/eta
compiler/ETA/BasicTypes/VarEnv.hs
bsd-3-clause
varEnvKeys = keysUFM
26
varEnvKeys = keysUFM
26
varEnvKeys = keysUFM
26
false
false
1
5
8
10
3
7
null
null
olorin/amazonka
amazonka-s3/test/Test/AWS/Gen/S3.hs
mpl-2.0
testDeleteBucket :: DeleteBucket -> TestTree testDeleteBucket = req "DeleteBucket" "fixture/DeleteBucket.yaml"
118
testDeleteBucket :: DeleteBucket -> TestTree testDeleteBucket = req "DeleteBucket" "fixture/DeleteBucket.yaml"
118
testDeleteBucket = req "DeleteBucket" "fixture/DeleteBucket.yaml"
73
false
true
0
5
17
21
10
11
null
null
ulyssesp/oscillare
src/Visuals.hs
gpl-3.0
shapes sides w s = frag "shapes.frag" [ ("i_size", xV4 s) , ("i_width", xV4 w) , ("i_sides", xV4 sides) ] []
222
shapes sides w s = frag "shapes.frag" [ ("i_size", xV4 s) , ("i_width", xV4 w) , ("i_sides", xV4 sides) ] []
222
shapes sides w s = frag "shapes.frag" [ ("i_size", xV4 s) , ("i_width", xV4 w) , ("i_sides", xV4 sides) ] []
222
false
false
0
8
134
58
31
27
null
null
lpeterse/koka
src/Kind/Infer.hs
apache-2.0
checkRes range = Check "The result of a function type must be a type" range
78
checkRes range = Check "The result of a function type must be a type" range
78
checkRes range = Check "The result of a function type must be a type" range
78
false
false
0
5
17
14
6
8
null
null
NickAger/LearningHaskell
HaskellProgrammingFromFirstPrinciples/Chapter22.hsproj/ReaderPractice.hs
mit
x = [1, 2, 3]
13
x = [1, 2, 3]
13
x = [1, 2, 3]
13
false
false
1
5
4
18
9
9
null
null
mightymoose/liquidhaskell
tests/pos/meas2.hs
bsd-3-clause
n = mylen zs
13
n = mylen zs
13
n = mylen zs
13
false
false
1
5
4
12
4
8
null
null
kuitang/damon
parser.hs
unlicense
showVal (Character '\n') = "#\\newline"
43
showVal (Character '\n') = "#\\newline"
43
showVal (Character '\n') = "#\\newline"
43
false
false
0
7
8
15
7
8
null
null
jdoiWork/Primes
src/Sundaram.hs
mit
primes :: (Num n, Ord n, Enum n, Integral n) => n -> [n] primes limit = 2 : remainders' where remainders = toOddNumbers $ filteredSource limit' remainders' = takeWhile (<=limit) remainders limit' = limit `div` 2 + 1
240
primes :: (Num n, Ord n, Enum n, Integral n) => n -> [n] primes limit = 2 : remainders' where remainders = toOddNumbers $ filteredSource limit' remainders' = takeWhile (<=limit) remainders limit' = limit `div` 2 + 1
240
primes limit = 2 : remainders' where remainders = toOddNumbers $ filteredSource limit' remainders' = takeWhile (<=limit) remainders limit' = limit `div` 2 + 1
183
false
true
2
9
63
97
51
46
null
null
AlexanderPankiv/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
shiftRIntegerIdKey = mkPreludeMiscIdUnique 96
56
shiftRIntegerIdKey = mkPreludeMiscIdUnique 96
56
shiftRIntegerIdKey = mkPreludeMiscIdUnique 96
56
false
false
0
5
14
9
4
5
null
null
sdiehl/ghc
compiler/types/TyCoFVs.hs
bsd-3-clause
coVarsOfType :: Type -> CoVarSet coVarsOfType ty = getCoVarSet (tyCoFVsOfType ty)
81
coVarsOfType :: Type -> CoVarSet coVarsOfType ty = getCoVarSet (tyCoFVsOfType ty)
81
coVarsOfType ty = getCoVarSet (tyCoFVsOfType ty)
48
false
true
0
7
10
27
13
14
null
null
jokusi/Astview
src/core/Language/Astview/DataTree.hs
mit
isEmpty :: Tree AstNode -> Bool isEmpty (Node (AstNode "" _ _ _) []) = True
75
isEmpty :: Tree AstNode -> Bool isEmpty (Node (AstNode "" _ _ _) []) = True
75
isEmpty (Node (AstNode "" _ _ _) []) = True
43
false
true
0
9
15
43
21
22
null
null
wavewave/xournal-types
src/Data/Xournal/Predefined.hs
bsd-2-clause
predefined_eraser_fine :: Double predefined_eraser_fine = 2.83
62
predefined_eraser_fine :: Double predefined_eraser_fine = 2.83
62
predefined_eraser_fine = 2.83
29
false
true
0
4
5
11
6
5
null
null
niluhdea/Zenx-trainer-training
haskell/allone.hs
epl-1.0
-- 5 nth 0 (x:xs) = x
21
nth 0 (x:xs) = x
16
nth 0 (x:xs) = x
16
true
false
1
7
6
22
10
12
null
null
apriori/daak
lib/DAAK/Algorithms/Gamo/Packing.hs
mit
genesUsed (Just (EmptyPacking _)) = 0
37
genesUsed (Just (EmptyPacking _)) = 0
37
genesUsed (Just (EmptyPacking _)) = 0
37
false
false
0
9
5
21
10
11
null
null
ygale/yesod
yesod-core/test/Hierarchy.hs
mit
hierarchy :: Spec hierarchy = describe "hierarchy" $ do it "nested with spacing" $ renderRoute (NestR SpacedR) @?= (["nest", "spaces"], []) it "renders root correctly" $ renderRoute (AdminR 5 AdminRootR) @?= (["admin", "5"], []) it "renders table correctly" $ renderRoute (AdminR 6 $ TableR "foo") @?= (["admin", "6", "table", "foo"], []) let disp m ps = dispatcher (Env { envToMaster = id , envMaster = Hierarchy , envSub = Hierarchy }) (map pack ps, S8.pack m) let testGetPost route getRes postRes = do let routeStrs = map unpack $ fst (renderRoute route) disp "GET" routeStrs @?= (getRes, Just route) disp "POST" routeStrs @?= (postRes, Just route) it "dispatches routes with multiple METHODs: admin" $ testGetPost (AdminR 1 LoginR) "login: 1" "post login: 1" it "dispatches routes with multiple METHODs: nesting" $ testGetPost (NestR $ Nest2 GetPostR) "get" "post" it "dispatches root correctly" $ disp "GET" ["admin", "7"] @?= ("admin root: 7", Just $ AdminR 7 AdminRootR) it "dispatches table correctly" $ disp "GET" ["admin", "8", "table", "bar"] @?= ("TableR bar", Just $ AdminR 8 $ TableR "bar") it "parses" $ do parseRoute ([], []) @?= Just HomeR parseRoute ([], [("foo", "bar")]) @?= Just HomeR parseRoute (["admin", "5"], []) @?= Just (AdminR 5 AdminRootR) parseRoute (["admin!", "5"], []) @?= (Nothing :: Maybe (Route Hierarchy)) it "inherited attributes" $ do routeAttrs (NestR SpacedR) @?= Set.fromList ["NestingAttr", "NonNested"] it "pair attributes" $ routeAttrs (AfterR After) @?= Set.fromList ["parent", "child", "key=value2"]
1,804
hierarchy :: Spec hierarchy = describe "hierarchy" $ do it "nested with spacing" $ renderRoute (NestR SpacedR) @?= (["nest", "spaces"], []) it "renders root correctly" $ renderRoute (AdminR 5 AdminRootR) @?= (["admin", "5"], []) it "renders table correctly" $ renderRoute (AdminR 6 $ TableR "foo") @?= (["admin", "6", "table", "foo"], []) let disp m ps = dispatcher (Env { envToMaster = id , envMaster = Hierarchy , envSub = Hierarchy }) (map pack ps, S8.pack m) let testGetPost route getRes postRes = do let routeStrs = map unpack $ fst (renderRoute route) disp "GET" routeStrs @?= (getRes, Just route) disp "POST" routeStrs @?= (postRes, Just route) it "dispatches routes with multiple METHODs: admin" $ testGetPost (AdminR 1 LoginR) "login: 1" "post login: 1" it "dispatches routes with multiple METHODs: nesting" $ testGetPost (NestR $ Nest2 GetPostR) "get" "post" it "dispatches root correctly" $ disp "GET" ["admin", "7"] @?= ("admin root: 7", Just $ AdminR 7 AdminRootR) it "dispatches table correctly" $ disp "GET" ["admin", "8", "table", "bar"] @?= ("TableR bar", Just $ AdminR 8 $ TableR "bar") it "parses" $ do parseRoute ([], []) @?= Just HomeR parseRoute ([], [("foo", "bar")]) @?= Just HomeR parseRoute (["admin", "5"], []) @?= Just (AdminR 5 AdminRootR) parseRoute (["admin!", "5"], []) @?= (Nothing :: Maybe (Route Hierarchy)) it "inherited attributes" $ do routeAttrs (NestR SpacedR) @?= Set.fromList ["NestingAttr", "NonNested"] it "pair attributes" $ routeAttrs (AfterR After) @?= Set.fromList ["parent", "child", "key=value2"]
1,804
hierarchy = describe "hierarchy" $ do it "nested with spacing" $ renderRoute (NestR SpacedR) @?= (["nest", "spaces"], []) it "renders root correctly" $ renderRoute (AdminR 5 AdminRootR) @?= (["admin", "5"], []) it "renders table correctly" $ renderRoute (AdminR 6 $ TableR "foo") @?= (["admin", "6", "table", "foo"], []) let disp m ps = dispatcher (Env { envToMaster = id , envMaster = Hierarchy , envSub = Hierarchy }) (map pack ps, S8.pack m) let testGetPost route getRes postRes = do let routeStrs = map unpack $ fst (renderRoute route) disp "GET" routeStrs @?= (getRes, Just route) disp "POST" routeStrs @?= (postRes, Just route) it "dispatches routes with multiple METHODs: admin" $ testGetPost (AdminR 1 LoginR) "login: 1" "post login: 1" it "dispatches routes with multiple METHODs: nesting" $ testGetPost (NestR $ Nest2 GetPostR) "get" "post" it "dispatches root correctly" $ disp "GET" ["admin", "7"] @?= ("admin root: 7", Just $ AdminR 7 AdminRootR) it "dispatches table correctly" $ disp "GET" ["admin", "8", "table", "bar"] @?= ("TableR bar", Just $ AdminR 8 $ TableR "bar") it "parses" $ do parseRoute ([], []) @?= Just HomeR parseRoute ([], [("foo", "bar")]) @?= Just HomeR parseRoute (["admin", "5"], []) @?= Just (AdminR 5 AdminRootR) parseRoute (["admin!", "5"], []) @?= (Nothing :: Maybe (Route Hierarchy)) it "inherited attributes" $ do routeAttrs (NestR SpacedR) @?= Set.fromList ["NestingAttr", "NonNested"] it "pair attributes" $ routeAttrs (AfterR After) @?= Set.fromList ["parent", "child", "key=value2"]
1,786
false
true
2
19
494
647
318
329
null
null
green-haskell/ghc
compiler/typecheck/TcGenDeriv.hs
bsd-3-clause
-- b_Expr = nlHsVar b_RDR c_Expr = nlHsVar c_RDR
63
c_Expr = nlHsVar c_RDR
31
c_Expr = nlHsVar c_RDR
31
true
false
0
5
23
10
5
5
null
null
piyush-kurur-pages/website
Site/Blog.hs
bsd-3-clause
rules :: Rules () rules = do -- -- Classify posts based on tags. -- postTags <- buildTags "posts/*" $ fromCapture "posts/tags/*.html" -- Generate the tags page tagsRules postTags $ makeTagRules tagT -- -- Compiling individual posts. -- match postsPat $ do route $ setExtension "html" compilePipeline $ blogPostPage postTags -- -- Create atom/rss feeds feeds. -- let feedContext = postContext <> bodyField "description" in do create ["posts/feeds/atom.xml"] $ do route idRoute compile $ compileFeeds >>= renderAtom feedConfig feedContext create ["posts/feeds/rss.xml"] $ do route idRoute compile $ compileFeeds >>= renderRss feedConfig feedContext -- -- Creating the archive. -- let yearTag ident = return [getYear ident] in do dateTags <- buildTagsWith yearTag "posts/*" $ fromCapture "posts/archive/*.html" tagsRules dateTags $ makeTagRules archiveT -- Creating the index page of the archive create ["posts/archive/index.html"] $ do route idRoute compile $ makeItem "" >>= blogArchivePage dateTags postTags
1,148
rules :: Rules () rules = do -- -- Classify posts based on tags. -- postTags <- buildTags "posts/*" $ fromCapture "posts/tags/*.html" -- Generate the tags page tagsRules postTags $ makeTagRules tagT -- -- Compiling individual posts. -- match postsPat $ do route $ setExtension "html" compilePipeline $ blogPostPage postTags -- -- Create atom/rss feeds feeds. -- let feedContext = postContext <> bodyField "description" in do create ["posts/feeds/atom.xml"] $ do route idRoute compile $ compileFeeds >>= renderAtom feedConfig feedContext create ["posts/feeds/rss.xml"] $ do route idRoute compile $ compileFeeds >>= renderRss feedConfig feedContext -- -- Creating the archive. -- let yearTag ident = return [getYear ident] in do dateTags <- buildTagsWith yearTag "posts/*" $ fromCapture "posts/archive/*.html" tagsRules dateTags $ makeTagRules archiveT -- Creating the index page of the archive create ["posts/archive/index.html"] $ do route idRoute compile $ makeItem "" >>= blogArchivePage dateTags postTags
1,148
rules = do -- -- Classify posts based on tags. -- postTags <- buildTags "posts/*" $ fromCapture "posts/tags/*.html" -- Generate the tags page tagsRules postTags $ makeTagRules tagT -- -- Compiling individual posts. -- match postsPat $ do route $ setExtension "html" compilePipeline $ blogPostPage postTags -- -- Create atom/rss feeds feeds. -- let feedContext = postContext <> bodyField "description" in do create ["posts/feeds/atom.xml"] $ do route idRoute compile $ compileFeeds >>= renderAtom feedConfig feedContext create ["posts/feeds/rss.xml"] $ do route idRoute compile $ compileFeeds >>= renderRss feedConfig feedContext -- -- Creating the archive. -- let yearTag ident = return [getYear ident] in do dateTags <- buildTagsWith yearTag "posts/*" $ fromCapture "posts/archive/*.html" tagsRules dateTags $ makeTagRules archiveT -- Creating the index page of the archive create ["posts/archive/index.html"] $ do route idRoute compile $ makeItem "" >>= blogArchivePage dateTags postTags
1,130
false
true
0
16
282
277
125
152
null
null
Chrisr850/Villefort
src/Villefort/Todo.hs
bsd-3-clause
deleteTodo :: (MonadReader VConfig m, MonadIO m) => ByteString -> m () deleteTodo raw = do let da = Data.List.Split.splitOn "&" (show raw) let rawid = Data.List.Split.splitOn "=" $ (Prelude.init (da !! 1)) let sqlId = read (rawid!! 1) :: Int let rawtime = Data.List.Split.splitOn "=" $ (da !! 0) let integerTime = read (rawtime !! 1) :: Int do updateTodos sqlId integerTime -- update task time if integerTime /= 0 then delTask sqlId -- then remove from database else delTask sqlId -- otherwise just remove from database return ()
583
deleteTodo :: (MonadReader VConfig m, MonadIO m) => ByteString -> m () deleteTodo raw = do let da = Data.List.Split.splitOn "&" (show raw) let rawid = Data.List.Split.splitOn "=" $ (Prelude.init (da !! 1)) let sqlId = read (rawid!! 1) :: Int let rawtime = Data.List.Split.splitOn "=" $ (da !! 0) let integerTime = read (rawtime !! 1) :: Int do updateTodos sqlId integerTime -- update task time if integerTime /= 0 then delTask sqlId -- then remove from database else delTask sqlId -- otherwise just remove from database return ()
583
deleteTodo raw = do let da = Data.List.Split.splitOn "&" (show raw) let rawid = Data.List.Split.splitOn "=" $ (Prelude.init (da !! 1)) let sqlId = read (rawid!! 1) :: Int let rawtime = Data.List.Split.splitOn "=" $ (da !! 0) let integerTime = read (rawtime !! 1) :: Int do updateTodos sqlId integerTime -- update task time if integerTime /= 0 then delTask sqlId -- then remove from database else delTask sqlId -- otherwise just remove from database return ()
511
false
true
0
15
143
218
107
111
null
null
hvr/lens
src/Control/Lens/TH.hs
bsd-3-clause
emit :: [Dec] -> Declare () emit decs = tell $ Endo (decs++)
60
emit :: [Dec] -> Declare () emit decs = tell $ Endo (decs++)
60
emit decs = tell $ Endo (decs++)
32
false
true
0
7
12
37
19
18
null
null
typelead/epm
Cabal/Distribution/Simple/Program/Builtin.hs
bsd-3-clause
haddockProgram :: Program haddockProgram = (simpleProgram "haddock") { programFindVersion = findProgramVersion "--version" $ \str -> -- Invoking "haddock --version" gives a string like -- "Haddock version 0.8, (c) Simon Marlow 2006" case words str of (_:_:ver:_) -> takeWhile (`elem` ('.':['0'..'9'])) ver _ -> "" }
365
haddockProgram :: Program haddockProgram = (simpleProgram "haddock") { programFindVersion = findProgramVersion "--version" $ \str -> -- Invoking "haddock --version" gives a string like -- "Haddock version 0.8, (c) Simon Marlow 2006" case words str of (_:_:ver:_) -> takeWhile (`elem` ('.':['0'..'9'])) ver _ -> "" }
365
haddockProgram = (simpleProgram "haddock") { programFindVersion = findProgramVersion "--version" $ \str -> -- Invoking "haddock --version" gives a string like -- "Haddock version 0.8, (c) Simon Marlow 2006" case words str of (_:_:ver:_) -> takeWhile (`elem` ('.':['0'..'9'])) ver _ -> "" }
339
false
true
0
16
94
96
53
43
null
null