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
scravy/simplex
src/Simplex/ToTeX.hs
gpl-3.0
itemsToTeX :: [Items] -> String itemsToTeX = concatMap f where f (Item x) = "\\item " ++ escapeTeX "\n" x f (Items Itemize is) = "\\begin{itemize}\n" ++ itemsToTeX is ++ "\\end{itemize}\n" f (Items Enumerate is) = "\\begin{enumerate}\n" ++ itemsToTeX is ++ "\\end{enumerate}\n"
329
itemsToTeX :: [Items] -> String itemsToTeX = concatMap f where f (Item x) = "\\item " ++ escapeTeX "\n" x f (Items Itemize is) = "\\begin{itemize}\n" ++ itemsToTeX is ++ "\\end{itemize}\n" f (Items Enumerate is) = "\\begin{enumerate}\n" ++ itemsToTeX is ++ "\\end{enumerate}\n"
329
itemsToTeX = concatMap f where f (Item x) = "\\item " ++ escapeTeX "\n" x f (Items Itemize is) = "\\begin{itemize}\n" ++ itemsToTeX is ++ "\\end{itemize}\n" f (Items Enumerate is) = "\\begin{enumerate}\n" ++ itemsToTeX is ++ "\\end{enumerate}\n"
297
false
true
0
9
93
100
49
51
null
null
srijs/haskell-free-concurrent
src/Control/Concurrent/Free/Syntax.hs
mit
(|<*>) :: Par f (a -> b) -> Concurrent f a -> Concurrent f b x |<*> y = x & _inpar %~ (<*> y ^. _unpar)
103
(|<*>) :: Par f (a -> b) -> Concurrent f a -> Concurrent f b x |<*> y = x & _inpar %~ (<*> y ^. _unpar)
103
x |<*> y = x & _inpar %~ (<*> y ^. _unpar)
42
false
true
0
9
26
65
33
32
null
null
mattias-lundell/timber-llvm
src/Core2Kindle.hs
bsd-3-clause
cBody env e = do (bf,t,h) <- cExp env e case h of ValR e -> return (t, ValR (bf (Kindle.CRet e))) FunR f ts -> return (t, FunR (bf . Kindle.CRet . f) ts) -- Note: we don't really handle PMC terms as first class citizens, rather like constructors in a small grammar -- of pattern-matching expressions: -- e ::= ... | Match pm -- pm ::= Commit e | Fail | Fatbar pm pm | case e of {p -> pm} pm | let bs in pm -- This syntax is followed when PMC terms are introduced in module Match, and is also respected by Termred. -- -- However, should we for some reason want to allow abstraction over PMC terms, as in (\e -> Commit e), -- the translation below will need to be complemented with a concrete implementation of the PMC type constructor -- (using Maybe, for example), and corresponding general implementations of Match, Commit, Fail & Fatbar. -- Translate a Core.Exp corresponding to a PMC term into a Kindle.Cmd result
1,103
cBody env e = do (bf,t,h) <- cExp env e case h of ValR e -> return (t, ValR (bf (Kindle.CRet e))) FunR f ts -> return (t, FunR (bf . Kindle.CRet . f) ts) -- Note: we don't really handle PMC terms as first class citizens, rather like constructors in a small grammar -- of pattern-matching expressions: -- e ::= ... | Match pm -- pm ::= Commit e | Fail | Fatbar pm pm | case e of {p -> pm} pm | let bs in pm -- This syntax is followed when PMC terms are introduced in module Match, and is also respected by Termred. -- -- However, should we for some reason want to allow abstraction over PMC terms, as in (\e -> Commit e), -- the translation below will need to be complemented with a concrete implementation of the PMC type constructor -- (using Maybe, for example), and corresponding general implementations of Match, Commit, Fail & Fatbar. -- Translate a Core.Exp corresponding to a PMC term into a Kindle.Cmd result
1,103
cBody env e = do (bf,t,h) <- cExp env e case h of ValR e -> return (t, ValR (bf (Kindle.CRet e))) FunR f ts -> return (t, FunR (bf . Kindle.CRet . f) ts) -- Note: we don't really handle PMC terms as first class citizens, rather like constructors in a small grammar -- of pattern-matching expressions: -- e ::= ... | Match pm -- pm ::= Commit e | Fail | Fatbar pm pm | case e of {p -> pm} pm | let bs in pm -- This syntax is followed when PMC terms are introduced in module Match, and is also respected by Termred. -- -- However, should we for some reason want to allow abstraction over PMC terms, as in (\e -> Commit e), -- the translation below will need to be complemented with a concrete implementation of the PMC type constructor -- (using Maybe, for example), and corresponding general implementations of Match, Commit, Fail & Fatbar. -- Translate a Core.Exp corresponding to a PMC term into a Kindle.Cmd result
1,103
false
false
0
17
361
122
65
57
null
null
naoto-ogawa/h-xproto-mysql
src/DataBase/MySQLX/Model.hs
mit
getColumnLength :: PCMD.ColumnMetaData -> W.Word32 getColumnLength meta = fromMaybe 0 $ PCMD.length meta
104
getColumnLength :: PCMD.ColumnMetaData -> W.Word32 getColumnLength meta = fromMaybe 0 $ PCMD.length meta
104
getColumnLength meta = fromMaybe 0 $ PCMD.length meta
53
false
true
0
8
12
39
17
22
null
null
mitochon/hoosalind
src/problems/splc.hs
mit
main :: IO () main = do inp <- getContents let (seq:introns) = (map F.sequenceData . F.fastaLines) inp exons = foldl splc seq introns putStrLn $ concat (map show (readExons exons))
202
main :: IO () main = do inp <- getContents let (seq:introns) = (map F.sequenceData . F.fastaLines) inp exons = foldl splc seq introns putStrLn $ concat (map show (readExons exons))
202
main = do inp <- getContents let (seq:introns) = (map F.sequenceData . F.fastaLines) inp exons = foldl splc seq introns putStrLn $ concat (map show (readExons exons))
188
false
true
0
14
52
93
44
49
null
null
wxwxwwxxx/ghc
compiler/basicTypes/MkId.hs
bsd-3-clause
isUnpackableType :: DynFlags -> FamInstEnvs -> Type -> Bool -- True if we can unpack the UNPACK the argument type -- See Note [Recursive unboxing] -- We look "deeply" inside rather than relying on the DataCons -- we encounter on the way, because otherwise we might well -- end up relying on ourselves! isUnpackableType dflags fam_envs ty | Just (tc, _) <- splitTyConApp_maybe ty , Just con <- tyConSingleAlgDataCon_maybe tc , isVanillaDataCon con = ok_con_args (unitNameSet (getName tc)) con | otherwise = False where ok_arg tcs (ty, bang) = not (attempt_unpack bang) || ok_ty tcs norm_ty where norm_ty = topNormaliseType fam_envs ty ok_ty tcs ty | Just (tc, _) <- splitTyConApp_maybe ty , let tc_name = getName tc = not (tc_name `elemNameSet` tcs) && case tyConSingleAlgDataCon_maybe tc of Just con | isVanillaDataCon con -> ok_con_args (tcs `extendNameSet` getName tc) con _ -> True | otherwise = True ok_con_args tcs con = all (ok_arg tcs) (dataConOrigArgTys con `zip` dataConSrcBangs con) -- NB: dataConSrcBangs gives the *user* request; -- We'd get a black hole if we used dataConImplBangs attempt_unpack (HsSrcBang _ SrcUnpack NoSrcStrict) = xopt Opt_StrictData dflags attempt_unpack (HsSrcBang _ SrcUnpack SrcStrict) = True attempt_unpack (HsSrcBang _ NoSrcUnpack SrcStrict) = True -- Be conservative attempt_unpack (HsSrcBang _ NoSrcUnpack NoSrcStrict) = xopt Opt_StrictData dflags -- Be conservative attempt_unpack _ = False {- Note [Unpack one-wide fields] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The flag UnboxSmallStrictFields ensures that any field that can (safely) be unboxed to a word-sized unboxed field, should be so unboxed. For example: data A = A Int# newtype B = B A data C = C !B data D = D !C data E = E !() data F = F !D data G = G !F !F All of these should have an Int# as their representation, except G which should have two Int#s. However data T = T !(S Int) data S = S !a Here we can represent T with an Int#. Note [Recursive unboxing] ~~~~~~~~~~~~~~~~~~~~~~~~~ Consider data R = MkR {-# UNPACK #-} !S Int data S = MkS {-# UNPACK #-} !Int The representation arguments of MkR are the *representation* arguments of S (plus Int); the rep args of MkS are Int#. This is all fine. But be careful not to try to unbox this! data T = MkT {-# UNPACK #-} !T Int Because then we'd get an infinite number of arguments. Here is a more complicated case: data S = MkS {-# UNPACK #-} !T Int data T = MkT {-# UNPACK #-} !S Int Each of S and T must decide independendently whether to unpack and they had better not both say yes. So they must both say no. Also behave conservatively when there is no UNPACK pragma data T = MkS !T Int with -funbox-strict-fields or -funbox-small-strict-fields we need to behave as if there was an UNPACK pragma there. But it's the *argument* type that matters. This is fine: data S = MkS S !Int because Int is non-recursive. Note [Unpack equality predicates] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If we have a GADT with a contructor C :: (a~[b]) => b -> T a we definitely want that equality predicate *unboxed* so that it takes no space at all. This is easily done: just give it an UNPACK pragma. The rest of the unpack/repack code does the heavy lifting. This one line makes every GADT take a word less space for each equality predicate, so it's pretty important! -}
3,589
isUnpackableType :: DynFlags -> FamInstEnvs -> Type -> Bool isUnpackableType dflags fam_envs ty | Just (tc, _) <- splitTyConApp_maybe ty , Just con <- tyConSingleAlgDataCon_maybe tc , isVanillaDataCon con = ok_con_args (unitNameSet (getName tc)) con | otherwise = False where ok_arg tcs (ty, bang) = not (attempt_unpack bang) || ok_ty tcs norm_ty where norm_ty = topNormaliseType fam_envs ty ok_ty tcs ty | Just (tc, _) <- splitTyConApp_maybe ty , let tc_name = getName tc = not (tc_name `elemNameSet` tcs) && case tyConSingleAlgDataCon_maybe tc of Just con | isVanillaDataCon con -> ok_con_args (tcs `extendNameSet` getName tc) con _ -> True | otherwise = True ok_con_args tcs con = all (ok_arg tcs) (dataConOrigArgTys con `zip` dataConSrcBangs con) -- NB: dataConSrcBangs gives the *user* request; -- We'd get a black hole if we used dataConImplBangs attempt_unpack (HsSrcBang _ SrcUnpack NoSrcStrict) = xopt Opt_StrictData dflags attempt_unpack (HsSrcBang _ SrcUnpack SrcStrict) = True attempt_unpack (HsSrcBang _ NoSrcUnpack SrcStrict) = True -- Be conservative attempt_unpack (HsSrcBang _ NoSrcUnpack NoSrcStrict) = xopt Opt_StrictData dflags -- Be conservative attempt_unpack _ = False {- Note [Unpack one-wide fields] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The flag UnboxSmallStrictFields ensures that any field that can (safely) be unboxed to a word-sized unboxed field, should be so unboxed. For example: data A = A Int# newtype B = B A data C = C !B data D = D !C data E = E !() data F = F !D data G = G !F !F All of these should have an Int# as their representation, except G which should have two Int#s. However data T = T !(S Int) data S = S !a Here we can represent T with an Int#. Note [Recursive unboxing] ~~~~~~~~~~~~~~~~~~~~~~~~~ Consider data R = MkR {-# UNPACK #-} !S Int data S = MkS {-# UNPACK #-} !Int The representation arguments of MkR are the *representation* arguments of S (plus Int); the rep args of MkS are Int#. This is all fine. But be careful not to try to unbox this! data T = MkT {-# UNPACK #-} !T Int Because then we'd get an infinite number of arguments. Here is a more complicated case: data S = MkS {-# UNPACK #-} !T Int data T = MkT {-# UNPACK #-} !S Int Each of S and T must decide independendently whether to unpack and they had better not both say yes. So they must both say no. Also behave conservatively when there is no UNPACK pragma data T = MkS !T Int with -funbox-strict-fields or -funbox-small-strict-fields we need to behave as if there was an UNPACK pragma there. But it's the *argument* type that matters. This is fine: data S = MkS S !Int because Int is non-recursive. Note [Unpack equality predicates] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If we have a GADT with a contructor C :: (a~[b]) => b -> T a we definitely want that equality predicate *unboxed* so that it takes no space at all. This is easily done: just give it an UNPACK pragma. The rest of the unpack/repack code does the heavy lifting. This one line makes every GADT take a word less space for each equality predicate, so it's pretty important! -}
3,347
isUnpackableType dflags fam_envs ty | Just (tc, _) <- splitTyConApp_maybe ty , Just con <- tyConSingleAlgDataCon_maybe tc , isVanillaDataCon con = ok_con_args (unitNameSet (getName tc)) con | otherwise = False where ok_arg tcs (ty, bang) = not (attempt_unpack bang) || ok_ty tcs norm_ty where norm_ty = topNormaliseType fam_envs ty ok_ty tcs ty | Just (tc, _) <- splitTyConApp_maybe ty , let tc_name = getName tc = not (tc_name `elemNameSet` tcs) && case tyConSingleAlgDataCon_maybe tc of Just con | isVanillaDataCon con -> ok_con_args (tcs `extendNameSet` getName tc) con _ -> True | otherwise = True ok_con_args tcs con = all (ok_arg tcs) (dataConOrigArgTys con `zip` dataConSrcBangs con) -- NB: dataConSrcBangs gives the *user* request; -- We'd get a black hole if we used dataConImplBangs attempt_unpack (HsSrcBang _ SrcUnpack NoSrcStrict) = xopt Opt_StrictData dflags attempt_unpack (HsSrcBang _ SrcUnpack SrcStrict) = True attempt_unpack (HsSrcBang _ NoSrcUnpack SrcStrict) = True -- Be conservative attempt_unpack (HsSrcBang _ NoSrcUnpack NoSrcStrict) = xopt Opt_StrictData dflags -- Be conservative attempt_unpack _ = False {- Note [Unpack one-wide fields] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The flag UnboxSmallStrictFields ensures that any field that can (safely) be unboxed to a word-sized unboxed field, should be so unboxed. For example: data A = A Int# newtype B = B A data C = C !B data D = D !C data E = E !() data F = F !D data G = G !F !F All of these should have an Int# as their representation, except G which should have two Int#s. However data T = T !(S Int) data S = S !a Here we can represent T with an Int#. Note [Recursive unboxing] ~~~~~~~~~~~~~~~~~~~~~~~~~ Consider data R = MkR {-# UNPACK #-} !S Int data S = MkS {-# UNPACK #-} !Int The representation arguments of MkR are the *representation* arguments of S (plus Int); the rep args of MkS are Int#. This is all fine. But be careful not to try to unbox this! data T = MkT {-# UNPACK #-} !T Int Because then we'd get an infinite number of arguments. Here is a more complicated case: data S = MkS {-# UNPACK #-} !T Int data T = MkT {-# UNPACK #-} !S Int Each of S and T must decide independendently whether to unpack and they had better not both say yes. So they must both say no. Also behave conservatively when there is no UNPACK pragma data T = MkS !T Int with -funbox-strict-fields or -funbox-small-strict-fields we need to behave as if there was an UNPACK pragma there. But it's the *argument* type that matters. This is fine: data S = MkS S !Int because Int is non-recursive. Note [Unpack equality predicates] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If we have a GADT with a contructor C :: (a~[b]) => b -> T a we definitely want that equality predicate *unboxed* so that it takes no space at all. This is easily done: just give it an UNPACK pragma. The rest of the unpack/repack code does the heavy lifting. This one line makes every GADT take a word less space for each equality predicate, so it's pretty important! -}
3,287
true
true
4
12
863
429
201
228
null
null
rfranek/duckling
Duckling/Rules/HR.hs
bsd-3-clause
rules (This TimeGrain) = TimeGrain.rules
40
rules (This TimeGrain) = TimeGrain.rules
40
rules (This TimeGrain) = TimeGrain.rules
40
false
false
0
6
4
18
8
10
null
null
simonmar/Haxl
Haxl/Core/Fetch.hs
bsd-3-clause
uncachedRequest :: (DataSource u r, Request r a) => r a -> GenHaxl u a uncachedRequest req = do isRecordingFlag <- env (recording . flags) if isRecordingFlag /= 0 then dataFetch req else GenHaxl $ \Env{..} -> do ivar <- newIVar let !rvar = stdResultVar ivar completions modifyIORef' reqStoreRef $ \bs -> addRequest (BlockedFetch req rvar) bs return $ Blocked ivar (Cont (getIVar ivar)) -- | Transparently provides caching. Useful for datasources that can -- return immediately, but also caches values. Exceptions thrown by -- the IO operation (except for asynchronous exceptions) are -- propagated into the Haxl monad and can be caught by 'catch' and -- 'try'.
707
uncachedRequest :: (DataSource u r, Request r a) => r a -> GenHaxl u a uncachedRequest req = do isRecordingFlag <- env (recording . flags) if isRecordingFlag /= 0 then dataFetch req else GenHaxl $ \Env{..} -> do ivar <- newIVar let !rvar = stdResultVar ivar completions modifyIORef' reqStoreRef $ \bs -> addRequest (BlockedFetch req rvar) bs return $ Blocked ivar (Cont (getIVar ivar)) -- | Transparently provides caching. Useful for datasources that can -- return immediately, but also caches values. Exceptions thrown by -- the IO operation (except for asynchronous exceptions) are -- propagated into the Haxl monad and can be caught by 'catch' and -- 'try'.
707
uncachedRequest req = do isRecordingFlag <- env (recording . flags) if isRecordingFlag /= 0 then dataFetch req else GenHaxl $ \Env{..} -> do ivar <- newIVar let !rvar = stdResultVar ivar completions modifyIORef' reqStoreRef $ \bs -> addRequest (BlockedFetch req rvar) bs return $ Blocked ivar (Cont (getIVar ivar)) -- | Transparently provides caching. Useful for datasources that can -- return immediately, but also caches values. Exceptions thrown by -- the IO operation (except for asynchronous exceptions) are -- propagated into the Haxl monad and can be caught by 'catch' and -- 'try'.
636
false
true
0
18
154
179
86
93
null
null
ancientlanguage/haskell-analysis
grammar/src/Grammar/Common/Decompose.hs
mit
decomposeChar '\xFA25' = "\x9038"
33
decomposeChar '\xFA25' = "\x9038"
33
decomposeChar '\xFA25' = "\x9038"
33
false
false
0
5
3
9
4
5
null
null
sdiehl/ghc
compiler/typecheck/Constraint.hs
bsd-3-clause
isGivenOrWDeriv _ = False
39
isGivenOrWDeriv _ = False
39
isGivenOrWDeriv _ = False
39
false
false
0
4
17
10
4
6
null
null
siddhanathan/ghc
compiler/main/HscTypes.hs
bsd-3-clause
metaRequestAW :: Functor f => MetaHook f -> LHsExpr Id -> f Serialized metaRequestAW h = fmap unMetaResAW . h (MetaAW MetaResAW)
128
metaRequestAW :: Functor f => MetaHook f -> LHsExpr Id -> f Serialized metaRequestAW h = fmap unMetaResAW . h (MetaAW MetaResAW)
128
metaRequestAW h = fmap unMetaResAW . h (MetaAW MetaResAW)
57
false
true
0
8
21
54
24
30
null
null
jmitchell/Idris-dev
src/Idris/IBC.hs
bsd-3-clause
processFunctionErrorHandlers :: Archive -> Idris () processFunctionErrorHandlers ar = do ns <- getEntry [] "ibc_function_errorhandlers" ar mapM_ (\ (fn,arg,handler) -> addFunctionErrorHandlers fn arg [handler]) ns
221
processFunctionErrorHandlers :: Archive -> Idris () processFunctionErrorHandlers ar = do ns <- getEntry [] "ibc_function_errorhandlers" ar mapM_ (\ (fn,arg,handler) -> addFunctionErrorHandlers fn arg [handler]) ns
221
processFunctionErrorHandlers ar = do ns <- getEntry [] "ibc_function_errorhandlers" ar mapM_ (\ (fn,arg,handler) -> addFunctionErrorHandlers fn arg [handler]) ns
169
false
true
0
11
32
74
37
37
null
null
ihc/futhark
src/Futhark/CodeGen/ImpGen.hs
isc
defCompileBasicOp (Destination [_]) (Assert e msg loc) = do e' <- compileSubExp e emit $ Imp.Assert e' msg loc
114
defCompileBasicOp (Destination [_]) (Assert e msg loc) = do e' <- compileSubExp e emit $ Imp.Assert e' msg loc
114
defCompileBasicOp (Destination [_]) (Assert e msg loc) = do e' <- compileSubExp e emit $ Imp.Assert e' msg loc
114
false
false
0
9
22
56
26
30
null
null
robinbb/hs-text-xhtml
Text/XHtml/Extras.hs
apache-2.0
copyright = primHtmlChar "copy"
35
copyright = primHtmlChar "copy"
35
copyright = primHtmlChar "copy"
35
false
false
1
5
7
13
4
9
null
null
phischu/fragnix
builtins/base/GHC.Event.Manager.hs
bsd-3-clause
hashFd :: Fd -> Int hashFd fd = fromIntegral fd .&. (callbackArraySize - 1)
75
hashFd :: Fd -> Int hashFd fd = fromIntegral fd .&. (callbackArraySize - 1)
75
hashFd fd = fromIntegral fd .&. (callbackArraySize - 1)
55
false
true
0
7
13
32
16
16
null
null
spechub/Hets
HasCASL/ToItem.hs
gpl-2.0
gvdToItem :: GenVarDecl -> Item gvdToItem gvd = mkItem ("GenVarDecl", pretty gvd) nullRange []
94
gvdToItem :: GenVarDecl -> Item gvdToItem gvd = mkItem ("GenVarDecl", pretty gvd) nullRange []
94
gvdToItem gvd = mkItem ("GenVarDecl", pretty gvd) nullRange []
62
false
true
0
7
13
36
18
18
null
null
brendanhay/gogol
gogol-analytics/gen/Network/Google/Resource/Analytics/Management/RemarketingAudience/Insert.hs
mpl-2.0
-- | Web property ID for which to create the remarketing audience. mraiWebPropertyId :: Lens' ManagementRemarketingAudienceInsert Text mraiWebPropertyId = lens _mraiWebPropertyId (\ s a -> s{_mraiWebPropertyId = a})
223
mraiWebPropertyId :: Lens' ManagementRemarketingAudienceInsert Text mraiWebPropertyId = lens _mraiWebPropertyId (\ s a -> s{_mraiWebPropertyId = a})
156
mraiWebPropertyId = lens _mraiWebPropertyId (\ s a -> s{_mraiWebPropertyId = a})
88
true
true
0
9
35
42
22
20
null
null
tomtitchener/MonadTransformersStepByStep
src/Main.hs
bsd-3-clause
evalApp (v1, v2) = throwError ("type error in application of value " ++ show v1 ++ " to value " ++ show v2)
121
evalApp (v1, v2) = throwError ("type error in application of value " ++ show v1 ++ " to value " ++ show v2)
121
evalApp (v1, v2) = throwError ("type error in application of value " ++ show v1 ++ " to value " ++ show v2)
121
false
false
0
10
36
39
19
20
null
null
nevrenato/Hets_Fork
Common/Utils.hs
gpl-2.0
fileparse :: [String] -- ^ list of suffixes -> FilePath -> (FilePath, FilePath, Maybe String) -- ^ (basename,directory,matched suffix) fileparse sufs fp = let (path, base) = stripDir fp (base', suf) = stripSuffix sufs base in (base', path, suf)
318
fileparse :: [String] -- ^ list of suffixes -> FilePath -> (FilePath, FilePath, Maybe String) fileparse sufs fp = let (path, base) = stripDir fp (base', suf) = stripSuffix sufs base in (base', path, suf)
267
fileparse sufs fp = let (path, base) = stripDir fp (base', suf) = stripSuffix sufs base in (base', path, suf)
153
true
true
0
10
112
94
49
45
null
null
DavidAlphaFox/ghc
libraries/Cabal/Cabal/Distribution/Simple/JHC.hs
bsd-3-clause
installLib :: Verbosity -> FilePath -> FilePath -> PackageDescription -> Library -> IO () installLib verb dest build_dir pkg_descr _ = do let p = display (packageId pkg_descr)++".hl" createDirectoryIfMissingVerbose verb True dest installOrdinaryFile verb (build_dir </> p) (dest </> p)
297
installLib :: Verbosity -> FilePath -> FilePath -> PackageDescription -> Library -> IO () installLib verb dest build_dir pkg_descr _ = do let p = display (packageId pkg_descr)++".hl" createDirectoryIfMissingVerbose verb True dest installOrdinaryFile verb (build_dir </> p) (dest </> p)
297
installLib verb dest build_dir pkg_descr _ = do let p = display (packageId pkg_descr)++".hl" createDirectoryIfMissingVerbose verb True dest installOrdinaryFile verb (build_dir </> p) (dest </> p)
207
false
true
0
13
51
103
49
54
null
null
wangbj/leet
224.hs
bsd-2-clause
stmts :: ParsecT String u Identity Expr stmts = do spaces e <- simpleExpr eof return e
94
stmts :: ParsecT String u Identity Expr stmts = do spaces e <- simpleExpr eof return e
94
stmts = do spaces e <- simpleExpr eof return e
54
false
true
1
8
24
43
17
26
null
null
ndmitchell/qed
v1/Simplify.hs
bsd-3-clause
etas :: [(Var,Exp)] -> [(Var,Exp)] etas env = map (second $ transformBi f) env where f (Var x) | Just (fromLams -> (vs, _)) <- lookup x env = lams vs $ apps (Var x) $ map Var vs f x = x
205
etas :: [(Var,Exp)] -> [(Var,Exp)] etas env = map (second $ transformBi f) env where f (Var x) | Just (fromLams -> (vs, _)) <- lookup x env = lams vs $ apps (Var x) $ map Var vs f x = x
205
etas env = map (second $ transformBi f) env where f (Var x) | Just (fromLams -> (vs, _)) <- lookup x env = lams vs $ apps (Var x) $ map Var vs f x = x
170
false
true
0
14
62
131
66
65
null
null
atemerev/icfpc2013
src/solver-lib/Types.hs
apache-2.0
expSize (And a b) = 1 + expCSize a + expCSize b
47
expSize (And a b) = 1 + expCSize a + expCSize b
47
expSize (And a b) = 1 + expCSize a + expCSize b
47
false
false
0
7
11
32
14
18
null
null
ezyang/ghc
compiler/codeGen/CgUtils.hs
bsd-3-clause
baseRegOffset dflags (YmmReg 1) = oFFSET_StgRegTable_rYMM1 dflags
74
baseRegOffset dflags (YmmReg 1) = oFFSET_StgRegTable_rYMM1 dflags
74
baseRegOffset dflags (YmmReg 1) = oFFSET_StgRegTable_rYMM1 dflags
74
false
false
0
7
15
20
9
11
null
null
spechub/Hets
HasCASL/AsUtils.hs
gpl-2.0
-- | remove predicate arrow in a type scheme unPredTypeScheme :: TypeScheme -> TypeScheme unPredTypeScheme = mapTypeOfScheme (snd . unPredType)
144
unPredTypeScheme :: TypeScheme -> TypeScheme unPredTypeScheme = mapTypeOfScheme (snd . unPredType)
98
unPredTypeScheme = mapTypeOfScheme (snd . unPredType)
53
true
true
0
7
20
32
15
17
null
null
eniac314/wizzard
src/Sdl2.hs
gpl-3.0
loadTexture :: Renderer -> String -> IO Texture loadTexture r path = do loadedSurface <- SDL.Image.load path texture <- createTextureFromSurface r loadedSurface freeSurface loadedSurface return texture
219
loadTexture :: Renderer -> String -> IO Texture loadTexture r path = do loadedSurface <- SDL.Image.load path texture <- createTextureFromSurface r loadedSurface freeSurface loadedSurface return texture
219
loadTexture r path = do loadedSurface <- SDL.Image.load path texture <- createTextureFromSurface r loadedSurface freeSurface loadedSurface return texture
171
false
true
0
10
43
69
29
40
null
null
emaphis/Haskell-Practice
cis194/src/Misc/Calcs.hs
bsd-3-clause
calcPY = calc pyMap
19
calcPY = calc pyMap
19
calcPY = calc pyMap
19
false
false
0
5
3
9
4
5
null
null
urbanslug/ghc
testsuite/tests/th/TH_unresolvedInfix_Lib.hs
bsd-3-clause
a ^+? b = uInfixP a plus' b
27
a ^+? b = uInfixP a plus' b
27
a ^+? b = uInfixP a plus' b
27
false
false
2
5
7
18
8
10
null
null
elaye/turtle-options
src/Turtle/Options/Scale.hs
bsd-3-clause
readScale :: String -> Maybe Scale readScale str = case (parse scale "Scale" str) of Left err -> error $ "Error parsing scale: " ++ (show err) Right s -> Just s
164
readScale :: String -> Maybe Scale readScale str = case (parse scale "Scale" str) of Left err -> error $ "Error parsing scale: " ++ (show err) Right s -> Just s
164
readScale str = case (parse scale "Scale" str) of Left err -> error $ "Error parsing scale: " ++ (show err) Right s -> Just s
129
false
true
0
10
35
70
33
37
null
null
llelf/language-c
examples/sourceview/SourceView.hs
bsd-3-clause
main :: IO () main = do let usageErr = (hPutStrLn stderr (usageMsg "./Annotate") >> exitWith (ExitFailure 1)) -- get command line arguments args <- getArgs c_file <- case args of [a1] -> return a1 _ -> usageErr -- parse the file ast <- errorOnLeftM "Parse Error" (parseCFilePre c_file) -- split the AST by input file let groups = groupAstBySourceFile ast -- show the generic tree putStrLn . drawTree . fmap show . (uncurry treeView) $ last groups -- run the source view runGTK (map (uncurry treeView) groups) c_file
598
main :: IO () main = do let usageErr = (hPutStrLn stderr (usageMsg "./Annotate") >> exitWith (ExitFailure 1)) -- get command line arguments args <- getArgs c_file <- case args of [a1] -> return a1 _ -> usageErr -- parse the file ast <- errorOnLeftM "Parse Error" (parseCFilePre c_file) -- split the AST by input file let groups = groupAstBySourceFile ast -- show the generic tree putStrLn . drawTree . fmap show . (uncurry treeView) $ last groups -- run the source view runGTK (map (uncurry treeView) groups) c_file
598
main = do let usageErr = (hPutStrLn stderr (usageMsg "./Annotate") >> exitWith (ExitFailure 1)) -- get command line arguments args <- getArgs c_file <- case args of [a1] -> return a1 _ -> usageErr -- parse the file ast <- errorOnLeftM "Parse Error" (parseCFilePre c_file) -- split the AST by input file let groups = groupAstBySourceFile ast -- show the generic tree putStrLn . drawTree . fmap show . (uncurry treeView) $ last groups -- run the source view runGTK (map (uncurry treeView) groups) c_file
584
false
true
0
14
171
176
84
92
null
null
phischu/fragnix
src/Fragnix/HashLocalSlices.hs
bsd-3-clause
-- | Replace every occurence of a slice ID in the given use with its local ID. replaceUseID :: (SliceID -> LocalSliceID) -> Use -> LocalUse replaceUseID f (Use qualification usedName (OtherSlice sliceID)) = LocalUse qualification usedName (OtherLocalSlice (f sliceID))
272
replaceUseID :: (SliceID -> LocalSliceID) -> Use -> LocalUse replaceUseID f (Use qualification usedName (OtherSlice sliceID)) = LocalUse qualification usedName (OtherLocalSlice (f sliceID))
193
replaceUseID f (Use qualification usedName (OtherSlice sliceID)) = LocalUse qualification usedName (OtherLocalSlice (f sliceID))
132
true
true
0
9
43
73
35
38
null
null
dolio/vector
Data/Vector/Generic.hs
bsd-3-clause
unsafeUpdate_stream = modifyWithBundle M.unsafeUpdate
53
unsafeUpdate_stream = modifyWithBundle M.unsafeUpdate
53
unsafeUpdate_stream = modifyWithBundle M.unsafeUpdate
53
false
false
0
6
3
11
5
6
null
null
sjoerdvisscher/icfp2011
src/Cards.hs
bsd-3-clause
change :: Monad m => Int -> (a -> a) -> V.Vector a -> m (V.Vector a) change i f = changeM i (return . f)
104
change :: Monad m => Int -> (a -> a) -> V.Vector a -> m (V.Vector a) change i f = changeM i (return . f)
104
change i f = changeM i (return . f)
35
false
true
0
12
25
70
34
36
null
null
nuttycom/haskoin
tests/Network/Haskoin/Crypto/Point/Tests.hs
unlicense
doubleMulPoint :: ArbitraryInfPoint -> Bool doubleMulPoint (ArbitraryInfPoint p) = doublePoint p == mulPoint 2 p
112
doubleMulPoint :: ArbitraryInfPoint -> Bool doubleMulPoint (ArbitraryInfPoint p) = doublePoint p == mulPoint 2 p
112
doubleMulPoint (ArbitraryInfPoint p) = doublePoint p == mulPoint 2 p
68
false
true
0
6
14
40
18
22
null
null
beni55/hs-monte-carlo
examples/Poker.hs
bsd-3-clause
-- | The number values of the aces and face cards. ace, jack, queen, king :: Int ace = 1
90
ace, jack, queen, king :: Int ace = 1
39
ace = 1
9
true
true
2
5
21
23
13
10
null
null
pdownen/sequent-core
src/Language/SequentCore/Syntax.hs
bsd-3-clause
isAppFrame _ = False
27
isAppFrame _ = False
27
isAppFrame _ = False
27
false
false
0
5
10
9
4
5
null
null
keithodulaigh/Hets
SoftFOL/ParseTPTP.hs
gpl-2.0
functor :: Parser SPSymbol functor = fmap (\ t -> fromMaybe (SPCustomSymbol t) $ lookup (tokStr t) $ zip ["$true", "$false", "$equal"] [SPTrue, SPFalse, SPEqual]) $ pToken $ lowerWord <|> singleQuoted <|> dollarWord
227
functor :: Parser SPSymbol functor = fmap (\ t -> fromMaybe (SPCustomSymbol t) $ lookup (tokStr t) $ zip ["$true", "$false", "$equal"] [SPTrue, SPFalse, SPEqual]) $ pToken $ lowerWord <|> singleQuoted <|> dollarWord
227
functor = fmap (\ t -> fromMaybe (SPCustomSymbol t) $ lookup (tokStr t) $ zip ["$true", "$false", "$equal"] [SPTrue, SPFalse, SPEqual]) $ pToken $ lowerWord <|> singleQuoted <|> dollarWord
200
false
true
7
11
44
100
50
50
null
null
hguenther/smtlib2
extras/composite/Language/SMTLib2/Composite/Choice.hs
gpl-3.0
getChoices (ChoiceBool lst) = return $ fmap (\(el,c) -> (el,[c])) $ Vec.toList lst
82
getChoices (ChoiceBool lst) = return $ fmap (\(el,c) -> (el,[c])) $ Vec.toList lst
82
getChoices (ChoiceBool lst) = return $ fmap (\(el,c) -> (el,[c])) $ Vec.toList lst
82
false
false
2
10
12
56
29
27
null
null
nushio3/Paraiso
examples-old/GA/HydroMain.hs
bsd-3-clause
realDV :: DynValue realDV = DynValue{DVal.realm = Local, DVal.typeRep = typeOf (0::Real)}
89
realDV :: DynValue realDV = DynValue{DVal.realm = Local, DVal.typeRep = typeOf (0::Real)}
89
realDV = DynValue{DVal.realm = Local, DVal.typeRep = typeOf (0::Real)}
70
false
true
0
8
11
38
22
16
null
null
matonix/pfds
src/PFDS/Sec9/Ex14.hs
bsd-3-clause
lookup :: Int -> Queue a -> a lookup i (Q lenf f _ lenr r) = if i < lenf then L.lookup i f else L.lookup (lenr - (i - lenf) - 1) r
134
lookup :: Int -> Queue a -> a lookup i (Q lenf f _ lenr r) = if i < lenf then L.lookup i f else L.lookup (lenr - (i - lenf) - 1) r
134
lookup i (Q lenf f _ lenr r) = if i < lenf then L.lookup i f else L.lookup (lenr - (i - lenf) - 1) r
104
false
true
0
11
38
85
43
42
null
null
kovach/libsbp
haskell/src/SwiftNav/SBP/ExtEvents.hs
lgpl-3.0
msgExtEvent :: Word16 msgExtEvent = 0x0101
42
msgExtEvent :: Word16 msgExtEvent = 0x0101
42
msgExtEvent = 0x0101
20
false
true
0
4
5
11
6
5
null
null
nevrenato/HetsAlloy
CommonLogic/Sign.hs
gpl-2.0
sigUnionL [] = return emptySig
30
sigUnionL [] = return emptySig
30
sigUnionL [] = return emptySig
30
false
false
0
6
4
14
6
8
null
null
jputcu/VellemanK8055
System/Hardware/VellemanK8055.hs
bsd-3-clause
outputAnalogChannel:: DeviceHandle -> AnalogChannel -> Word8 -> IO () outputAnalogChannel hd ch v = do digi <- readAllDigital hd writeData hd $ case ch of Analog1 -> SetAnalogDigital digi v 0x00 Analog2 -> SetAnalogDigital digi 0x00 v
278
outputAnalogChannel:: DeviceHandle -> AnalogChannel -> Word8 -> IO () outputAnalogChannel hd ch v = do digi <- readAllDigital hd writeData hd $ case ch of Analog1 -> SetAnalogDigital digi v 0x00 Analog2 -> SetAnalogDigital digi 0x00 v
278
outputAnalogChannel hd ch v = do digi <- readAllDigital hd writeData hd $ case ch of Analog1 -> SetAnalogDigital digi v 0x00 Analog2 -> SetAnalogDigital digi 0x00 v
208
false
true
0
11
80
85
39
46
null
null
andorp/grin
grin/src/Grin/Lint.hs
bsd-3-clause
syntaxVal_ :: ValCtx -> Val -> Check () syntaxVal_ = void <$$> syntaxVal
72
syntaxVal_ :: ValCtx -> Val -> Check () syntaxVal_ = void <$$> syntaxVal
72
syntaxVal_ = void <$$> syntaxVal
32
false
true
0
8
12
28
14
14
null
null
wyleyr/org-citeproc
org-citeproc.hs
bsd-3-clause
-- functions to transform input into a Pandoc itemAsCitation :: Cite -> Citation itemAsCitation i = Citation { citationId = citeId i , citationPrefix = citePrefix i , citationSuffix = citeSuffix i , citationMode = if authorInText i then AuthorInText else if suppressAuthor i then SuppressAuthor else NormalCitation , citationNoteNum = 0 , citationHash = 0 }
718
itemAsCitation :: Cite -> Citation itemAsCitation i = Citation { citationId = citeId i , citationPrefix = citePrefix i , citationSuffix = citeSuffix i , citationMode = if authorInText i then AuthorInText else if suppressAuthor i then SuppressAuthor else NormalCitation , citationNoteNum = 0 , citationHash = 0 }
672
itemAsCitation i = Citation { citationId = citeId i , citationPrefix = citePrefix i , citationSuffix = citeSuffix i , citationMode = if authorInText i then AuthorInText else if suppressAuthor i then SuppressAuthor else NormalCitation , citationNoteNum = 0 , citationHash = 0 }
637
true
true
0
10
417
97
52
45
null
null
urv/fixhs
src/Data/FIX/Spec/FIX43.hs
lgpl-2.1
tProgRptReqs :: FIXTag tProgRptReqs = FIXTag { tName = "ProgRptReqs" , tnum = 414 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
157
tProgRptReqs :: FIXTag tProgRptReqs = FIXTag { tName = "ProgRptReqs" , tnum = 414 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
157
tProgRptReqs = FIXTag { tName = "ProgRptReqs" , tnum = 414 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
134
false
true
0
8
37
45
26
19
null
null
Copilot-Language/sbv-for-copilot
Data/SBV/Examples/Uninterpreted/UISortAllSat.hs
bsd-3-clause
-- | An uninterpreted "classify" function. Really, we only care about -- the fact that such a function exists, not what it does. classify :: SBV L -> SInteger classify = uninterpret "classify"
192
classify :: SBV L -> SInteger classify = uninterpret "classify"
63
classify = uninterpret "classify"
33
true
true
0
6
32
23
12
11
null
null
harendra-kumar/asyncly
benchmark/LinearAsync.hs
bsd-3-clause
{- _benchId :: NFData b => String -> (Ops.Stream m Int -> Identity b) -> Benchmark _benchId name f = bench name $ nf (runIdentity . f) (Ops.source 10) -} main :: IO () main = defaultMain [ bgroup "asyncly" [ benchSrcIO asyncly "unfoldr" Ops.sourceUnfoldr , benchSrcIO asyncly "unfoldrM" Ops.sourceUnfoldrM , benchSrcIO asyncly "fromFoldable" Ops.sourceFromFoldable , benchSrcIO asyncly "fromFoldableM" Ops.sourceFromFoldableM , benchSrcIO asyncly "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO asyncly "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO asyncly "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' asyncly 1 , benchIO "fmap" $ Ops.fmap' asyncly 1 , benchIO "mapM" $ Ops.mapM asyncly 1 , benchSrcIO asyncly "unfoldrM maxThreads 1" (maxThreads 1 . Ops.sourceUnfoldrM) , benchSrcIO asyncly "unfoldrM maxBuffer 1 (1000 ops)" (maxBuffer 1 . Ops.sourceUnfoldrMN 1000) ] , bgroup "wAsyncly" [ benchSrcIO wAsyncly "unfoldr" Ops.sourceUnfoldr , benchSrcIO wAsyncly "unfoldrM" Ops.sourceUnfoldrM , benchSrcIO wAsyncly "fromFoldable" Ops.sourceFromFoldable , benchSrcIO wAsyncly "fromFoldableM" Ops.sourceFromFoldableM , benchSrcIO wAsyncly "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO wAsyncly "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO wAsyncly "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' wAsyncly 1 , benchIO "fmap" $ Ops.fmap' wAsyncly 1 , benchIO "mapM" $ Ops.mapM wAsyncly 1 ] -- unfoldr and fromFoldable are always serial and thereofore the same for -- all stream types. , bgroup "aheadly" [ benchSrcIO aheadly "unfoldr" Ops.sourceUnfoldr , benchSrcIO aheadly "unfoldrM" Ops.sourceUnfoldrM , benchSrcIO aheadly "fromFoldableM" Ops.sourceFromFoldableM -- , benchSrcIO aheadly "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO aheadly "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO aheadly "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' aheadly 1 , benchIO "fmap" $ Ops.fmap' aheadly 1 , benchIO "mapM" $ Ops.mapM aheadly 1 , benchSrcIO aheadly "unfoldrM maxThreads 1" (maxThreads 1 . Ops.sourceUnfoldrM) , benchSrcIO aheadly "unfoldrM maxBuffer 1 (1000 ops)" (maxBuffer 1 . Ops.sourceUnfoldrMN 1000) -- , benchSrcIO aheadly "fromFoldable" Ops.sourceFromFoldable ] -- XXX need to use smaller streams to finish in reasonable time , bgroup "parallely" [ benchSrcIO parallely "unfoldr" Ops.sourceUnfoldr , benchSrcIO parallely "unfoldrM" Ops.sourceUnfoldrM --, benchSrcIO parallely "fromFoldable" Ops.sourceFromFoldable , benchSrcIO parallely "fromFoldableM" Ops.sourceFromFoldableM -- , benchSrcIO parallely "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO parallely "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO parallely "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' parallely 1 , benchIO "fmap" $ Ops.fmap' parallely 1 , benchIO "mapM" $ Ops.mapM parallely 1 -- Zip has only one parallel flavor , benchIO "zip" Ops.zipAsync , benchIO "zipM" Ops.zipAsyncM , benchIO "zipAp" Ops.zipAsyncAp -- Parallel stages in a pipeline , benchIO "parAppMap" Ops.parAppMap , benchIO "parAppSum" Ops.parAppSum ] ]
3,619
main :: IO () main = defaultMain [ bgroup "asyncly" [ benchSrcIO asyncly "unfoldr" Ops.sourceUnfoldr , benchSrcIO asyncly "unfoldrM" Ops.sourceUnfoldrM , benchSrcIO asyncly "fromFoldable" Ops.sourceFromFoldable , benchSrcIO asyncly "fromFoldableM" Ops.sourceFromFoldableM , benchSrcIO asyncly "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO asyncly "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO asyncly "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' asyncly 1 , benchIO "fmap" $ Ops.fmap' asyncly 1 , benchIO "mapM" $ Ops.mapM asyncly 1 , benchSrcIO asyncly "unfoldrM maxThreads 1" (maxThreads 1 . Ops.sourceUnfoldrM) , benchSrcIO asyncly "unfoldrM maxBuffer 1 (1000 ops)" (maxBuffer 1 . Ops.sourceUnfoldrMN 1000) ] , bgroup "wAsyncly" [ benchSrcIO wAsyncly "unfoldr" Ops.sourceUnfoldr , benchSrcIO wAsyncly "unfoldrM" Ops.sourceUnfoldrM , benchSrcIO wAsyncly "fromFoldable" Ops.sourceFromFoldable , benchSrcIO wAsyncly "fromFoldableM" Ops.sourceFromFoldableM , benchSrcIO wAsyncly "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO wAsyncly "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO wAsyncly "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' wAsyncly 1 , benchIO "fmap" $ Ops.fmap' wAsyncly 1 , benchIO "mapM" $ Ops.mapM wAsyncly 1 ] -- unfoldr and fromFoldable are always serial and thereofore the same for -- all stream types. , bgroup "aheadly" [ benchSrcIO aheadly "unfoldr" Ops.sourceUnfoldr , benchSrcIO aheadly "unfoldrM" Ops.sourceUnfoldrM , benchSrcIO aheadly "fromFoldableM" Ops.sourceFromFoldableM -- , benchSrcIO aheadly "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO aheadly "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO aheadly "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' aheadly 1 , benchIO "fmap" $ Ops.fmap' aheadly 1 , benchIO "mapM" $ Ops.mapM aheadly 1 , benchSrcIO aheadly "unfoldrM maxThreads 1" (maxThreads 1 . Ops.sourceUnfoldrM) , benchSrcIO aheadly "unfoldrM maxBuffer 1 (1000 ops)" (maxBuffer 1 . Ops.sourceUnfoldrMN 1000) -- , benchSrcIO aheadly "fromFoldable" Ops.sourceFromFoldable ] -- XXX need to use smaller streams to finish in reasonable time , bgroup "parallely" [ benchSrcIO parallely "unfoldr" Ops.sourceUnfoldr , benchSrcIO parallely "unfoldrM" Ops.sourceUnfoldrM --, benchSrcIO parallely "fromFoldable" Ops.sourceFromFoldable , benchSrcIO parallely "fromFoldableM" Ops.sourceFromFoldableM -- , benchSrcIO parallely "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO parallely "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO parallely "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' parallely 1 , benchIO "fmap" $ Ops.fmap' parallely 1 , benchIO "mapM" $ Ops.mapM parallely 1 -- Zip has only one parallel flavor , benchIO "zip" Ops.zipAsync , benchIO "zipM" Ops.zipAsyncM , benchIO "zipAp" Ops.zipAsyncAp -- Parallel stages in a pipeline , benchIO "parAppMap" Ops.parAppMap , benchIO "parAppSum" Ops.parAppSum ] ]
3,464
main = defaultMain [ bgroup "asyncly" [ benchSrcIO asyncly "unfoldr" Ops.sourceUnfoldr , benchSrcIO asyncly "unfoldrM" Ops.sourceUnfoldrM , benchSrcIO asyncly "fromFoldable" Ops.sourceFromFoldable , benchSrcIO asyncly "fromFoldableM" Ops.sourceFromFoldableM , benchSrcIO asyncly "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO asyncly "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO asyncly "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' asyncly 1 , benchIO "fmap" $ Ops.fmap' asyncly 1 , benchIO "mapM" $ Ops.mapM asyncly 1 , benchSrcIO asyncly "unfoldrM maxThreads 1" (maxThreads 1 . Ops.sourceUnfoldrM) , benchSrcIO asyncly "unfoldrM maxBuffer 1 (1000 ops)" (maxBuffer 1 . Ops.sourceUnfoldrMN 1000) ] , bgroup "wAsyncly" [ benchSrcIO wAsyncly "unfoldr" Ops.sourceUnfoldr , benchSrcIO wAsyncly "unfoldrM" Ops.sourceUnfoldrM , benchSrcIO wAsyncly "fromFoldable" Ops.sourceFromFoldable , benchSrcIO wAsyncly "fromFoldableM" Ops.sourceFromFoldableM , benchSrcIO wAsyncly "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO wAsyncly "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO wAsyncly "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' wAsyncly 1 , benchIO "fmap" $ Ops.fmap' wAsyncly 1 , benchIO "mapM" $ Ops.mapM wAsyncly 1 ] -- unfoldr and fromFoldable are always serial and thereofore the same for -- all stream types. , bgroup "aheadly" [ benchSrcIO aheadly "unfoldr" Ops.sourceUnfoldr , benchSrcIO aheadly "unfoldrM" Ops.sourceUnfoldrM , benchSrcIO aheadly "fromFoldableM" Ops.sourceFromFoldableM -- , benchSrcIO aheadly "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO aheadly "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO aheadly "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' aheadly 1 , benchIO "fmap" $ Ops.fmap' aheadly 1 , benchIO "mapM" $ Ops.mapM aheadly 1 , benchSrcIO aheadly "unfoldrM maxThreads 1" (maxThreads 1 . Ops.sourceUnfoldrM) , benchSrcIO aheadly "unfoldrM maxBuffer 1 (1000 ops)" (maxBuffer 1 . Ops.sourceUnfoldrMN 1000) -- , benchSrcIO aheadly "fromFoldable" Ops.sourceFromFoldable ] -- XXX need to use smaller streams to finish in reasonable time , bgroup "parallely" [ benchSrcIO parallely "unfoldr" Ops.sourceUnfoldr , benchSrcIO parallely "unfoldrM" Ops.sourceUnfoldrM --, benchSrcIO parallely "fromFoldable" Ops.sourceFromFoldable , benchSrcIO parallely "fromFoldableM" Ops.sourceFromFoldableM -- , benchSrcIO parallely "foldMapWith" Ops.sourceFoldMapWith , benchSrcIO parallely "foldMapWithM" Ops.sourceFoldMapWithM , benchSrcIO parallely "foldMapM" Ops.sourceFoldMapM , benchIO "map" $ Ops.map' parallely 1 , benchIO "fmap" $ Ops.fmap' parallely 1 , benchIO "mapM" $ Ops.mapM parallely 1 -- Zip has only one parallel flavor , benchIO "zip" Ops.zipAsync , benchIO "zipM" Ops.zipAsyncM , benchIO "zipAp" Ops.zipAsyncAp -- Parallel stages in a pipeline , benchIO "parAppMap" Ops.parAppMap , benchIO "parAppSum" Ops.parAppSum ] ]
3,450
true
true
0
13
939
697
346
351
null
null
da-x/lamdu
Lamdu/Sugar/OrderTags.hs
gpl-3.0
orderedClosedFlatComposite :: Lens.Prism' (T.Composite b) [(T.Tag, Type)] orderedClosedFlatComposite = orderedFlatComposite . tagged Lens._Nothing
150
orderedClosedFlatComposite :: Lens.Prism' (T.Composite b) [(T.Tag, Type)] orderedClosedFlatComposite = orderedFlatComposite . tagged Lens._Nothing
150
orderedClosedFlatComposite = orderedFlatComposite . tagged Lens._Nothing
76
false
true
0
8
16
46
24
22
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
4390 = 4389
11
4390 = 4389
11
4390 = 4389
11
false
false
1
5
2
10
3
7
null
null
uuhan/Idris-dev
src/Idris/Primitives.hs
bsd-3-clause
trunc f@(ITFixed from) t@(ITFixed to) val | nativeTyWidth from > nativeTyWidth to = intToInt f t val
100
trunc f@(ITFixed from) t@(ITFixed to) val | nativeTyWidth from > nativeTyWidth to = intToInt f t val
100
trunc f@(ITFixed from) t@(ITFixed to) val | nativeTyWidth from > nativeTyWidth to = intToInt f t val
100
false
false
0
9
16
54
25
29
null
null
rahulmutt/ghcvm
compiler/Eta/Prelude/PrimOp.hs
bsd-3-clause
primOpCanFail IndexOffAddrOp_Int16 = True
41
primOpCanFail IndexOffAddrOp_Int16 = True
41
primOpCanFail IndexOffAddrOp_Int16 = True
41
false
false
0
5
3
9
4
5
null
null
jimenezrick/unix
tests/getEnvironment01.hs
bsd-3-clause
ain = getEnvironment >>= (print . (0 <=) . length)
51
main = getEnvironment >>= (print . (0 <=) . length)
51
main = getEnvironment >>= (print . (0 <=) . length)
51
false
false
1
9
10
28
14
14
null
null
eeight/haskell-mms
src/Foreign/Mms/Map.hs
bsd-3-clause
lookup :: Ord k => Map 'Mapped k v -> k -> Maybe v lookup (MappedMap items) x = go 0 (V.length items) where go l r | l == r = Nothing | otherwise = let m = (l + r) `div` 2 (k, v) = items V.! m in case compare x k of LT -> go l m GT -> go m r EQ -> Just v
358
lookup :: Ord k => Map 'Mapped k v -> k -> Maybe v lookup (MappedMap items) x = go 0 (V.length items) where go l r | l == r = Nothing | otherwise = let m = (l + r) `div` 2 (k, v) = items V.! m in case compare x k of LT -> go l m GT -> go m r EQ -> Just v
358
lookup (MappedMap items) x = go 0 (V.length items) where go l r | l == r = Nothing | otherwise = let m = (l + r) `div` 2 (k, v) = items V.! m in case compare x k of LT -> go l m GT -> go m r EQ -> Just v
307
false
true
0
14
173
179
85
94
null
null
lorcanmcdonald/mars
src/Mars/Command/Ls.hs
bsd-3-clause
ansiColor :: ANSIColour -> Text -> Text ansiColor Grey = ansiWrap "30"
70
ansiColor :: ANSIColour -> Text -> Text ansiColor Grey = ansiWrap "30"
70
ansiColor Grey = ansiWrap "30"
30
false
true
0
6
11
25
12
13
null
null
jtapolczai/Scratchpad
src/Trees.hs
apache-2.0
lw (Node (_,l,_) _ _) = l
25
lw (Node (_,l,_) _ _) = l
25
lw (Node (_,l,_) _ _) = l
25
false
false
0
8
6
28
15
13
null
null
FranklinChen/Ebnf2ps
src/ParseAux.hs
bsd-3-clause
yaccPrepare happyresult = [noDup (getNt nt) | nt <- nub nonterminals] where (nonterminals, prods) = transform happyresult [] [] getNt str = [yaccPrepare' nonterminals p | p@(ProdProduction nt _ _) <- prods, str == nt] transform [] as bs = (as,bs) transform ((ProdProduction nt aliases (ProdTerm ps)):pss) as bs = transform pss' (nt:as) bs' where (factors, pss') = span isProdFactor pss bs' = bs ++ [ProdProduction nt aliases (ProdTerm ps')] ps' = ps ++ factors noDup [p] = p noDup (ProdProduction nt aliases (ProdTerm ps):p':ps') = ProdProduction nt aliases (ProdTerm (foldr (\ (ProdProduction _ _ (ProdTerm prods')) ps1 -> ps1++prods') ps (p':ps'))) isProdFactor p = case p of { ProdFactor _ -> True; _ -> False}
863
yaccPrepare happyresult = [noDup (getNt nt) | nt <- nub nonterminals] where (nonterminals, prods) = transform happyresult [] [] getNt str = [yaccPrepare' nonterminals p | p@(ProdProduction nt _ _) <- prods, str == nt] transform [] as bs = (as,bs) transform ((ProdProduction nt aliases (ProdTerm ps)):pss) as bs = transform pss' (nt:as) bs' where (factors, pss') = span isProdFactor pss bs' = bs ++ [ProdProduction nt aliases (ProdTerm ps')] ps' = ps ++ factors noDup [p] = p noDup (ProdProduction nt aliases (ProdTerm ps):p':ps') = ProdProduction nt aliases (ProdTerm (foldr (\ (ProdProduction _ _ (ProdTerm prods')) ps1 -> ps1++prods') ps (p':ps'))) isProdFactor p = case p of { ProdFactor _ -> True; _ -> False}
863
yaccPrepare happyresult = [noDup (getNt nt) | nt <- nub nonterminals] where (nonterminals, prods) = transform happyresult [] [] getNt str = [yaccPrepare' nonterminals p | p@(ProdProduction nt _ _) <- prods, str == nt] transform [] as bs = (as,bs) transform ((ProdProduction nt aliases (ProdTerm ps)):pss) as bs = transform pss' (nt:as) bs' where (factors, pss') = span isProdFactor pss bs' = bs ++ [ProdProduction nt aliases (ProdTerm ps')] ps' = ps ++ factors noDup [p] = p noDup (ProdProduction nt aliases (ProdTerm ps):p':ps') = ProdProduction nt aliases (ProdTerm (foldr (\ (ProdProduction _ _ (ProdTerm prods')) ps1 -> ps1++prods') ps (p':ps'))) isProdFactor p = case p of { ProdFactor _ -> True; _ -> False}
863
false
false
7
15
265
327
173
154
null
null
JLiangWaterloo/sat
Haskell/Group.hs
mit
testing :: Eq a => (b -> a) -> b -> b -> Bool testing = on (==)
63
testing :: Eq a => (b -> a) -> b -> b -> Bool testing = on (==)
63
testing = on (==)
17
false
true
0
8
17
42
22
20
null
null
michaelbeaumont/pandoc
tests/Tests/Old.hs
gpl-2.0
lhsReaderTest :: String -> Test lhsReaderTest format = testWithNormalize normalizer "lhs" ["-r", format, "-w", "native"] ("lhs-test" <.> format) norm where normalizer = writeNative def . normalize . handleError . readNative norm = if format == "markdown+lhs" then "lhs-test-markdown.native" else "lhs-test.native"
369
lhsReaderTest :: String -> Test lhsReaderTest format = testWithNormalize normalizer "lhs" ["-r", format, "-w", "native"] ("lhs-test" <.> format) norm where normalizer = writeNative def . normalize . handleError . readNative norm = if format == "markdown+lhs" then "lhs-test-markdown.native" else "lhs-test.native"
369
lhsReaderTest format = testWithNormalize normalizer "lhs" ["-r", format, "-w", "native"] ("lhs-test" <.> format) norm where normalizer = writeNative def . normalize . handleError . readNative norm = if format == "markdown+lhs" then "lhs-test-markdown.native" else "lhs-test.native"
337
false
true
0
8
95
90
47
43
null
null
cutsea110/magma
src/Data/Magma.hs
bsd-3-clause
-- | @'nodeRight' :: Traversal' ('BinaryTree' a) ('BinaryTree' a)@ nodeRight :: Applicative f => (BinaryTree a -> f (BinaryTree a)) -> BinaryTree a -> f (BinaryTree a) nodeRight f (Node l r) = (\r' -> Node l r') <$> f r
219
nodeRight :: Applicative f => (BinaryTree a -> f (BinaryTree a)) -> BinaryTree a -> f (BinaryTree a) nodeRight f (Node l r) = (\r' -> Node l r') <$> f r
152
nodeRight f (Node l r) = (\r' -> Node l r') <$> f r
51
true
true
0
11
40
96
45
51
null
null
amosr/limp
src/Numeric/Limp/Program/Linear.hs
mit
-- | Multiply a linear function by some constant. (*.) :: Rep c => KRep k c -> Linear z r c k -> Linear z r c k (*.) = flip (.*)
128
(*.) :: Rep c => KRep k c -> Linear z r c k -> Linear z r c k (*.) = flip (.*)
78
(*.) = flip (.*)
16
true
true
0
9
32
64
32
32
null
null
adept/hledger
hledger-lib/Hledger/Utils/Debug.hs
gpl-3.0
-- | Like dbg0, but also exit the program. Uses unsafePerformIO. dbgExit :: Show a => String -> a -> a dbgExit msg = const (unsafePerformIO exitFailure) . dbg0 msg
163
dbgExit :: Show a => String -> a -> a dbgExit msg = const (unsafePerformIO exitFailure) . dbg0 msg
98
dbgExit msg = const (unsafePerformIO exitFailure) . dbg0 msg
60
true
true
0
8
29
46
22
24
null
null
brendanhay/gogol
gogol-monitoring/gen/Network/Google/Monitoring/Types/Product.hs
mpl-2.0
-- | The descriptor for the time series data. qtsrTimeSeriesDescriptor :: Lens' QueryTimeSeriesResponse (Maybe TimeSeriesDescriptor) qtsrTimeSeriesDescriptor = lens _qtsrTimeSeriesDescriptor (\ s a -> s{_qtsrTimeSeriesDescriptor = a})
242
qtsrTimeSeriesDescriptor :: Lens' QueryTimeSeriesResponse (Maybe TimeSeriesDescriptor) qtsrTimeSeriesDescriptor = lens _qtsrTimeSeriesDescriptor (\ s a -> s{_qtsrTimeSeriesDescriptor = a})
196
qtsrTimeSeriesDescriptor = lens _qtsrTimeSeriesDescriptor (\ s a -> s{_qtsrTimeSeriesDescriptor = a})
109
true
true
0
8
33
49
25
24
null
null
tidalcycles/tidal-midi
Sound/Tidal/MIDI/CC.hs
gpl-3.0
(cc111, cc111_p) = pF "cc111" (Just 0)
38
(cc111, cc111_p) = pF "cc111" (Just 0)
38
(cc111, cc111_p) = pF "cc111" (Just 0)
38
false
false
0
6
6
25
12
13
null
null
rueshyna/gogol
gogol-books/gen/Network/Google/Books/Types/Product.hs
mpl-2.0
miiEncryptedKey :: Lens' MetadataItemsItem (Maybe Text) miiEncryptedKey = lens _miiEncryptedKey (\ s a -> s{_miiEncryptedKey = a})
138
miiEncryptedKey :: Lens' MetadataItemsItem (Maybe Text) miiEncryptedKey = lens _miiEncryptedKey (\ s a -> s{_miiEncryptedKey = a})
138
miiEncryptedKey = lens _miiEncryptedKey (\ s a -> s{_miiEncryptedKey = a})
82
false
true
1
9
24
50
24
26
null
null
fpoli/lambda
src/Lambda/Hash.hs
gpl-3.0
hashTerm (Lambda x m) = 1 + 3 * pack (hashVariable x) (hashTerm m)
66
hashTerm (Lambda x m) = 1 + 3 * pack (hashVariable x) (hashTerm m)
66
hashTerm (Lambda x m) = 1 + 3 * pack (hashVariable x) (hashTerm m)
66
false
false
2
8
13
44
20
24
null
null
anchor/haskell-netsuite
lib/Netsuite/Types/Fields.hs
bsd-3-clause
-- | opportunity > item nsSubtypeFields ("opportunity":"item":_) = [ "altsalesamt" , "amount" , "billingschedule" , "billvariancestatus" , "costestimate" , "costestimaterate" , "costestimatetype" , "daysbeforeexpiration" , "deferrevrec" , "description" , "expectedshipdate" , "fromjob" , "id" , "isestimate" , "istaxable" , "isvsoebundle" , "item" , "itemsubtype" , "itemtype" , "job" , "line" , "linenumber" , "matrixtype" , "options" , "price" , "printitems" , "quantity" , "rate" , "rateschedule" , "units" ]
573
nsSubtypeFields ("opportunity":"item":_) = [ "altsalesamt" , "amount" , "billingschedule" , "billvariancestatus" , "costestimate" , "costestimaterate" , "costestimatetype" , "daysbeforeexpiration" , "deferrevrec" , "description" , "expectedshipdate" , "fromjob" , "id" , "isestimate" , "istaxable" , "isvsoebundle" , "item" , "itemsubtype" , "itemtype" , "job" , "line" , "linenumber" , "matrixtype" , "options" , "price" , "printitems" , "quantity" , "rate" , "rateschedule" , "units" ]
549
nsSubtypeFields ("opportunity":"item":_) = [ "altsalesamt" , "amount" , "billingschedule" , "billvariancestatus" , "costestimate" , "costestimaterate" , "costestimatetype" , "daysbeforeexpiration" , "deferrevrec" , "description" , "expectedshipdate" , "fromjob" , "id" , "isestimate" , "istaxable" , "isvsoebundle" , "item" , "itemsubtype" , "itemtype" , "job" , "line" , "linenumber" , "matrixtype" , "options" , "price" , "printitems" , "quantity" , "rate" , "rateschedule" , "units" ]
549
true
false
0
8
130
111
71
40
null
null
danr/hipspec
testsuite/prod/zeno_version/PropT28.hs
gpl-3.0
double (S x) = S (S (double x))
31
double (S x) = S (S (double x))
31
double (S x) = S (S (double x))
31
false
false
0
9
7
31
14
17
null
null
ancientlanguage/haskell-analysis
grammar/src/Grammar/Common/Decompose.hs
mit
decomposeChar '\x0155' = "\x0072\x0301"
39
decomposeChar '\x0155' = "\x0072\x0301"
39
decomposeChar '\x0155' = "\x0072\x0301"
39
false
false
0
5
3
9
4
5
null
null
mightymoose/liquidhaskell
tests/neg/ex1-unsafe.hs
bsd-3-clause
-@ suc :: x:Int -> {v: Int | v = x + 1} @-} suc :: Int -> Int suc x = x + 1
76
suc :: Int -> Int suc x = x + 1
31
suc x = x + 1
13
true
true
5
7
25
48
29
19
null
null
brendanhay/gogol
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
mpl-2.0
-- | The seedResourceId object contains information about the resource that -- caused the recommendation. acdrSeedResourceId :: Lens' ActivityContentDetailsRecommendation (Maybe ResourceId) acdrSeedResourceId = lens _acdrSeedResourceId (\ s a -> s{_acdrSeedResourceId = a})
281
acdrSeedResourceId :: Lens' ActivityContentDetailsRecommendation (Maybe ResourceId) acdrSeedResourceId = lens _acdrSeedResourceId (\ s a -> s{_acdrSeedResourceId = a})
175
acdrSeedResourceId = lens _acdrSeedResourceId (\ s a -> s{_acdrSeedResourceId = a})
91
true
true
0
9
39
49
26
23
null
null
christiaanb/SoOSiM
src/SoOSiM/Simulator.hs
mit
handleInput t iface st state msg@(Left msgL@(Message (mTime,_) _ _)) | mTime < t = do r <- handleResult iface (componentBehaviour iface state (fromDynMsg iface msgL)) state return (r,Nothing) | otherwise = return ((st,state),Just msg)
272
handleInput t iface st state msg@(Left msgL@(Message (mTime,_) _ _)) | mTime < t = do r <- handleResult iface (componentBehaviour iface state (fromDynMsg iface msgL)) state return (r,Nothing) | otherwise = return ((st,state),Just msg)
272
handleInput t iface st state msg@(Left msgL@(Message (mTime,_) _ _)) | mTime < t = do r <- handleResult iface (componentBehaviour iface state (fromDynMsg iface msgL)) state return (r,Nothing) | otherwise = return ((st,state),Just msg)
272
false
false
0
14
72
131
64
67
null
null
phadej/reflex
src/Reflex/Spider/Internal.hs
bsd-3-clause
merge :: GCompare k => DMap (WrapArg Event k) -> Event (DMap k) merge m = EventMerge $ Merge { mergeParents = m , mergeSubscribed = unsafeNewIORef m Nothing }
164
merge :: GCompare k => DMap (WrapArg Event k) -> Event (DMap k) merge m = EventMerge $ Merge { mergeParents = m , mergeSubscribed = unsafeNewIORef m Nothing }
164
merge m = EventMerge $ Merge { mergeParents = m , mergeSubscribed = unsafeNewIORef m Nothing }
100
false
true
0
9
35
72
35
37
null
null
ssaavedra/liquidhaskell
src/Language/Haskell/Liquid/Desugar710/Coverage.hs
bsd-3-clause
addTickHsExpr (ExplicitTuple es boxity) = liftM2 ExplicitTuple (mapM addTickTupArg es) (return boxity)
142
addTickHsExpr (ExplicitTuple es boxity) = liftM2 ExplicitTuple (mapM addTickTupArg es) (return boxity)
142
addTickHsExpr (ExplicitTuple es boxity) = liftM2 ExplicitTuple (mapM addTickTupArg es) (return boxity)
142
false
false
0
7
51
38
18
20
null
null
input-output-hk/pos-haskell-prototype
infra/src/Pos/Infra/DHT/Model/Types.hs
mit
-- TODO export lengths from HashNodeId module meaningPartLength :: Int meaningPartLength = 14
93
meaningPartLength :: Int meaningPartLength = 14
47
meaningPartLength = 14
22
true
true
0
6
12
19
8
11
null
null
UU-ComputerScience/uulib
src/UU/Parsing/Derived.hs
bsd-3-clause
pFoldrSep :: (IsParser p s) => (v -> b -> b, b) -> p a -> p v -> p b pFoldrSep alg sep p = pFoldrSep_gr alg sep p
126
pFoldrSep :: (IsParser p s) => (v -> b -> b, b) -> p a -> p v -> p b pFoldrSep alg sep p = pFoldrSep_gr alg sep p
126
pFoldrSep alg sep p = pFoldrSep_gr alg sep p
56
false
true
0
10
42
75
36
39
null
null
janschulz/pandoc
src/Text/Pandoc/Writers/Markdown.hs
gpl-2.0
inlineToMarkdown opts (Emph lst) = do plain <- gets stPlain contents <- inlineListToMarkdown opts lst return $ if plain then "_" <> contents <> "_" else "*" <> contents <> "*"
209
inlineToMarkdown opts (Emph lst) = do plain <- gets stPlain contents <- inlineListToMarkdown opts lst return $ if plain then "_" <> contents <> "_" else "*" <> contents <> "*"
209
inlineToMarkdown opts (Emph lst) = do plain <- gets stPlain contents <- inlineListToMarkdown opts lst return $ if plain then "_" <> contents <> "_" else "*" <> contents <> "*"
209
false
false
0
10
64
70
33
37
null
null
pjones/xmonad-test
vendor/xmonad-contrib/XMonad/Layout/LayoutBuilder.hs
bsd-2-clause
absBox :: Int -- ^ Absolute X-Position -> Int -- ^ Absolute Y-Position -> Int -- ^ Absolute width -> Int -- ^ Absolute height -> SubBox -- ^ The resulting 'SubBox' describing the area absBox x y w h = SubBox (Abs x) (Abs y) (Abs w) (Abs h)
284
absBox :: Int -- ^ Absolute X-Position -> Int -- ^ Absolute Y-Position -> Int -- ^ Absolute width -> Int -- ^ Absolute height -> SubBox absBox x y w h = SubBox (Abs x) (Abs y) (Abs w) (Abs h)
235
absBox x y w h = SubBox (Abs x) (Abs y) (Abs w) (Abs h)
55
true
true
0
8
94
74
39
35
null
null
jiayuanmark/Haxl
Haxl/Core/Memo.hs
bsd-3-clause
-- ----------------------------------------------------------------------------- -- Memoization -- | 'cachedComputation' memoizes a Haxl computation. The key is a -- request. -- -- /Note:/ These cached computations will /not/ be included in the output -- of 'dumpCacheAsHaskell'. -- cachedComputation :: forall req u w a. ( Eq (req a) , Hashable (req a) , Typeable (req a)) => req a -> GenHaxl u w a -> GenHaxl u w a cachedComputation req haxl = GenHaxl $ \env@Env{..} -> do cache <- readIORef memoRef ifProfiling flags $ modifyIORef' profRef (incrementMemoHitCounterFor profLabel) case DataCache.lookup req cache of Just ivar -> unHaxl (getIVarWithWrites ivar) env Nothing -> do ivar <- newIVar writeIORef memoRef $! DataCache.insertNotShowable req ivar cache unHaxl (execMemoNow haxl ivar) env -- | Like 'cachedComputation', but fails if the cache is already -- populated. -- -- Memoization can be (ab)used to "mock" a cached computation, by -- pre-populating the cache with an alternative implementation. In -- that case we don't want the operation to populate the cache to -- silently succeed if the cache is already populated. --
1,200
cachedComputation :: forall req u w a. ( Eq (req a) , Hashable (req a) , Typeable (req a)) => req a -> GenHaxl u w a -> GenHaxl u w a cachedComputation req haxl = GenHaxl $ \env@Env{..} -> do cache <- readIORef memoRef ifProfiling flags $ modifyIORef' profRef (incrementMemoHitCounterFor profLabel) case DataCache.lookup req cache of Just ivar -> unHaxl (getIVarWithWrites ivar) env Nothing -> do ivar <- newIVar writeIORef memoRef $! DataCache.insertNotShowable req ivar cache unHaxl (execMemoNow haxl ivar) env -- | Like 'cachedComputation', but fails if the cache is already -- populated. -- -- Memoization can be (ab)used to "mock" a cached computation, by -- pre-populating the cache with an alternative implementation. In -- that case we don't want the operation to populate the cache to -- silently succeed if the cache is already populated. --
914
cachedComputation req haxl = GenHaxl $ \env@Env{..} -> do cache <- readIORef memoRef ifProfiling flags $ modifyIORef' profRef (incrementMemoHitCounterFor profLabel) case DataCache.lookup req cache of Just ivar -> unHaxl (getIVarWithWrites ivar) env Nothing -> do ivar <- newIVar writeIORef memoRef $! DataCache.insertNotShowable req ivar cache unHaxl (execMemoNow haxl ivar) env -- | Like 'cachedComputation', but fails if the cache is already -- populated. -- -- Memoization can be (ab)used to "mock" a cached computation, by -- pre-populating the cache with an alternative implementation. In -- that case we don't want the operation to populate the cache to -- silently succeed if the cache is already populated. --
756
true
true
0
16
238
235
120
115
null
null
zeniuseducation/poly-euler
Alfa/ml/common.hs
epl-1.0
digSum :: Integral a => a -> a digSum x = iter x 0 where iter n res | n < 10 = n + res | otherwise = iter (div n 10) (res + rem n 10)
156
digSum :: Integral a => a -> a digSum x = iter x 0 where iter n res | n < 10 = n + res | otherwise = iter (div n 10) (res + rem n 10)
156
digSum x = iter x 0 where iter n res | n < 10 = n + res | otherwise = iter (div n 10) (res + rem n 10)
125
false
true
0
9
60
90
42
48
null
null
kishoredbn/barrelfish
tools/flounder/AHCI.hs
mit
has_meta_arg :: String -> String -> [(String, [(String, MetaArgument)])] -> Bool has_meta_arg nspc n metaargs = isJust $ get_meta_arg nspc n metaargs
149
has_meta_arg :: String -> String -> [(String, [(String, MetaArgument)])] -> Bool has_meta_arg nspc n metaargs = isJust $ get_meta_arg nspc n metaargs
149
has_meta_arg nspc n metaargs = isJust $ get_meta_arg nspc n metaargs
68
false
true
0
12
21
64
33
31
null
null
andrewthad/vinyl-vectors
src/Data/Vector/Vinyl/Default/NonEmpty/Tagged.hs
bsd-3-clause
-- | /O(n)/ Left fold with strict accumulator foldl' :: G.Vector (Vector k) (Rec (TaggedFunctor Identity) rs) => (r -> Rec (TaggedFunctor Identity) rs -> r) -> r -> (Vector k) (Rec (TaggedFunctor Identity) rs) -> r foldl' = G.foldl'
234
foldl' :: G.Vector (Vector k) (Rec (TaggedFunctor Identity) rs) => (r -> Rec (TaggedFunctor Identity) rs -> r) -> r -> (Vector k) (Rec (TaggedFunctor Identity) rs) -> r foldl' = G.foldl'
188
foldl' = G.foldl'
17
true
true
0
14
41
109
52
57
null
null
beni55/hspec
hspec-contrib/test/Test/Hspec/Contrib/HUnitSpec.hs
mit
spec :: Spec spec = do describe "fromHUnitTest" $ do let e = TestCase $ pure () it "works for a TestCase" $ do e `shouldYield` [Leaf "<unlabeled>"] it "works for a labeled TestCase" $ do TestLabel "foo" e `shouldYield` [Leaf "foo"] it "works for a TestCase with nested labels" $ do (TestLabel "foo" . TestLabel "bar") e `shouldYield` [Node "foo" [Leaf "bar"]] it "works for a flat TestList" $ do TestList [e, e, e] `shouldYield` [Leaf "<unlabeled>", Leaf "<unlabeled>", Leaf "<unlabeled>"] it "works for a nested TestList" $ do (TestLabel "foo" . TestLabel "bar" . TestList) [TestLabel "one" e, TestLabel "two" e, TestLabel "three" e] `shouldYield` [Node "foo" [Node "bar" [Leaf "one", Leaf "two", Leaf "three"]]]
806
spec :: Spec spec = do describe "fromHUnitTest" $ do let e = TestCase $ pure () it "works for a TestCase" $ do e `shouldYield` [Leaf "<unlabeled>"] it "works for a labeled TestCase" $ do TestLabel "foo" e `shouldYield` [Leaf "foo"] it "works for a TestCase with nested labels" $ do (TestLabel "foo" . TestLabel "bar") e `shouldYield` [Node "foo" [Leaf "bar"]] it "works for a flat TestList" $ do TestList [e, e, e] `shouldYield` [Leaf "<unlabeled>", Leaf "<unlabeled>", Leaf "<unlabeled>"] it "works for a nested TestList" $ do (TestLabel "foo" . TestLabel "bar" . TestList) [TestLabel "one" e, TestLabel "two" e, TestLabel "three" e] `shouldYield` [Node "foo" [Node "bar" [Leaf "one", Leaf "two", Leaf "three"]]]
806
spec = do describe "fromHUnitTest" $ do let e = TestCase $ pure () it "works for a TestCase" $ do e `shouldYield` [Leaf "<unlabeled>"] it "works for a labeled TestCase" $ do TestLabel "foo" e `shouldYield` [Leaf "foo"] it "works for a TestCase with nested labels" $ do (TestLabel "foo" . TestLabel "bar") e `shouldYield` [Node "foo" [Leaf "bar"]] it "works for a flat TestList" $ do TestList [e, e, e] `shouldYield` [Leaf "<unlabeled>", Leaf "<unlabeled>", Leaf "<unlabeled>"] it "works for a nested TestList" $ do (TestLabel "foo" . TestLabel "bar" . TestList) [TestLabel "one" e, TestLabel "two" e, TestLabel "three" e] `shouldYield` [Node "foo" [Node "bar" [Leaf "one", Leaf "two", Leaf "three"]]]
793
false
true
0
20
209
296
140
156
null
null
gridaphobe/ghc
compiler/stgSyn/CoreToStg.hs
bsd-3-clause
coreToStgRhs :: FreeVarsInfo -- Free var info for the scope of the binding -> [Id] -> (Id,CoreExpr) -> LneM (StgRhs, FreeVarsInfo, LiveInfo, EscVarsSet) coreToStgRhs scope_fv_info binders (bndr, rhs) = do (new_rhs, rhs_fvs, rhs_escs) <- coreToStgExpr rhs lv_info <- freeVarsToLiveVars (binders `minusFVBinders` rhs_fvs) return (mkStgRhs rhs_fvs (mkSRT lv_info) bndr bndr_info new_rhs, rhs_fvs, lv_info, rhs_escs) where bndr_info = lookupFVInfo scope_fv_info bndr
537
coreToStgRhs :: FreeVarsInfo -- Free var info for the scope of the binding -> [Id] -> (Id,CoreExpr) -> LneM (StgRhs, FreeVarsInfo, LiveInfo, EscVarsSet) coreToStgRhs scope_fv_info binders (bndr, rhs) = do (new_rhs, rhs_fvs, rhs_escs) <- coreToStgExpr rhs lv_info <- freeVarsToLiveVars (binders `minusFVBinders` rhs_fvs) return (mkStgRhs rhs_fvs (mkSRT lv_info) bndr bndr_info new_rhs, rhs_fvs, lv_info, rhs_escs) where bndr_info = lookupFVInfo scope_fv_info bndr
536
coreToStgRhs scope_fv_info binders (bndr, rhs) = do (new_rhs, rhs_fvs, rhs_escs) <- coreToStgExpr rhs lv_info <- freeVarsToLiveVars (binders `minusFVBinders` rhs_fvs) return (mkStgRhs rhs_fvs (mkSRT lv_info) bndr bndr_info new_rhs, rhs_fvs, lv_info, rhs_escs) where bndr_info = lookupFVInfo scope_fv_info bndr
339
false
true
0
11
133
147
79
68
null
null
shlevy/ghc
libraries/base/GHC/Conc/IO.hs
bsd-3-clause
-- | Suspends the current thread for a given number of microseconds -- (GHC only). -- -- There is no guarantee that the thread will be rescheduled promptly -- when the delay has expired, but the thread will never continue to -- run /earlier/ than specified. -- threadDelay :: Int -> IO () threadDelay time #if defined(mingw32_HOST_OS) | threaded = Windows.threadDelay time #else | threaded = Event.threadDelay time #endif | otherwise = IO $ \s -> case time of { I# time# -> case delay# time# s of { s' -> (# s', () #) }}
552
threadDelay :: Int -> IO () threadDelay time #if defined(mingw32_HOST_OS) | threaded = Windows.threadDelay time #else | threaded = Event.threadDelay time #endif | otherwise = IO $ \s -> case time of { I# time# -> case delay# time# s of { s' -> (# s', () #) }}
291
threadDelay time #if defined(mingw32_HOST_OS) | threaded = Windows.threadDelay time #else | threaded = Event.threadDelay time #endif | otherwise = IO $ \s -> case time of { I# time# -> case delay# time# s of { s' -> (# s', () #) }}
263
true
true
1
14
127
99
55
44
null
null
GU-CLASP/TypedFlow
TypedFlow/Abstract.hs
lgpl-3.0
-- gather params ix = GatherND (typeSShape @'[n]) (typeSShape @s) (typeSShape @indexShape) params $ -- prodHomo @indexShape @'[1] $ -- (reshapeAuto ix) -- | @(lookup i xs) = xs[i]@. This function returns an element of a -- tensor at a dynamic index. This is a version of 'gather' -- specialised to a scalar index. lookupT :: KnownShape xs => KnownNat n => Scalar Int32 -> Tensor (n ': xs) t -> Tensor xs t lookupT ix xs = gather xs ix
439
lookupT :: KnownShape xs => KnownNat n => Scalar Int32 -> Tensor (n ': xs) t -> Tensor xs t lookupT ix xs = gather xs ix
120
lookupT ix xs = gather xs ix
28
true
true
0
11
85
71
36
35
null
null
CulpaBS/wbBach
src/Futhark/Analysis/ScalExp.hs
bsd-3-clause
expandScalExp look (SDiv x y) = SDiv (expandScalExp look x) (expandScalExp look y)
82
expandScalExp look (SDiv x y) = SDiv (expandScalExp look x) (expandScalExp look y)
82
expandScalExp look (SDiv x y) = SDiv (expandScalExp look x) (expandScalExp look y)
82
false
false
0
7
12
42
19
23
null
null
tolysz/postgresql-simple
src/Database/PostgreSQL/Simple.hs
bsd-3-clause
buildQuery :: Connection -> Query -> ByteString -> [Action] -> IO Builder buildQuery conn q template xs = zipParams (split template) <$> mapM (buildAction conn q xs) xs where split s = let (h,t) = B.break (=='?') s in byteString h : if B.null t then [] else split (B.tail t) zipParams (t:ts) (p:ps) = t <> p <> zipParams ts ps zipParams [t] [] = t zipParams _ _ = fmtError (show (B.count '?' template) ++ " '?' characters, but " ++ show (length xs) ++ " parameters") q xs -- | Execute an @INSERT@, @UPDATE@, or other SQL query that is not -- expected to return results. -- -- Returns the number of rows affected. -- -- Throws 'FormatError' if the query could not be formatted correctly, or -- a 'SqlError' exception if the backend returns an error.
927
buildQuery :: Connection -> Query -> ByteString -> [Action] -> IO Builder buildQuery conn q template xs = zipParams (split template) <$> mapM (buildAction conn q xs) xs where split s = let (h,t) = B.break (=='?') s in byteString h : if B.null t then [] else split (B.tail t) zipParams (t:ts) (p:ps) = t <> p <> zipParams ts ps zipParams [t] [] = t zipParams _ _ = fmtError (show (B.count '?' template) ++ " '?' characters, but " ++ show (length xs) ++ " parameters") q xs -- | Execute an @INSERT@, @UPDATE@, or other SQL query that is not -- expected to return results. -- -- Returns the number of rows affected. -- -- Throws 'FormatError' if the query could not be formatted correctly, or -- a 'SqlError' exception if the backend returns an error.
927
buildQuery conn q template xs = zipParams (split template) <$> mapM (buildAction conn q xs) xs where split s = let (h,t) = B.break (=='?') s in byteString h : if B.null t then [] else split (B.tail t) zipParams (t:ts) (p:ps) = t <> p <> zipParams ts ps zipParams [t] [] = t zipParams _ _ = fmtError (show (B.count '?' template) ++ " '?' characters, but " ++ show (length xs) ++ " parameters") q xs -- | Execute an @INSERT@, @UPDATE@, or other SQL query that is not -- expected to return results. -- -- Returns the number of rows affected. -- -- Throws 'FormatError' if the query could not be formatted correctly, or -- a 'SqlError' exception if the backend returns an error.
853
false
true
3
18
318
254
130
124
null
null
travitch/foreign-inference
src/Foreign/Inference/Analysis/Output.hs
bsd-3-clause
memcpyTransfer _ info _ _ _ _ = return info
43
memcpyTransfer _ info _ _ _ _ = return info
43
memcpyTransfer _ info _ _ _ _ = return info
43
false
false
0
5
9
22
10
12
null
null
dysinger/amazonka
amazonka-ec2/gen/Network/AWS/EC2/DescribeInstanceStatus.hs
mpl-2.0
disDryRun :: Lens' DescribeInstanceStatus (Maybe Bool) disDryRun = lens _disDryRun (\s a -> s { _disDryRun = a })
113
disDryRun :: Lens' DescribeInstanceStatus (Maybe Bool) disDryRun = lens _disDryRun (\s a -> s { _disDryRun = a })
113
disDryRun = lens _disDryRun (\s a -> s { _disDryRun = a })
58
false
true
0
9
18
45
24
21
null
null
CulpaBS/wbBach
src/Futhark/Optimise/Simplifier/Rules.hs
bsd-3-clause
removeSingletonSplits :: MonadBinder m => TopDownRule m removeSingletonSplits _ (Let pat _ (PrimOp (Split _ [n] arr))) = do size <- arraySize 0 <$> lookupType arr if size == n then letBind_ pat $ PrimOp $ SubExp $ Var arr else cannotSimplify
253
removeSingletonSplits :: MonadBinder m => TopDownRule m removeSingletonSplits _ (Let pat _ (PrimOp (Split _ [n] arr))) = do size <- arraySize 0 <$> lookupType arr if size == n then letBind_ pat $ PrimOp $ SubExp $ Var arr else cannotSimplify
253
removeSingletonSplits _ (Let pat _ (PrimOp (Split _ [n] arr))) = do size <- arraySize 0 <$> lookupType arr if size == n then letBind_ pat $ PrimOp $ SubExp $ Var arr else cannotSimplify
197
false
true
0
12
53
105
50
55
null
null
spicyj/tex-parser
src/TeX/Parser/MacroParser.hs
mit
parseExpansion :: Def -> TeXParser [Token] parseExpansion (Def func params replacement) = do _ <- exactToken (ControlSequence func) replacementParams <- parseParams params return $ replaceParams replacement replacementParams
230
parseExpansion :: Def -> TeXParser [Token] parseExpansion (Def func params replacement) = do _ <- exactToken (ControlSequence func) replacementParams <- parseParams params return $ replaceParams replacement replacementParams
230
parseExpansion (Def func params replacement) = do _ <- exactToken (ControlSequence func) replacementParams <- parseParams params return $ replaceParams replacement replacementParams
187
false
true
0
10
32
72
33
39
null
null
myShoggoth/shakespeare
test/Text/Shakespeare/HamletSpec.hs
mit
caseMetaEmpty :: Assertion caseMetaEmpty = do helper "<meta>\n" [hamlet|<meta>|] helper "<meta/>\n" [xhamlet|<meta>|]
125
caseMetaEmpty :: Assertion caseMetaEmpty = do helper "<meta>\n" [hamlet|<meta>|] helper "<meta/>\n" [xhamlet|<meta>|]
125
caseMetaEmpty = do helper "<meta>\n" [hamlet|<meta>|] helper "<meta/>\n" [xhamlet|<meta>|]
98
false
true
0
7
19
35
20
15
null
null
charleso/intellij-haskforce
tests/gold/parser/Fun00009.hs
apache-2.0
f x = case x of Just x | null x -> 9.3 Nothing -> 7.1
67
f x = case x of Just x | null x -> 9.3 Nothing -> 7.1
67
f x = case x of Just x | null x -> 9.3 Nothing -> 7.1
67
false
false
1
11
29
41
16
25
null
null
yjwen/hada
examples/Plus.hs
lgpl-3.0
plus :: Int -> Int -> Int plus = (+)
36
plus :: Int -> Int -> Int plus = (+)
36
plus = (+)
10
false
true
0
8
9
28
13
15
null
null
stefan-hoeck/labeled-graph
Data/Graph/Simple/Edge.hs
bsd-3-clause
-- | Creates an edge from tow integers -- -- Throws an error if the integers are equal or -- do not represent valid vertices. (<->) ∷ Int → Int → Edge x <-> y = edge (vertex x) (vertex y)
191
(<->) ∷ Int → Int → Edge x <-> y = edge (vertex x) (vertex y)
61
x <-> y = edge (vertex x) (vertex y)
36
true
true
0
9
44
49
26
23
null
null
mariefarrell/Hets
glade-0.12.5.0/demo/scaling/Scaling.hs
gpl-2.0
scaleDialog :: Window -> Int -> Int-> IO (Maybe (Int, Int)) scaleDialog parent width height = do Just xml <- xmlNew "scaling.glade" dia <- xmlGetWidget xml castToDialog "dialogScale" dialogAddButton dia stockCancel ResponseCancel dialogAddButton dia stockOk ResponseOk entryWidth <- xmlGetWidget xml castToEntry "entryScalingWidth" entryHeight <- xmlGetWidget xml castToEntry "entryScalingHeight" entrySetText entryWidth (show width) entrySetText entryHeight (show height) res <- dialogRun dia widthStr <- entryGetText entryWidth heightStr <- entryGetText entryHeight widgetDestroy dia putStrLn ("scaleDialog width: "++show width++" height: "++show height) case res of ResponseOk -> return (Just (read widthStr,read heightStr)) _ -> return Nothing
786
scaleDialog :: Window -> Int -> Int-> IO (Maybe (Int, Int)) scaleDialog parent width height = do Just xml <- xmlNew "scaling.glade" dia <- xmlGetWidget xml castToDialog "dialogScale" dialogAddButton dia stockCancel ResponseCancel dialogAddButton dia stockOk ResponseOk entryWidth <- xmlGetWidget xml castToEntry "entryScalingWidth" entryHeight <- xmlGetWidget xml castToEntry "entryScalingHeight" entrySetText entryWidth (show width) entrySetText entryHeight (show height) res <- dialogRun dia widthStr <- entryGetText entryWidth heightStr <- entryGetText entryHeight widgetDestroy dia putStrLn ("scaleDialog width: "++show width++" height: "++show height) case res of ResponseOk -> return (Just (read widthStr,read heightStr)) _ -> return Nothing
786
scaleDialog parent width height = do Just xml <- xmlNew "scaling.glade" dia <- xmlGetWidget xml castToDialog "dialogScale" dialogAddButton dia stockCancel ResponseCancel dialogAddButton dia stockOk ResponseOk entryWidth <- xmlGetWidget xml castToEntry "entryScalingWidth" entryHeight <- xmlGetWidget xml castToEntry "entryScalingHeight" entrySetText entryWidth (show width) entrySetText entryHeight (show height) res <- dialogRun dia widthStr <- entryGetText entryWidth heightStr <- entryGetText entryHeight widgetDestroy dia putStrLn ("scaleDialog width: "++show width++" height: "++show height) case res of ResponseOk -> return (Just (read widthStr,read heightStr)) _ -> return Nothing
726
false
true
0
14
130
254
112
142
null
null
ezyang/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
translateOp _ DoubleLeOp = Just (MO_F_Le W64)
54
translateOp _ DoubleLeOp = Just (MO_F_Le W64)
54
translateOp _ DoubleLeOp = Just (MO_F_Le W64)
54
false
false
1
7
15
21
9
12
null
null
nna774/term
Testing/Term.hs
gpl-3.0
applyToBindT c t0 (Mul t1 t2) = Mul (applyToBindT c t0 t1) (applyToBindT c t0 t2)
81
applyToBindT c t0 (Mul t1 t2) = Mul (applyToBindT c t0 t1) (applyToBindT c t0 t2)
81
applyToBindT c t0 (Mul t1 t2) = Mul (applyToBindT c t0 t1) (applyToBindT c t0 t2)
81
false
false
0
7
15
47
22
25
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/Notification.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/Notification.onclose Mozilla Notification.onclose documentation> cLoseEvent :: EventName Notification CloseEvent cLoseEvent = unsafeEventNameAsync (toJSString "close")
223
cLoseEvent :: EventName Notification CloseEvent cLoseEvent = unsafeEventNameAsync (toJSString "close")
102
cLoseEvent = unsafeEventNameAsync (toJSString "close")
54
true
true
0
7
16
26
13
13
null
null