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
christiaanb/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
xorIntegerIdKey = mkPreludeMiscIdUnique 93
56
xorIntegerIdKey = mkPreludeMiscIdUnique 93
56
xorIntegerIdKey = mkPreludeMiscIdUnique 93
56
false
false
0
5
17
9
4
5
null
null
mrmonday/Idris-dev
src/IRTS/Lang.hs
bsd-3-clause
allocUnique defs (n, LFun opts fn args e) = let e' = evalState (findUp e) [] in (n, LFun opts fn args e') where -- Keep track of 'updatable' names in the state, i.e. names whose heap -- entry may be reused, along with the arity which was there findUp :: LExp -> State [(Name, Int)] LExp findUp (LApp t (LV (Glob n)) as) | Just (LConstructor _ i ar) <- lookupCtxtExact n defs, ar == length as = findUp (LCon Nothing i n as) findUp (LV (Glob n)) | Just (LConstructor _ i 0) <- lookupCtxtExact n defs = return $ LCon Nothing i n [] -- nullary cons are global, no need to update findUp (LApp t f as) = LApp t <$> findUp f <*> mapM findUp as findUp (LLazyApp n as) = LLazyApp n <$> mapM findUp as findUp (LLazyExp e) = LLazyExp <$> findUp e findUp (LForce e) = LForce <$> findUp e -- use assumption that names are unique! findUp (LLet n val sc) = LLet n <$> findUp val <*> findUp sc findUp (LLam ns sc) = LLam ns <$> findUp sc findUp (LProj e i) = LProj <$> findUp e <*> return i findUp (LCon (Just l) i n es) = LCon (Just l) i n <$> mapM findUp es findUp (LCon Nothing i n es) = do avail <- get v <- findVar [] avail (length es) LCon v i n <$> mapM findUp es findUp (LForeign t s es) = LForeign t s <$> mapM (\ (t, e) -> do e' <- findUp e return (t, e')) es findUp (LOp o es) = LOp o <$> mapM findUp es findUp (LCase Updatable e@(LV (Glob n)) as) = LCase Updatable e <$> mapM (doUpAlt n) as findUp (LCase t e as) = LCase t <$> findUp e <*> mapM findUpAlt as findUp t = return t findUpAlt (LConCase i t args rhs) = do avail <- get rhs' <- findUp rhs put avail return $ LConCase i t args rhs' findUpAlt (LConstCase i rhs) = LConstCase i <$> findUp rhs findUpAlt (LDefaultCase rhs) = LDefaultCase <$> findUp rhs doUpAlt n (LConCase i t args rhs) = do avail <- get put ((n, length args) : avail) rhs' <- findUp rhs put avail return $ LConCase i t args rhs' doUpAlt n (LConstCase i rhs) = LConstCase i <$> findUp rhs doUpAlt n (LDefaultCase rhs) = LDefaultCase <$> findUp rhs findVar _ [] i = return Nothing findVar acc ((n, l) : ns) i | l == i = do put (reverse acc ++ ns) return (Just (Glob n)) findVar acc (n : ns) i = findVar (n : acc) ns i -- Return variables in list which are used in the expression
2,756
allocUnique defs (n, LFun opts fn args e) = let e' = evalState (findUp e) [] in (n, LFun opts fn args e') where -- Keep track of 'updatable' names in the state, i.e. names whose heap -- entry may be reused, along with the arity which was there findUp :: LExp -> State [(Name, Int)] LExp findUp (LApp t (LV (Glob n)) as) | Just (LConstructor _ i ar) <- lookupCtxtExact n defs, ar == length as = findUp (LCon Nothing i n as) findUp (LV (Glob n)) | Just (LConstructor _ i 0) <- lookupCtxtExact n defs = return $ LCon Nothing i n [] -- nullary cons are global, no need to update findUp (LApp t f as) = LApp t <$> findUp f <*> mapM findUp as findUp (LLazyApp n as) = LLazyApp n <$> mapM findUp as findUp (LLazyExp e) = LLazyExp <$> findUp e findUp (LForce e) = LForce <$> findUp e -- use assumption that names are unique! findUp (LLet n val sc) = LLet n <$> findUp val <*> findUp sc findUp (LLam ns sc) = LLam ns <$> findUp sc findUp (LProj e i) = LProj <$> findUp e <*> return i findUp (LCon (Just l) i n es) = LCon (Just l) i n <$> mapM findUp es findUp (LCon Nothing i n es) = do avail <- get v <- findVar [] avail (length es) LCon v i n <$> mapM findUp es findUp (LForeign t s es) = LForeign t s <$> mapM (\ (t, e) -> do e' <- findUp e return (t, e')) es findUp (LOp o es) = LOp o <$> mapM findUp es findUp (LCase Updatable e@(LV (Glob n)) as) = LCase Updatable e <$> mapM (doUpAlt n) as findUp (LCase t e as) = LCase t <$> findUp e <*> mapM findUpAlt as findUp t = return t findUpAlt (LConCase i t args rhs) = do avail <- get rhs' <- findUp rhs put avail return $ LConCase i t args rhs' findUpAlt (LConstCase i rhs) = LConstCase i <$> findUp rhs findUpAlt (LDefaultCase rhs) = LDefaultCase <$> findUp rhs doUpAlt n (LConCase i t args rhs) = do avail <- get put ((n, length args) : avail) rhs' <- findUp rhs put avail return $ LConCase i t args rhs' doUpAlt n (LConstCase i rhs) = LConstCase i <$> findUp rhs doUpAlt n (LDefaultCase rhs) = LDefaultCase <$> findUp rhs findVar _ [] i = return Nothing findVar acc ((n, l) : ns) i | l == i = do put (reverse acc ++ ns) return (Just (Glob n)) findVar acc (n : ns) i = findVar (n : acc) ns i -- Return variables in list which are used in the expression
2,756
allocUnique defs (n, LFun opts fn args e) = let e' = evalState (findUp e) [] in (n, LFun opts fn args e') where -- Keep track of 'updatable' names in the state, i.e. names whose heap -- entry may be reused, along with the arity which was there findUp :: LExp -> State [(Name, Int)] LExp findUp (LApp t (LV (Glob n)) as) | Just (LConstructor _ i ar) <- lookupCtxtExact n defs, ar == length as = findUp (LCon Nothing i n as) findUp (LV (Glob n)) | Just (LConstructor _ i 0) <- lookupCtxtExact n defs = return $ LCon Nothing i n [] -- nullary cons are global, no need to update findUp (LApp t f as) = LApp t <$> findUp f <*> mapM findUp as findUp (LLazyApp n as) = LLazyApp n <$> mapM findUp as findUp (LLazyExp e) = LLazyExp <$> findUp e findUp (LForce e) = LForce <$> findUp e -- use assumption that names are unique! findUp (LLet n val sc) = LLet n <$> findUp val <*> findUp sc findUp (LLam ns sc) = LLam ns <$> findUp sc findUp (LProj e i) = LProj <$> findUp e <*> return i findUp (LCon (Just l) i n es) = LCon (Just l) i n <$> mapM findUp es findUp (LCon Nothing i n es) = do avail <- get v <- findVar [] avail (length es) LCon v i n <$> mapM findUp es findUp (LForeign t s es) = LForeign t s <$> mapM (\ (t, e) -> do e' <- findUp e return (t, e')) es findUp (LOp o es) = LOp o <$> mapM findUp es findUp (LCase Updatable e@(LV (Glob n)) as) = LCase Updatable e <$> mapM (doUpAlt n) as findUp (LCase t e as) = LCase t <$> findUp e <*> mapM findUpAlt as findUp t = return t findUpAlt (LConCase i t args rhs) = do avail <- get rhs' <- findUp rhs put avail return $ LConCase i t args rhs' findUpAlt (LConstCase i rhs) = LConstCase i <$> findUp rhs findUpAlt (LDefaultCase rhs) = LDefaultCase <$> findUp rhs doUpAlt n (LConCase i t args rhs) = do avail <- get put ((n, length args) : avail) rhs' <- findUp rhs put avail return $ LConCase i t args rhs' doUpAlt n (LConstCase i rhs) = LConstCase i <$> findUp rhs doUpAlt n (LDefaultCase rhs) = LDefaultCase <$> findUp rhs findVar _ [] i = return Nothing findVar acc ((n, l) : ns) i | l == i = do put (reverse acc ++ ns) return (Just (Glob n)) findVar acc (n : ns) i = findVar (n : acc) ns i -- Return variables in list which are used in the expression
2,756
false
false
5
13
1,020
1,153
529
624
null
null
xmonad/xmonad-contrib
XMonad/Hooks/ManageHelpers.hs
bsd-3-clause
-- | Hides window and ignores it. doHideIgnore :: ManageHook doHideIgnore = ask >>= \w -> liftX (hide w) >> doF (W.delete w)
124
doHideIgnore :: ManageHook doHideIgnore = ask >>= \w -> liftX (hide w) >> doF (W.delete w)
90
doHideIgnore = ask >>= \w -> liftX (hide w) >> doF (W.delete w)
63
true
true
2
10
22
53
25
28
null
null
lens/lens-opengl
src/Graphics/Rendering/OpenGL/Lens.hs
bsd-3-clause
vaComponents :: Lens' (VertexArrayDescriptor a) NumComponents vaComponents = lens (\(VertexArrayDescriptor c _ _ _) -> c) (\(VertexArrayDescriptor _ dt s ptr) c -> VertexArrayDescriptor c dt s ptr)
207
vaComponents :: Lens' (VertexArrayDescriptor a) NumComponents vaComponents = lens (\(VertexArrayDescriptor c _ _ _) -> c) (\(VertexArrayDescriptor _ dt s ptr) c -> VertexArrayDescriptor c dt s ptr)
207
vaComponents = lens (\(VertexArrayDescriptor c _ _ _) -> c) (\(VertexArrayDescriptor _ dt s ptr) c -> VertexArrayDescriptor c dt s ptr)
145
false
true
0
9
37
85
41
44
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
pprSkolInfo (InferSkol ids) = sep [ ptext (sLit "the inferred type of") , vcat [ ppr name <+> dcolon <+> ppr ty | (name,ty) <- ids ]]
208
pprSkolInfo (InferSkol ids) = sep [ ptext (sLit "the inferred type of") , vcat [ ppr name <+> dcolon <+> ppr ty | (name,ty) <- ids ]]
208
pprSkolInfo (InferSkol ids) = sep [ ptext (sLit "the inferred type of") , vcat [ ppr name <+> dcolon <+> ppr ty | (name,ty) <- ids ]]
208
false
false
0
11
101
67
33
34
null
null
rjohnsondev/haskellshop
src/Render/Alerts.hs
bsd-2-clause
getSessionValues :: [Text] -> AppHandler [(Text, Text)] getSessionValues = Prelude.foldl (\out level -> do v <- out s <- with sess $ getFromSession level _ <- with sess $ deleteFromSession level return $ case s of Just sv -> v ++ [(level, sv)] Nothing -> v) (return [])
401
getSessionValues :: [Text] -> AppHandler [(Text, Text)] getSessionValues = Prelude.foldl (\out level -> do v <- out s <- with sess $ getFromSession level _ <- with sess $ deleteFromSession level return $ case s of Just sv -> v ++ [(level, sv)] Nothing -> v) (return [])
401
getSessionValues = Prelude.foldl (\out level -> do v <- out s <- with sess $ getFromSession level _ <- with sess $ deleteFromSession level return $ case s of Just sv -> v ++ [(level, sv)] Nothing -> v) (return [])
345
false
true
0
15
179
142
68
74
null
null
oisdk/Expr
src/Numeric/Expr/Parse.hs
bsd-3-clause
reservedOp :: (TokenParsing m, Monad m) => String -> m () reservedOp = reserve opStyle
86
reservedOp :: (TokenParsing m, Monad m) => String -> m () reservedOp = reserve opStyle
86
reservedOp = reserve opStyle
28
false
true
0
9
14
44
20
24
null
null
MateVM/harpy
Harpy/X86CodeGen.hs
gpl-2.0
x86_rcr = 3
12
x86_rcr = 3
12
x86_rcr = 3
12
false
false
0
4
3
6
3
3
null
null
apyrgio/snf-ganeti
src/Ganeti/OpCodes.hs
bsd-2-clause
opSummaryVal OpBackupExport { opInstanceName = s } = Just s
59
opSummaryVal OpBackupExport { opInstanceName = s } = Just s
59
opSummaryVal OpBackupExport { opInstanceName = s } = Just s
59
false
false
0
8
9
21
10
11
null
null
PeterBeard/project-euler
haskell/src/problem-003.hs
gpl-2.0
solution = last $ prime_factorization 600851475143
50
solution = last $ prime_factorization 600851475143
50
solution = last $ prime_factorization 600851475143
50
false
false
0
6
5
13
6
7
null
null
scottgw/eiffel-typecheck
Language/Eiffel/TypeCheck/TypedExpr.hs
bsd-3-clause
texprTyp (LitVoid t) = t
25
texprTyp (LitVoid t) = t
25
texprTyp (LitVoid t) = t
25
false
false
0
7
5
15
7
8
null
null
PuZZleDucK/Hls
Hls.hs
gpl-3.0
calculateLength :: [String] -> Int calculateLength [] = 0
57
calculateLength :: [String] -> Int calculateLength [] = 0
57
calculateLength [] = 0
22
false
true
0
6
8
23
12
11
null
null
sopvop/cabal
Cabal/Distribution/Simple/Utils.hs
bsd-3-clause
setupMessage :: Verbosity -> String -> PackageIdentifier -> IO () setupMessage verbosity msg pkgid = withFrozenCallStack $ do notice verbosity (msg ++ ' ': display pkgid ++ "...") -- | More detail on the operation of some action. -- -- We display these messages when the verbosity level is 'verbose' --
307
setupMessage :: Verbosity -> String -> PackageIdentifier -> IO () setupMessage verbosity msg pkgid = withFrozenCallStack $ do notice verbosity (msg ++ ' ': display pkgid ++ "...") -- | More detail on the operation of some action. -- -- We display these messages when the verbosity level is 'verbose' --
307
setupMessage verbosity msg pkgid = withFrozenCallStack $ do notice verbosity (msg ++ ' ': display pkgid ++ "...") -- | More detail on the operation of some action. -- -- We display these messages when the verbosity level is 'verbose' --
241
false
true
0
12
55
69
35
34
null
null
Gurrt/software-testing
week-5/Lab5.hs
mit
delBlockN :: String ->L.Node-> L.Node delBlockN nameB node = (s, L.constraints s) where s = delBlockS nameB (fst node)
120
delBlockN :: String ->L.Node-> L.Node delBlockN nameB node = (s, L.constraints s) where s = delBlockS nameB (fst node)
120
delBlockN nameB node = (s, L.constraints s) where s = delBlockS nameB (fst node)
82
false
true
1
9
20
68
30
38
null
null
noraesae/monkey-hs
lib/Evaluator.hs
bsd-3-clause
evalInfix GreaterThan = (fmap OBool .) . ee2x (>) o2n
53
evalInfix GreaterThan = (fmap OBool .) . ee2x (>) o2n
53
evalInfix GreaterThan = (fmap OBool .) . ee2x (>) o2n
53
false
false
0
7
9
27
14
13
null
null
rfdickerson/numerical-methods
src/NumericalMethods/Simple.hs
mit
-- finite central differences. derivative3 :: RealFunction -> RealFunction derivative3 f x = (d - 8*c + 8*b - a)/(12*epsilon) where a = f (x + 2*epsilon) b = f (x + epsilon) c = f (x - epsilon) d = f (x - 2*epsilon) -- | returns the second derivative of a function.
296
derivative3 :: RealFunction -> RealFunction derivative3 f x = (d - 8*c + 8*b - a)/(12*epsilon) where a = f (x + 2*epsilon) b = f (x + epsilon) c = f (x - epsilon) d = f (x - 2*epsilon) -- | returns the second derivative of a function.
265
derivative3 f x = (d - 8*c + 8*b - a)/(12*epsilon) where a = f (x + 2*epsilon) b = f (x + epsilon) c = f (x - epsilon) d = f (x - 2*epsilon) -- | returns the second derivative of a function.
221
true
true
0
11
84
126
67
59
null
null
DSLsofMath/Hatlab
src/Hatlab/Expression.hs
bsd-3-clause
showexp (Sub a b) = (showexp a) ++ " - " ++ (showexp' b) where showexp' e@(Sub _ _) = paren (showexp e) showexp' e@(Add _ _) = paren (showexp e) showexp' e = showexp e
205
showexp (Sub a b) = (showexp a) ++ " - " ++ (showexp' b) where showexp' e@(Sub _ _) = paren (showexp e) showexp' e@(Add _ _) = paren (showexp e) showexp' e = showexp e
205
showexp (Sub a b) = (showexp a) ++ " - " ++ (showexp' b) where showexp' e@(Sub _ _) = paren (showexp e) showexp' e@(Add _ _) = paren (showexp e) showexp' e = showexp e
205
false
false
2
8
73
116
52
64
null
null
sharynneazhar/lotus_sudoku
lotus.hs
mit
getValues :: Indices -- ^ a list of indices -> Lotus -- ^ the lotus puzzle -> [Int] -- ^ a list of corresponding values at each index given getValues lts = map (lts !!)
201
getValues :: Indices -- ^ a list of indices -> Lotus -- ^ the lotus puzzle -> [Int] getValues lts = map (lts !!)
140
getValues lts = map (lts !!)
28
true
true
0
7
67
35
20
15
null
null
christiannolte/tip-toi-reveng
src/GMEParser.hs
mit
getBinaries :: SGet [(B.ByteString, B.ByteString)] getBinaries = do n <- getWord16 _ <- getBS 14 -- padding forM [0..n - 1] $ \n -> do offset <- getWord32 length <- getWord32 desc <- getBS 8 binary <- getSegAt offset (BC.unpack desc) (getBS length) return (desc, binary)
322
getBinaries :: SGet [(B.ByteString, B.ByteString)] getBinaries = do n <- getWord16 _ <- getBS 14 -- padding forM [0..n - 1] $ \n -> do offset <- getWord32 length <- getWord32 desc <- getBS 8 binary <- getSegAt offset (BC.unpack desc) (getBS length) return (desc, binary)
322
getBinaries = do n <- getWord16 _ <- getBS 14 -- padding forM [0..n - 1] $ \n -> do offset <- getWord32 length <- getWord32 desc <- getBS 8 binary <- getSegAt offset (BC.unpack desc) (getBS length) return (desc, binary)
271
false
true
0
15
97
133
64
69
null
null
seagull-kamome/JunkDB
Database/KVS.hs
bsd-3-clause
wrapJSON :: (KVS a s LBS.ByteString LBS.ByteString, AE.FromJSON k, AE.ToJSON k, AE.FromJSON v, AE.ToJSON v) => a -> WrappedKVS a LBS.ByteString LBS.ByteString s k v wrapJSON = WrappedKVS AE.encode (fromJust . AE.decode) AE.encode (fromJust . AE.decode)
252
wrapJSON :: (KVS a s LBS.ByteString LBS.ByteString, AE.FromJSON k, AE.ToJSON k, AE.FromJSON v, AE.ToJSON v) => a -> WrappedKVS a LBS.ByteString LBS.ByteString s k v wrapJSON = WrappedKVS AE.encode (fromJust . AE.decode) AE.encode (fromJust . AE.decode)
252
wrapJSON = WrappedKVS AE.encode (fromJust . AE.decode) AE.encode (fromJust . AE.decode)
87
false
true
0
8
35
114
58
56
null
null
nimia/bottle
codeedit/Editor/Config.hs
gpl-3.0
-- pasteKeys = [ctrl 'v'] -- cutKeys = [ctrl 'x'] -- actionKeys = [noMods E.KeyEnter] quitKeys = [ctrl 'q']
143
quitKeys = [ctrl 'q']
30
quitKeys = [ctrl 'q']
30
true
false
0
6
54
15
9
6
null
null
MasseR/xmonadcontrib
XMonad/Actions/Search.hs
bsd-3-clause
{- | If your search engine is more complex than this (you may want to identify the kind of input and make the search URL dependent on the input or put the query inside of a URL instead of in the end) you can use the alternative 'searchEngineF' function. > searchFunc :: String -> String > searchFunc s | "wiki:" `isPrefixOf` s = "http://en.wikipedia.org/wiki/" ++ (escape $ tail $ snd $ break (==':') s) > | "http://" `isPrefixOf` s = s > | otherwise = (use google) s > myNewEngine = searchEngineF "mymulti" searchFunc @searchFunc@ here searches for a word in wikipedia if it has a prefix of \"wiki:\" (you can use the 'escape' function to escape any forbidden characters), opens an address directly if it starts with \"http:\/\/\" and otherwise uses the provided google search engine. You can use other engines inside of your own through the 'use' function as shown above to make complex searches. The user input will be automatically escaped in search engines created with 'searchEngine', 'searchEngineF', however, completely depends on the transformation function passed to it. -} searchEngineF :: Name -> Site -> SearchEngine searchEngineF = SearchEngine
1,230
searchEngineF :: Name -> Site -> SearchEngine searchEngineF = SearchEngine
74
searchEngineF = SearchEngine
28
true
true
0
6
263
20
11
9
null
null
shlevy/ghc
libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
bsd-3-clause
sourceStrict = return SourceStrict
40
sourceStrict = return SourceStrict
40
sourceStrict = return SourceStrict
40
false
false
1
5
9
12
4
8
null
null
cbaatz/hamu8080
src/Hamu8080/Compute.hs
mit
-- INX DE doOp 0x33 = liftM (+1) (getRegPair SP) >>= setRegPair SP
66
doOp 0x33 = liftM (+1) (getRegPair SP) >>= setRegPair SP
56
doOp 0x33 = liftM (+1) (getRegPair SP) >>= setRegPair SP
56
true
false
0
8
12
32
16
16
null
null
shlevy/ghc
compiler/typecheck/TcGenDeriv.hs
bsd-3-clause
infix_RDR = dataQual_RDR gENERICS (fsLit "Infix")
54
infix_RDR = dataQual_RDR gENERICS (fsLit "Infix")
54
infix_RDR = dataQual_RDR gENERICS (fsLit "Infix")
54
false
false
0
7
10
17
8
9
null
null
facebookincubator/duckling
Duckling/Numeral/VI/Rules.hs
bsd-3-clause
ruleDecimalWithThousandsSeparator :: Rule ruleDecimalWithThousandsSeparator = Rule { name = "decimal with thousands separator" , pattern = [ regex "(\\d+(\\.\\d\\d\\d)+,\\d+)" ] , prod = \tokens -> case tokens of (Token RegexMatch (GroupMatch (match:_)):_) -> parseDouble (Text.replace "." Text.empty match) >>= double _ -> Nothing }
369
ruleDecimalWithThousandsSeparator :: Rule ruleDecimalWithThousandsSeparator = Rule { name = "decimal with thousands separator" , pattern = [ regex "(\\d+(\\.\\d\\d\\d)+,\\d+)" ] , prod = \tokens -> case tokens of (Token RegexMatch (GroupMatch (match:_)):_) -> parseDouble (Text.replace "." Text.empty match) >>= double _ -> Nothing }
369
ruleDecimalWithThousandsSeparator = Rule { name = "decimal with thousands separator" , pattern = [ regex "(\\d+(\\.\\d\\d\\d)+,\\d+)" ] , prod = \tokens -> case tokens of (Token RegexMatch (GroupMatch (match:_)):_) -> parseDouble (Text.replace "." Text.empty match) >>= double _ -> Nothing }
327
false
true
0
18
79
108
57
51
null
null
benjaminselfridge/logix
src/Calculus.hs
bsd-3-clause
substTerm :: String -> Term -> Term -> Term substTerm x t (VarTerm v) | x == v = t
85
substTerm :: String -> Term -> Term -> Term substTerm x t (VarTerm v) | x == v = t
85
substTerm x t (VarTerm v) | x == v = t
41
false
true
0
8
22
46
22
24
null
null
urbanslug/ghc
compiler/basicTypes/SrcLoc.hs
bsd-3-clause
srcSpanEndCol SrcSpanPoint{ srcSpanCol=c } = c
46
srcSpanEndCol SrcSpanPoint{ srcSpanCol=c } = c
46
srcSpanEndCol SrcSpanPoint{ srcSpanCol=c } = c
46
false
false
1
7
5
24
10
14
null
null
jutaro/rdf4h
src/Data/RDF/Namespace.hs
bsd-3-clause
-- |Determine the URI of the given namespace. uriOf :: Namespace -> T.Text uriOf (PlainNS uri) = uri
114
uriOf :: Namespace -> T.Text uriOf (PlainNS uri) = uri
68
uriOf (PlainNS uri) = uri
34
true
true
0
7
31
27
14
13
null
null
haskell-game/fungen
examples/worms/worms.hs
bsd-3-clause
turnUp :: Modifiers -> Position -> WormsAction () turnUp _ _ = do snakeHead <- findObject "head" "head" setObjectCurrentPicture 5 snakeHead setObjectSpeed (0,speedMod) snakeHead
187
turnUp :: Modifiers -> Position -> WormsAction () turnUp _ _ = do snakeHead <- findObject "head" "head" setObjectCurrentPicture 5 snakeHead setObjectSpeed (0,speedMod) snakeHead
186
turnUp _ _ = do snakeHead <- findObject "head" "head" setObjectCurrentPicture 5 snakeHead setObjectSpeed (0,speedMod) snakeHead
136
false
true
0
9
33
68
30
38
null
null
haroldcarr/utah-haskell
future/src/Service/DisplayEndpoint.hs
apache-2.0
dMain :: Event String -> Event Int -> IO () dMain msgEvent adminEvent = startGUI defaultConfig $ \w -> do inputs <- liftIO $ newIORef [] size <- liftIO $ newIORef 10 let redoLayout :: UI () redoLayout = void $ do n <- liftIO (readIORef size) layout <- mkLayout . take n =<< liftIO (readIORef inputs) getBody w # set children [layout] mkLayout :: [Element] -> UI Element mkLayout xs = column $ map element xs addInput :: String -> UI () addInput str = do eInput <- UI.string str liftIO $ modifyIORef inputs (eInput :) addInputRedoLayout str = do addInput str redoLayout changeSizeRedoLayout n = do liftIO $ writeIORef size n redoLayout onEvent msgEvent addInputRedoLayout onEvent adminEvent changeSizeRedoLayout addInputRedoLayout "Hello Utah Haskell"
1,055
dMain :: Event String -> Event Int -> IO () dMain msgEvent adminEvent = startGUI defaultConfig $ \w -> do inputs <- liftIO $ newIORef [] size <- liftIO $ newIORef 10 let redoLayout :: UI () redoLayout = void $ do n <- liftIO (readIORef size) layout <- mkLayout . take n =<< liftIO (readIORef inputs) getBody w # set children [layout] mkLayout :: [Element] -> UI Element mkLayout xs = column $ map element xs addInput :: String -> UI () addInput str = do eInput <- UI.string str liftIO $ modifyIORef inputs (eInput :) addInputRedoLayout str = do addInput str redoLayout changeSizeRedoLayout n = do liftIO $ writeIORef size n redoLayout onEvent msgEvent addInputRedoLayout onEvent adminEvent changeSizeRedoLayout addInputRedoLayout "Hello Utah Haskell"
1,055
dMain msgEvent adminEvent = startGUI defaultConfig $ \w -> do inputs <- liftIO $ newIORef [] size <- liftIO $ newIORef 10 let redoLayout :: UI () redoLayout = void $ do n <- liftIO (readIORef size) layout <- mkLayout . take n =<< liftIO (readIORef inputs) getBody w # set children [layout] mkLayout :: [Element] -> UI Element mkLayout xs = column $ map element xs addInput :: String -> UI () addInput str = do eInput <- UI.string str liftIO $ modifyIORef inputs (eInput :) addInputRedoLayout str = do addInput str redoLayout changeSizeRedoLayout n = do liftIO $ writeIORef size n redoLayout onEvent msgEvent addInputRedoLayout onEvent adminEvent changeSizeRedoLayout addInputRedoLayout "Hello Utah Haskell"
1,011
false
true
2
19
428
311
139
172
null
null
spatial-reasoning/zeno
src/Basics.hs
bsd-2-clause
enumerateAndEnumeration :: (Ord a, Ord b) => Map.Map [a] b -> (Map.Map [Int] b, Map.Map Int a) enumerateAndEnumeration cons = (numericCons, enumeration) where (_, numericCons, enumeration) = Map.foldlWithKey collectOneCon (Map.empty, Map.empty, Map.empty) cons collectOneCon (mapCol, consCol, enumCol) nodes rel = let ((newMap, newEnum), newNodes) = mapAccumL (\ (m, e) node -> let mappedNode = Map.lookup node m in case mappedNode of Nothing -> let n = Map.size m in ((Map.insert node n m, Map.insert n node e), n) otherwise -> ((m, e), fromJust mappedNode) ) (mapCol, enumCol) nodes in ( newMap , Map.insert newNodes rel consCol , newEnum )
1,044
enumerateAndEnumeration :: (Ord a, Ord b) => Map.Map [a] b -> (Map.Map [Int] b, Map.Map Int a) enumerateAndEnumeration cons = (numericCons, enumeration) where (_, numericCons, enumeration) = Map.foldlWithKey collectOneCon (Map.empty, Map.empty, Map.empty) cons collectOneCon (mapCol, consCol, enumCol) nodes rel = let ((newMap, newEnum), newNodes) = mapAccumL (\ (m, e) node -> let mappedNode = Map.lookup node m in case mappedNode of Nothing -> let n = Map.size m in ((Map.insert node n m, Map.insert n node e), n) otherwise -> ((m, e), fromJust mappedNode) ) (mapCol, enumCol) nodes in ( newMap , Map.insert newNodes rel consCol , newEnum )
1,044
enumerateAndEnumeration cons = (numericCons, enumeration) where (_, numericCons, enumeration) = Map.foldlWithKey collectOneCon (Map.empty, Map.empty, Map.empty) cons collectOneCon (mapCol, consCol, enumCol) nodes rel = let ((newMap, newEnum), newNodes) = mapAccumL (\ (m, e) node -> let mappedNode = Map.lookup node m in case mappedNode of Nothing -> let n = Map.size m in ((Map.insert node n m, Map.insert n node e), n) otherwise -> ((m, e), fromJust mappedNode) ) (mapCol, enumCol) nodes in ( newMap , Map.insert newNodes rel consCol , newEnum )
899
false
true
1
23
500
300
161
139
null
null
gridaphobe/target
examples/Map.hs
mit
-- | /O(log n)/. Combines insert operation with old value retrieval. -- The expression (@'insertLookupWithKey' f k x map@) -- is a pair where the first element is equal to (@'lookup' k map@) -- and the second element equal to (@'insertWithKey' f k x map@). -- -- > let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value -- > insertLookupWithKey f 5 "xxx" (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "5:xxx|a")]) -- > insertLookupWithKey f 7 "xxx" (fromList [(5,"a"), (3,"b")]) == (Nothing, fromList [(3, "b"), (5, "a"), (7, "xxx")]) -- > insertLookupWithKey f 5 "xxx" empty == (Nothing, singleton 5 "xxx") -- -- This is how to define @insertLookup@ using @insertLookupWithKey@: -- -- > let insertLookup kx x t = insertLookupWithKey (\_ a _ -> a) kx x t -- > insertLookup 5 "x" (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "x")]) -- > insertLookup 7 "x" (fromList [(5,"a"), (3,"b")]) == (Nothing, fromList [(3, "b"), (5, "a"), (7, "x")]) -- See Note: Type of local 'go' function {-@ insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> OMap k a -> (Maybe a, OMap k a) @-} insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a) insertLookupWithKey = insertLookupWithKey_go
1,324
insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a) insertLookupWithKey = insertLookupWithKey_go
138
insertLookupWithKey = insertLookupWithKey_go
44
true
true
0
11
265
85
51
34
null
null
harendra-kumar/asyncly
src/Streamly/Internal/FileSystem/File.hs
bsd-3-clause
toBytes :: (IsStream t, MonadCatch m, MonadIO m) => FilePath -> t m Word8 toBytes file = AS.concat $ withFile file ReadMode FH.toChunks
135
toBytes :: (IsStream t, MonadCatch m, MonadIO m) => FilePath -> t m Word8 toBytes file = AS.concat $ withFile file ReadMode FH.toChunks
135
toBytes file = AS.concat $ withFile file ReadMode FH.toChunks
61
false
true
0
7
22
59
29
30
null
null
mrakgr/futhark
src/Futhark/CodeGen/ImpGen/Kernels.hs
bsd-3-clause
alignmentMap :: Imp.KernelCode -> AlignmentMap alignmentMap = HM.map alignment . Imp.memoryUsage (const mempty) where alignment = HS.foldr mostRestrictive smallestType mostRestrictive bt1 bt2 = if (primByteSize bt1 :: Int) > primByteSize bt2 then bt1 else bt2
290
alignmentMap :: Imp.KernelCode -> AlignmentMap alignmentMap = HM.map alignment . Imp.memoryUsage (const mempty) where alignment = HS.foldr mostRestrictive smallestType mostRestrictive bt1 bt2 = if (primByteSize bt1 :: Int) > primByteSize bt2 then bt1 else bt2
290
alignmentMap = HM.map alignment . Imp.memoryUsage (const mempty) where alignment = HS.foldr mostRestrictive smallestType mostRestrictive bt1 bt2 = if (primByteSize bt1 :: Int) > primByteSize bt2 then bt1 else bt2
242
false
true
3
8
65
102
44
58
null
null
ak1t0/48hscheme
Parser.hs
mit
showValue (Character c) = ['#', '\\', c]
40
showValue (Character c) = ['#', '\\', c]
40
showValue (Character c) = ['#', '\\', c]
40
false
false
0
6
6
25
13
12
null
null
stain/jdk8u
src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
gpl-2.0
sizeof DOUBLE = 8
17
sizeof DOUBLE = 8
17
sizeof DOUBLE = 8
17
false
false
1
5
3
13
4
9
null
null
nevrenato/Hets_Fork
utils/DtdToHaskell-src/pre-1.22/TypeDef.hs
gpl-2.0
ppST :: StructType -> Doc ppST (Defaultable st _) = parens (text "Defaultable" <+> ppST st)
92
ppST :: StructType -> Doc ppST (Defaultable st _) = parens (text "Defaultable" <+> ppST st)
92
ppST (Defaultable st _) = parens (text "Defaultable" <+> ppST st)
66
false
true
0
8
16
42
20
22
null
null
lshift/machines-zlib
src/Data/Machine/Zlib.hs
bsd-3-clause
-- | Even though this doesn't actually do any IO, we stay in the IO monad -- like Data.Streaming.Zlib does, to avoid any unsafe "black magic". gunzipper :: (Functor m, MonadIO m) => ProcessT m ByteString ByteString gunzipper = construct $ do inflate <- liftIO . initInflate $ WindowBits 31 let go :: (Functor m, MonadIO m) => PlanT (Is ByteString) ByteString m () go = do bs <- await <|> finish popper <- liftIO <$> liftIO (feedInflate inflate bs) exhaust (handleRes <$> popper) <|> go handleRes PRDone = Nothing handleRes (PRNext bs) = Just bs handleRes (PRError e) = throw e finish :: MonadIO m => PlanT (Is ByteString) ByteString m ByteString finish = do r <- liftIO $ finishInflate inflate yield r stop go
799
gunzipper :: (Functor m, MonadIO m) => ProcessT m ByteString ByteString gunzipper = construct $ do inflate <- liftIO . initInflate $ WindowBits 31 let go :: (Functor m, MonadIO m) => PlanT (Is ByteString) ByteString m () go = do bs <- await <|> finish popper <- liftIO <$> liftIO (feedInflate inflate bs) exhaust (handleRes <$> popper) <|> go handleRes PRDone = Nothing handleRes (PRNext bs) = Just bs handleRes (PRError e) = throw e finish :: MonadIO m => PlanT (Is ByteString) ByteString m ByteString finish = do r <- liftIO $ finishInflate inflate yield r stop go
656
gunzipper = construct $ do inflate <- liftIO . initInflate $ WindowBits 31 let go :: (Functor m, MonadIO m) => PlanT (Is ByteString) ByteString m () go = do bs <- await <|> finish popper <- liftIO <$> liftIO (feedInflate inflate bs) exhaust (handleRes <$> popper) <|> go handleRes PRDone = Nothing handleRes (PRNext bs) = Just bs handleRes (PRError e) = throw e finish :: MonadIO m => PlanT (Is ByteString) ByteString m ByteString finish = do r <- liftIO $ finishInflate inflate yield r stop go
584
true
true
0
17
215
253
121
132
null
null
katydid/haslapse
src/Data/Katydid/Relapse/Derive.hs
bsd-3-clause
returns g (p : tailps, ns) = let (dp, tailns) = deriveReturn g p ns in dp : returns g (tailps, tailns)
104
returns g (p : tailps, ns) = let (dp, tailns) = deriveReturn g p ns in dp : returns g (tailps, tailns)
104
returns g (p : tailps, ns) = let (dp, tailns) = deriveReturn g p ns in dp : returns g (tailps, tailns)
104
false
false
0
9
23
63
31
32
null
null
bitemyapp/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
legalFIPrimArgTyCon :: DynFlags -> TyCon -> Bool -- Check args of 'foreign import prim', only allow simple unlifted types. -- Strictly speaking it is unnecessary to ban unboxed tuples here since -- currently they're of the wrong kind to use in function args anyway. legalFIPrimArgTyCon dflags tc | xopt Opt_UnliftedFFITypes dflags && isUnLiftedTyCon tc && not (isUnboxedTupleTyCon tc) = True | otherwise = False
427
legalFIPrimArgTyCon :: DynFlags -> TyCon -> Bool legalFIPrimArgTyCon dflags tc | xopt Opt_UnliftedFFITypes dflags && isUnLiftedTyCon tc && not (isUnboxedTupleTyCon tc) = True | otherwise = False
210
legalFIPrimArgTyCon dflags tc | xopt Opt_UnliftedFFITypes dflags && isUnLiftedTyCon tc && not (isUnboxedTupleTyCon tc) = True | otherwise = False
161
true
true
0
11
79
74
34
40
null
null
HanStolpo/NetVinylGLFW
ghci_only/Paths_NetVinylGLFW.hs
mit
getDataFileName s = error $ "unknown file " ++ s
48
getDataFileName s = error $ "unknown file " ++ s
48
getDataFileName s = error $ "unknown file " ++ s
48
false
false
0
6
9
17
8
9
null
null
annenkov/contracts
Coq/Extraction/contracts-haskell/src/Examples/TranslationExample.hs
mit
-- apply product of morphisms appProd (f,g) (x,y) = (f x, g y)
62
appProd (f,g) (x,y) = (f x, g y)
32
appProd (f,g) (x,y) = (f x, g y)
32
true
false
0
6
12
38
20
18
null
null
dreixel/regular-extras
src/Generics/Regular/Functions/Arbitrary.hs
bsd-3-clause
-- | Generic arbitrary function with default sizes and constructor frequencies. arbitrary :: (Regular a, Arbitrary (PF a)) => Gen a arbitrary = sized (arbitraryWith [])
168
arbitrary :: (Regular a, Arbitrary (PF a)) => Gen a arbitrary = sized (arbitraryWith [])
88
arbitrary = sized (arbitraryWith [])
36
true
true
0
8
25
47
24
23
null
null
norm2782/uuagc
src/SequentialTypes.hs
bsd-3-clause
ntattr :: CRule -> Maybe NTAttr ntattr cr | isLocal cr = Nothing | isInst cr = Nothing -- an inst definition is just considered as a local attribute definition | otherwise = let at = if isSyn cr then NTASyn else NTAInh getNt cr' = if isRhs cr' then fromJust (getRhsNt cr') else getLhsNt cr' in Just (at (getNt cr) (getAttr cr) (fromJust (getType cr)))
439
ntattr :: CRule -> Maybe NTAttr ntattr cr | isLocal cr = Nothing | isInst cr = Nothing -- an inst definition is just considered as a local attribute definition | otherwise = let at = if isSyn cr then NTASyn else NTAInh getNt cr' = if isRhs cr' then fromJust (getRhsNt cr') else getLhsNt cr' in Just (at (getNt cr) (getAttr cr) (fromJust (getType cr)))
439
ntattr cr | isLocal cr = Nothing | isInst cr = Nothing -- an inst definition is just considered as a local attribute definition | otherwise = let at = if isSyn cr then NTASyn else NTAInh getNt cr' = if isRhs cr' then fromJust (getRhsNt cr') else getLhsNt cr' in Just (at (getNt cr) (getAttr cr) (fromJust (getType cr)))
407
false
true
0
14
153
145
68
77
null
null
boegel/GA
GA.hs
bsd-3-clause
checkpointGen :: (Entity e s d p m) => GAConfig -- ^ configuraton for GA -> Int -- ^ generation index -> Int -- ^ random seed for generation -> Generation e s -- ^ current generation -> IO() -- ^ writes to file checkpointGen cfg index seed (pop,archive) = do let txt = show $ (pop,archive) fn = chkptFileName cfg (index,seed) putStrLn $ "writing checkpoint for gen " ++ (show index) ++ " to " ++ fn createDirectoryIfMissing True "checkpoints" writeFile fn txt -- |Evolution: evaluate generation, (maybe) checkpoint, continue.
707
checkpointGen :: (Entity e s d p m) => GAConfig -- ^ configuraton for GA -> Int -- ^ generation index -> Int -- ^ random seed for generation -> Generation e s -- ^ current generation -> IO() checkpointGen cfg index seed (pop,archive) = do let txt = show $ (pop,archive) fn = chkptFileName cfg (index,seed) putStrLn $ "writing checkpoint for gen " ++ (show index) ++ " to " ++ fn createDirectoryIfMissing True "checkpoints" writeFile fn txt -- |Evolution: evaluate generation, (maybe) checkpoint, continue.
687
checkpointGen cfg index seed (pop,archive) = do let txt = show $ (pop,archive) fn = chkptFileName cfg (index,seed) putStrLn $ "writing checkpoint for gen " ++ (show index) ++ " to " ++ fn createDirectoryIfMissing True "checkpoints" writeFile fn txt -- |Evolution: evaluate generation, (maybe) checkpoint, continue.
352
true
true
0
11
272
151
78
73
null
null
ku-fpg/lambda-bridge
Network/LambdaBridge/Board.hs
bsd-3-clause
-- vaild transaction * tag * value txInitialState :: TxState txInitialState = (-1,35)
86
txInitialState :: TxState txInitialState = (-1,35)
50
txInitialState = (-1,35)
24
true
true
0
7
13
27
13
14
null
null
andrewpetrovic/pandoc
src/Text/Pandoc/Readers/Org.hs
gpl-2.0
exportsCode :: [(String, String)] -> Bool exportsCode attrs = not (("rundoc-exports", "none") `elem` attrs || ("rundoc-exports", "results") `elem` attrs)
178
exportsCode :: [(String, String)] -> Bool exportsCode attrs = not (("rundoc-exports", "none") `elem` attrs || ("rundoc-exports", "results") `elem` attrs)
178
exportsCode attrs = not (("rundoc-exports", "none") `elem` attrs || ("rundoc-exports", "results") `elem` attrs)
136
false
true
0
10
43
61
36
25
null
null
forste/haReFork
refactorer/RefacGenFold.hs
bsd-3-clause
patToExp (Pat (HsPIrrPat p)) = patToExp p
41
patToExp (Pat (HsPIrrPat p)) = patToExp p
41
patToExp (Pat (HsPIrrPat p)) = patToExp p
41
false
false
0
9
6
24
11
13
null
null
shicks/shsh
Language/Sh/Parser/Parsec.hs
bsd-3-clause
insideParens :: P Bool insideParens = fmap (\s -> parenDepth s > 0) getState
76
insideParens :: P Bool insideParens = fmap (\s -> parenDepth s > 0) getState
76
insideParens = fmap (\s -> parenDepth s > 0) getState
53
false
true
0
9
13
34
17
17
null
null
brendanhay/gogol
gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs
mpl-2.0
-- | Aggregate classification metrics. mccmAggregateClassificationMetrics :: Lens' MultiClassClassificationMetrics (Maybe AggregateClassificationMetrics) mccmAggregateClassificationMetrics = lens _mccmAggregateClassificationMetrics (\ s a -> s{_mccmAggregateClassificationMetrics = a})
293
mccmAggregateClassificationMetrics :: Lens' MultiClassClassificationMetrics (Maybe AggregateClassificationMetrics) mccmAggregateClassificationMetrics = lens _mccmAggregateClassificationMetrics (\ s a -> s{_mccmAggregateClassificationMetrics = a})
254
mccmAggregateClassificationMetrics = lens _mccmAggregateClassificationMetrics (\ s a -> s{_mccmAggregateClassificationMetrics = a})
139
true
true
0
9
29
48
25
23
null
null
PPitson/Deque
test/unit/HUnitTests.hs
bsd-3-clause
-- length of empty deque test8 = TestCase (assertEqual "complex empty deque length" True (isEmptyDEQ $ getDeque $ popFrontDEQ $ getDeque $ popFrontDEQ $ fromListDEQ [1, 2]) )
174
test8 = TestCase (assertEqual "complex empty deque length" True (isEmptyDEQ $ getDeque $ popFrontDEQ $ getDeque $ popFrontDEQ $ fromListDEQ [1, 2]) )
149
test8 = TestCase (assertEqual "complex empty deque length" True (isEmptyDEQ $ getDeque $ popFrontDEQ $ getDeque $ popFrontDEQ $ fromListDEQ [1, 2]) )
149
true
false
0
13
27
52
27
25
null
null
portnov/xtt
XMonad/TimeTracker/Parser.hs
bsd-3-clause
table = [ [prefix "!" Not], [binary "@" Cut AssocNone], [binary "=~" Match AssocNone, binary "==" Equals AssocNone, binary "<=" Lte AssocNone, binary "<" Lt AssocNone, binary ">=" Gte AssocNone, binary ">" Gt AssocNone, binaryNot "!=" Equals AssocNone, binaryNot "/=" Equals AssocNone], [binary "||" Or AssocLeft, binary "&&" And AssocLeft] ]
405
table = [ [prefix "!" Not], [binary "@" Cut AssocNone], [binary "=~" Match AssocNone, binary "==" Equals AssocNone, binary "<=" Lte AssocNone, binary "<" Lt AssocNone, binary ">=" Gte AssocNone, binary ">" Gt AssocNone, binaryNot "!=" Equals AssocNone, binaryNot "/=" Equals AssocNone], [binary "||" Or AssocLeft, binary "&&" And AssocLeft] ]
405
table = [ [prefix "!" Not], [binary "@" Cut AssocNone], [binary "=~" Match AssocNone, binary "==" Equals AssocNone, binary "<=" Lte AssocNone, binary "<" Lt AssocNone, binary ">=" Gte AssocNone, binary ">" Gt AssocNone, binaryNot "!=" Equals AssocNone, binaryNot "/=" Equals AssocNone], [binary "||" Or AssocLeft, binary "&&" And AssocLeft] ]
405
false
false
1
8
113
140
70
70
null
null
erantapaa/happstack-server
src/Happstack/Server/Internal/RFC822Headers.hs
bsd-3-clause
text_chars :: [Char] text_chars = map chr ([1..9] ++ [11,12] ++ [14..127])
74
text_chars :: [Char] text_chars = map chr ([1..9] ++ [11,12] ++ [14..127])
74
text_chars = map chr ([1..9] ++ [11,12] ++ [14..127])
53
false
true
0
9
11
46
26
20
null
null
Gabriel439/Haskell-Pipes-Library
src/Pipes/Prelude.hs
bsd-3-clause
{-| Transform a unidirectional 'Pipe' to a bidirectional 'Proxy' > generalize (f >-> g) = generalize f >+> generalize g > > generalize cat = pull -} generalize :: Monad m => Pipe a b m r -> x -> Proxy x a x b m r generalize p x0 = evalStateP x0 $ up >\\ hoist lift p //> dn where up () = do x <- lift get request x dn a = do x <- respond a lift $ put x
396
generalize :: Monad m => Pipe a b m r -> x -> Proxy x a x b m r generalize p x0 = evalStateP x0 $ up >\\ hoist lift p //> dn where up () = do x <- lift get request x dn a = do x <- respond a lift $ put x
246
generalize p x0 = evalStateP x0 $ up >\\ hoist lift p //> dn where up () = do x <- lift get request x dn a = do x <- respond a lift $ put x
182
true
true
1
9
127
131
59
72
null
null
paulp/unison
parser-typechecker/src/Unison/Typechecker/Context1.hs
mit
extendUniversal :: Var v => v -> M v v extendUniversal v = do v' <- freshenVar v modifyContext (pure . extend (Universal v')) pure v'
139
extendUniversal :: Var v => v -> M v v extendUniversal v = do v' <- freshenVar v modifyContext (pure . extend (Universal v')) pure v'
139
extendUniversal v = do v' <- freshenVar v modifyContext (pure . extend (Universal v')) pure v'
100
false
true
0
13
31
73
31
42
null
null
mlite/hLLVM
src/Llvm/Pass/RewriteUse.hs
bsd-3-clause
rwExpr f (Es a) = rwSelect (tv2v f) a >>= return . Es
53
rwExpr f (Es a) = rwSelect (tv2v f) a >>= return . Es
53
rwExpr f (Es a) = rwSelect (tv2v f) a >>= return . Es
53
false
false
0
9
12
38
17
21
null
null
wxwxwwxxx/ghc
compiler/utils/IOEnv.hs
bsd-3-clause
tryAllM :: IOEnv env r -> IOEnv env (Either SomeException r) -- Catch *all* exceptions -- This is used when running a Template-Haskell splice, when -- even a pattern-match failure is a programmer error tryAllM (IOEnv thing) = IOEnv (\ env -> try (thing env))
258
tryAllM :: IOEnv env r -> IOEnv env (Either SomeException r) tryAllM (IOEnv thing) = IOEnv (\ env -> try (thing env))
117
tryAllM (IOEnv thing) = IOEnv (\ env -> try (thing env))
56
true
true
0
10
44
69
34
35
null
null
uuhan/Idris-dev
src/Idris/IdeMode.hs
bsd-3-clause
atom = do string "nil"; return (SexpList []) <|> do char ':'; x <- atomC; return x <|> do char '"'; xs <- many quotedChar; char '"'; return (StringAtom xs) <|> do ints <- some digit case readDec ints of ((num, ""):_) -> return (IntegerAtom (toInteger num)) _ -> return (StringAtom ints)
329
atom = do string "nil"; return (SexpList []) <|> do char ':'; x <- atomC; return x <|> do char '"'; xs <- many quotedChar; char '"'; return (StringAtom xs) <|> do ints <- some digit case readDec ints of ((num, ""):_) -> return (IntegerAtom (toInteger num)) _ -> return (StringAtom ints)
329
atom = do string "nil"; return (SexpList []) <|> do char ':'; x <- atomC; return x <|> do char '"'; xs <- many quotedChar; char '"'; return (StringAtom xs) <|> do ints <- some digit case readDec ints of ((num, ""):_) -> return (IntegerAtom (toInteger num)) _ -> return (StringAtom ints)
329
false
false
0
15
94
166
76
90
null
null
kubkon/gnuplot
src/Graphics/Gnuplot/Private/Graph2DType.hs
bsd-3-clause
xyErrorLinesAbsolute = Cons "xyerrorlines"
42
xyErrorLinesAbsolute = Cons "xyerrorlines"
42
xyErrorLinesAbsolute = Cons "xyerrorlines"
42
false
false
0
5
3
9
4
5
null
null
olsner/ghc
compiler/utils/Outputable.hs
bsd-3-clause
quotedListWithOr :: [SDoc] -> SDoc -- [x,y,z] ==> `x', `y' or `z' quotedListWithOr xs@(_:_:_) = quotedList (init xs) <+> text "or" <+> quotes (last xs)
153
quotedListWithOr :: [SDoc] -> SDoc quotedListWithOr xs@(_:_:_) = quotedList (init xs) <+> text "or" <+> quotes (last xs)
120
quotedListWithOr xs@(_:_:_) = quotedList (init xs) <+> text "or" <+> quotes (last xs)
85
true
true
0
9
26
65
33
32
null
null
sdiehl/ghc
libraries/base/GHC/Storable.hs
bsd-3-clause
writeDoubleOffPtr (Ptr a) (I# i) (D# x) = IO $ \s -> case writeDoubleOffAddr# a i x s of s2 -> (# s2, () #)
112
writeDoubleOffPtr (Ptr a) (I# i) (D# x) = IO $ \s -> case writeDoubleOffAddr# a i x s of s2 -> (# s2, () #)
112
writeDoubleOffPtr (Ptr a) (I# i) (D# x) = IO $ \s -> case writeDoubleOffAddr# a i x s of s2 -> (# s2, () #)
112
false
false
0
11
29
66
33
33
null
null
kig/tomtegebra
Tomtegebra/RenderGame.hs
gpl-3.0
buildScene' models Z idx = (idx-1, 1, getModel models "Z" idx)
62
buildScene' models Z idx = (idx-1, 1, getModel models "Z" idx)
62
buildScene' models Z idx = (idx-1, 1, getModel models "Z" idx)
62
false
false
0
6
10
33
17
16
null
null
ruslantalpa/postgrest
src/PostgREST/Config.hs
mit
prettyVersion :: Text prettyVersion = intercalate "." (map show $ versionBranch version) <> " (" <> take 7 $(gitHash) <> ")"
128
prettyVersion :: Text prettyVersion = intercalate "." (map show $ versionBranch version) <> " (" <> take 7 $(gitHash) <> ")"
128
prettyVersion = intercalate "." (map show $ versionBranch version) <> " (" <> take 7 $(gitHash) <> ")"
106
false
true
2
9
24
52
24
28
null
null
TomMD/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
bindIOName = varQual gHC_BASE (fsLit "bindIO") bindIOIdKey
68
bindIOName = varQual gHC_BASE (fsLit "bindIO") bindIOIdKey
68
bindIOName = varQual gHC_BASE (fsLit "bindIO") bindIOIdKey
68
false
false
0
7
16
19
9
10
null
null
robstewart57/ripl
src/SkeletonTemplates/ZipWithVector.hs
bsd-3-clause
zipWithVectorActor :: String -> R.TwoVarFun -> Dimension -> Dimension -> C.Type -> C.Type -> C.Type -> C.Actor zipWithVectorActor actorName (R.TwoVarFunC pixelIdent stateIdent exp) (Dimension width height) vecDim@(Dimension vecWidth _) incomingType1 incomingType2 outgoingType = let ioSig = C.IOSg [C.PortDcl inType1 (C.Ident "In1"), C.PortDcl inType2 (C.Ident "In2")] [C.PortDcl outType (C.Ident "Out1")] inType1 = incomingType1 inType2 = incomingType2 outType = outgoingType inputPattern = [ C.InPattTagIds (C.Ident "In1") [idRiplToCal pixelIdent] , C.InPattTagIds (C.Ident "In2") [C.Ident "vectorVal"] ] outputPattern = riplExpToOutputPattern exp actionHead = C.ActnHead inputPattern [outputPattern] actions = [ receiveVectorAction vecWidth height pixelIdent stateIdent , zipStreamAction width height exp pixelIdent , doneAction width height ] in C.ActrSchd (C.PathN [C.PNameCons (C.Ident "cal")]) [] (C.Ident actorName) [] ioSig (globalVars stateIdent vecWidth) actions fsmSchedule []
1,197
zipWithVectorActor :: String -> R.TwoVarFun -> Dimension -> Dimension -> C.Type -> C.Type -> C.Type -> C.Actor zipWithVectorActor actorName (R.TwoVarFunC pixelIdent stateIdent exp) (Dimension width height) vecDim@(Dimension vecWidth _) incomingType1 incomingType2 outgoingType = let ioSig = C.IOSg [C.PortDcl inType1 (C.Ident "In1"), C.PortDcl inType2 (C.Ident "In2")] [C.PortDcl outType (C.Ident "Out1")] inType1 = incomingType1 inType2 = incomingType2 outType = outgoingType inputPattern = [ C.InPattTagIds (C.Ident "In1") [idRiplToCal pixelIdent] , C.InPattTagIds (C.Ident "In2") [C.Ident "vectorVal"] ] outputPattern = riplExpToOutputPattern exp actionHead = C.ActnHead inputPattern [outputPattern] actions = [ receiveVectorAction vecWidth height pixelIdent stateIdent , zipStreamAction width height exp pixelIdent , doneAction width height ] in C.ActrSchd (C.PathN [C.PNameCons (C.Ident "cal")]) [] (C.Ident actorName) [] ioSig (globalVars stateIdent vecWidth) actions fsmSchedule []
1,197
zipWithVectorActor actorName (R.TwoVarFunC pixelIdent stateIdent exp) (Dimension width height) vecDim@(Dimension vecWidth _) incomingType1 incomingType2 outgoingType = let ioSig = C.IOSg [C.PortDcl inType1 (C.Ident "In1"), C.PortDcl inType2 (C.Ident "In2")] [C.PortDcl outType (C.Ident "Out1")] inType1 = incomingType1 inType2 = incomingType2 outType = outgoingType inputPattern = [ C.InPattTagIds (C.Ident "In1") [idRiplToCal pixelIdent] , C.InPattTagIds (C.Ident "In2") [C.Ident "vectorVal"] ] outputPattern = riplExpToOutputPattern exp actionHead = C.ActnHead inputPattern [outputPattern] actions = [ receiveVectorAction vecWidth height pixelIdent stateIdent , zipStreamAction width height exp pixelIdent , doneAction width height ] in C.ActrSchd (C.PathN [C.PNameCons (C.Ident "cal")]) [] (C.Ident actorName) [] ioSig (globalVars stateIdent vecWidth) actions fsmSchedule []
1,070
false
true
11
11
326
363
185
178
null
null
abakst/liquidhaskell
benchmarks/bytestring-0.9.2.1/Data/ByteString/Lazy.hs
bsd-3-clause
head (Chunk c _) = S.unsafeHead c
33
head (Chunk c _) = S.unsafeHead c
33
head (Chunk c _) = S.unsafeHead c
33
false
false
0
7
6
22
10
12
null
null
Toxaris/pandoc-lit
src/Text/Pandoc/Lit.hs
bsd-3-clause
handleFigures "%caption" = "\\caption{"
42
handleFigures "%caption" = "\\caption{"
42
handleFigures "%caption" = "\\caption{"
42
false
false
1
5
6
13
4
9
null
null
hephaestus-pl/hephaestus
willian/hephaestus-integrated/asset-base/uc-model/src/UseCaseModel/PrettyPrinter/Latex.hs
mit
flowToLatex :: Flow -> Doc flowToLatex [] = empty
49
flowToLatex :: Flow -> Doc flowToLatex [] = empty
49
flowToLatex [] = empty
22
false
true
0
6
8
20
10
10
null
null
jimsnow/polink
PolinkState.hs
gpl-2.0
editLink :: Uid -> Lid -> Eid -> LinkType -> Eid -> (Day, Bool) -> Maybe (Day, Bool) -> Maybe Money -> [Url] -> S Lid editLink uid lid@(Lid id) src lt dst date end money urls = do let l = Link lid src dst lt date end money urls links . at lid ?= l addContrib uid $ L lid return lid -- Delete a link.
317
editLink :: Uid -> Lid -> Eid -> LinkType -> Eid -> (Day, Bool) -> Maybe (Day, Bool) -> Maybe Money -> [Url] -> S Lid editLink uid lid@(Lid id) src lt dst date end money urls = do let l = Link lid src dst lt date end money urls links . at lid ?= l addContrib uid $ L lid return lid -- Delete a link.
317
editLink uid lid@(Lid id) src lt dst date end money urls = do let l = Link lid src dst lt date end money urls links . at lid ?= l addContrib uid $ L lid return lid -- Delete a link.
199
false
true
9
6
85
144
79
65
null
null
olorin/amazonka
amazonka-iam/gen/Network/AWS/IAM/GetSSHPublicKey.hs
mpl-2.0
-- | The name of the IAM user associated with the SSH public key. gspkUserName :: Lens' GetSSHPublicKey Text gspkUserName = lens _gspkUserName (\ s a -> s{_gspkUserName = a})
174
gspkUserName :: Lens' GetSSHPublicKey Text gspkUserName = lens _gspkUserName (\ s a -> s{_gspkUserName = a})
108
gspkUserName = lens _gspkUserName (\ s a -> s{_gspkUserName = a})
65
true
true
1
9
29
46
22
24
null
null
projectorhq/haskell-liquid
test/Text/Liquid/ParserTests.hs
bsd-3-clause
case_predicate2 = parseOnly predicate "1 > 2or3 == 3" @?= Right (Or (Gt (Num $ sc 1) (Num $ sc 2)) (Equal (Num $ sc 3) (Num $ sc 3)))
135
case_predicate2 = parseOnly predicate "1 > 2or3 == 3" @?= Right (Or (Gt (Num $ sc 1) (Num $ sc 2)) (Equal (Num $ sc 3) (Num $ sc 3)))
135
case_predicate2 = parseOnly predicate "1 > 2or3 == 3" @?= Right (Or (Gt (Num $ sc 1) (Num $ sc 2)) (Equal (Num $ sc 3) (Num $ sc 3)))
135
false
false
1
12
31
87
40
47
null
null
narurien/ganeti-ceph
src/Ganeti/DataCollectors/InstStatus.hs
gpl-2.0
computeStatusField AdminOffline _ = -- FIXME: The "offline" status seems not to be used anywhere in the source -- code, but it is defined, so we have to consider it anyway here. DCStatus DCSCUnknown "The instance is marked as offline"
240
computeStatusField AdminOffline _ = -- FIXME: The "offline" status seems not to be used anywhere in the source -- code, but it is defined, so we have to consider it anyway here. DCStatus DCSCUnknown "The instance is marked as offline"
240
computeStatusField AdminOffline _ = -- FIXME: The "offline" status seems not to be used anywhere in the source -- code, but it is defined, so we have to consider it anyway here. DCStatus DCSCUnknown "The instance is marked as offline"
240
false
false
0
5
45
21
9
12
null
null
IreneKnapp/Faction
libfaction/Distribution/Simple/Utils.hs
bsd-3-clause
ignoreBOM :: String -> String ignoreBOM ('\xFEFF':string) = string
66
ignoreBOM :: String -> String ignoreBOM ('\xFEFF':string) = string
66
ignoreBOM ('\xFEFF':string) = string
36
false
true
0
7
8
25
13
12
null
null
nathantypanski/my-xmonad
my-xmonad.hs
bsd-3-clause
colorAqua :: String colorAqua = "#4E9FB1"
41
colorAqua :: String colorAqua = "#4E9FB1"
41
colorAqua = "#4E9FB1"
21
false
true
0
4
5
11
6
5
null
null
RaphaelJ/getwebb.org
Util/Extras.hs
gpl-3.0
getMiniature :: Hmac -> Extras -> Maybe (Route App) getMiniature hmac (ImageExtras _ _) = Just $ DownloadMiniatureR hmac
120
getMiniature :: Hmac -> Extras -> Maybe (Route App) getMiniature hmac (ImageExtras _ _) = Just $ DownloadMiniatureR hmac
120
getMiniature hmac (ImageExtras _ _) = Just $ DownloadMiniatureR hmac
68
false
true
0
9
18
48
23
25
null
null
balez/ag-a-la-carte
Language/Grammars/AGalacarte/Examples/Repmin.hs
gpl-3.0
leaf = injC proxies . Leaf
26
leaf = injC proxies . Leaf
26
leaf = injC proxies . Leaf
26
false
false
2
5
5
18
6
12
null
null
markhibberd/numerus
src/Numerus/Core.hs
bsd-3-clause
list :: (ToRow a, FromRow b) => Connection -> Query -> a -> IO [b] list c q v = query c q v
92
list :: (ToRow a, FromRow b) => Connection -> Query -> a -> IO [b] list c q v = query c q v
92
list c q v = query c q v
24
false
true
0
10
24
58
29
29
null
null
noteed/opengl-api
Text/OpenGL/Spec.hs
bsd-3-clause
isOffset :: Prop -> Bool isOffset (Offset _) = True
51
isOffset :: Prop -> Bool isOffset (Offset _) = True
51
isOffset (Offset _) = True
26
false
true
0
7
9
24
12
12
null
null
nikita-volkov/slave-thread
library/SlaveThread.hs
mit
fork :: IO a -> IO ThreadId fork = forkFinally $ return ()
60
fork :: IO a -> IO ThreadId fork = forkFinally $ return ()
60
fork = forkFinally $ return ()
32
false
true
2
7
14
37
15
22
null
null
urbanslug/ghc
compiler/llvmGen/Llvm/PpLlvm.hs
bsd-3-clause
ppSwitch :: LlvmVar -> LlvmVar -> [(LlvmVar,LlvmVar)] -> SDoc ppSwitch scrut dflt targets = let ppTarget (val, lab) = ppr val <> comma <+> ppr lab ppTargets xs = brackets $ vcat (map ppTarget xs) in text "switch" <+> ppr scrut <> comma <+> ppr dflt <+> ppTargets targets
297
ppSwitch :: LlvmVar -> LlvmVar -> [(LlvmVar,LlvmVar)] -> SDoc ppSwitch scrut dflt targets = let ppTarget (val, lab) = ppr val <> comma <+> ppr lab ppTargets xs = brackets $ vcat (map ppTarget xs) in text "switch" <+> ppr scrut <> comma <+> ppr dflt <+> ppTargets targets
297
ppSwitch scrut dflt targets = let ppTarget (val, lab) = ppr val <> comma <+> ppr lab ppTargets xs = brackets $ vcat (map ppTarget xs) in text "switch" <+> ppr scrut <> comma <+> ppr dflt <+> ppTargets targets
235
false
true
4
12
75
132
61
71
null
null
RayRacine/nucleic
Nucleic/IO.hs
gpl-3.0
evtE :: Edge a -> FRP.Event a evtE (Edge e _) = e
49
evtE :: Edge a -> FRP.Event a evtE (Edge e _) = e
49
evtE (Edge e _) = e
19
false
true
0
7
12
34
16
18
null
null
portnov/haskell-gettext
Data/Gettext/Parsers.hs
bsd-3-clause
semi :: Parser String semi = Token.semi lexer
45
semi :: Parser String semi = Token.semi lexer
45
semi = Token.semi lexer
23
false
true
0
6
7
19
9
10
null
null
spechub/Hets
OWL2/OWL22CASL.hs
gpl-2.0
mkFacetPred :: TERM f -> ConstrainingFacet -> TERM f -> (FORMULA f, Id) mkFacetPred lit f var = let cf = mkInfix $ fromCF f in (mkPred dataPred [var, lit] cf, cf)
170
mkFacetPred :: TERM f -> ConstrainingFacet -> TERM f -> (FORMULA f, Id) mkFacetPred lit f var = let cf = mkInfix $ fromCF f in (mkPred dataPred [var, lit] cf, cf)
170
mkFacetPred lit f var = let cf = mkInfix $ fromCF f in (mkPred dataPred [var, lit] cf, cf)
98
false
true
0
10
39
88
42
46
null
null
BartMassey/mc-level
Data/NBT/XML.hs
bsd-3-clause
nbtToXml (ShortTag name value) = makeScalarTag ShortType name (show value)
76
nbtToXml (ShortTag name value) = makeScalarTag ShortType name (show value)
76
nbtToXml (ShortTag name value) = makeScalarTag ShortType name (show value)
76
false
false
0
7
11
30
14
16
null
null
amar47shah/socket-server
app/Main.hs
bsd-3-clause
getName :: Server -> Handle -> IO () getName server handle = hPutStrLn handle "What is your name?" *> readName server handle
130
getName :: Server -> Handle -> IO () getName server handle = hPutStrLn handle "What is your name?" *> readName server handle
130
getName server handle = hPutStrLn handle "What is your name?" *> readName server handle
93
false
true
0
9
27
50
21
29
null
null
Soostone/cassy
src/Database/Cassandra/Types.hs
bsd-3-clause
mkThriftCol _ = error "mkThriftCol can only process regular columns."
69
mkThriftCol _ = error "mkThriftCol can only process regular columns."
69
mkThriftCol _ = error "mkThriftCol can only process regular columns."
69
false
false
0
5
9
12
5
7
null
null
MichaelMackus/hsrl
RL/Generator/Items.hs
mit
itemRarity d (Item "Two-Handed Sword" _) = (1 % 20)
51
itemRarity d (Item "Two-Handed Sword" _) = (1 % 20)
51
itemRarity d (Item "Two-Handed Sword" _) = (1 % 20)
51
false
false
0
7
9
26
13
13
null
null
GaloisInc/halvm-ghc
compiler/main/GhcMake.hs
bsd-3-clause
moduleGraphNodes :: Bool -> [ModSummary] -> (Graph SummaryNode, HscSource -> ModuleName -> Maybe SummaryNode) moduleGraphNodes drop_hs_boot_nodes summaries = (graphFromEdgedVertices nodes, lookup_node) where numbered_summaries = zip summaries [1..] lookup_node :: HscSource -> ModuleName -> Maybe SummaryNode lookup_node hs_src mod = Map.lookup (mod, hscSourceToIsBoot hs_src) node_map lookup_key :: HscSource -> ModuleName -> Maybe Int lookup_key hs_src mod = fmap summaryNodeKey (lookup_node hs_src mod) node_map :: NodeMap SummaryNode node_map = Map.fromList [ ((moduleName (ms_mod s), hscSourceToIsBoot (ms_hsc_src s)), node) | node@(s, _, _) <- nodes ] -- We use integers as the keys for the SCC algorithm nodes :: [SummaryNode] nodes = [ (s, key, out_keys) | (s, key) <- numbered_summaries -- Drop the hi-boot ones if told to do so , not (isBootSummary s && drop_hs_boot_nodes) , let out_keys = out_edge_keys hs_boot_key (map unLoc (ms_home_srcimps s)) ++ out_edge_keys HsSrcFile (map unLoc (ms_home_imps s)) ++ (-- see [boot-edges] below if drop_hs_boot_nodes || ms_hsc_src s == HsBootFile then [] else case lookup_key HsBootFile (ms_mod_name s) of Nothing -> [] Just k -> [k]) ] -- [boot-edges] if this is a .hs and there is an equivalent -- .hs-boot, add a link from the former to the latter. This -- has the effect of detecting bogus cases where the .hs-boot -- depends on the .hs, by introducing a cycle. Additionally, -- it ensures that we will always process the .hs-boot before -- the .hs, and so the HomePackageTable will always have the -- most up to date information. -- Drop hs-boot nodes by using HsSrcFile as the key hs_boot_key | drop_hs_boot_nodes = HsSrcFile | otherwise = HsBootFile out_edge_keys :: HscSource -> [ModuleName] -> [Int] out_edge_keys hi_boot ms = mapMaybe (lookup_key hi_boot) ms -- If we want keep_hi_boot_nodes, then we do lookup_key with -- IsBoot; else NotBoot -- The nodes of the graph are keyed by (mod, is boot?) pairs -- NB: hsig files show up as *normal* nodes (not boot!), since they don't -- participate in cycles (for now)
2,544
moduleGraphNodes :: Bool -> [ModSummary] -> (Graph SummaryNode, HscSource -> ModuleName -> Maybe SummaryNode) moduleGraphNodes drop_hs_boot_nodes summaries = (graphFromEdgedVertices nodes, lookup_node) where numbered_summaries = zip summaries [1..] lookup_node :: HscSource -> ModuleName -> Maybe SummaryNode lookup_node hs_src mod = Map.lookup (mod, hscSourceToIsBoot hs_src) node_map lookup_key :: HscSource -> ModuleName -> Maybe Int lookup_key hs_src mod = fmap summaryNodeKey (lookup_node hs_src mod) node_map :: NodeMap SummaryNode node_map = Map.fromList [ ((moduleName (ms_mod s), hscSourceToIsBoot (ms_hsc_src s)), node) | node@(s, _, _) <- nodes ] -- We use integers as the keys for the SCC algorithm nodes :: [SummaryNode] nodes = [ (s, key, out_keys) | (s, key) <- numbered_summaries -- Drop the hi-boot ones if told to do so , not (isBootSummary s && drop_hs_boot_nodes) , let out_keys = out_edge_keys hs_boot_key (map unLoc (ms_home_srcimps s)) ++ out_edge_keys HsSrcFile (map unLoc (ms_home_imps s)) ++ (-- see [boot-edges] below if drop_hs_boot_nodes || ms_hsc_src s == HsBootFile then [] else case lookup_key HsBootFile (ms_mod_name s) of Nothing -> [] Just k -> [k]) ] -- [boot-edges] if this is a .hs and there is an equivalent -- .hs-boot, add a link from the former to the latter. This -- has the effect of detecting bogus cases where the .hs-boot -- depends on the .hs, by introducing a cycle. Additionally, -- it ensures that we will always process the .hs-boot before -- the .hs, and so the HomePackageTable will always have the -- most up to date information. -- Drop hs-boot nodes by using HsSrcFile as the key hs_boot_key | drop_hs_boot_nodes = HsSrcFile | otherwise = HsBootFile out_edge_keys :: HscSource -> [ModuleName] -> [Int] out_edge_keys hi_boot ms = mapMaybe (lookup_key hi_boot) ms -- If we want keep_hi_boot_nodes, then we do lookup_key with -- IsBoot; else NotBoot -- The nodes of the graph are keyed by (mod, is boot?) pairs -- NB: hsig files show up as *normal* nodes (not boot!), since they don't -- participate in cycles (for now)
2,544
moduleGraphNodes drop_hs_boot_nodes summaries = (graphFromEdgedVertices nodes, lookup_node) where numbered_summaries = zip summaries [1..] lookup_node :: HscSource -> ModuleName -> Maybe SummaryNode lookup_node hs_src mod = Map.lookup (mod, hscSourceToIsBoot hs_src) node_map lookup_key :: HscSource -> ModuleName -> Maybe Int lookup_key hs_src mod = fmap summaryNodeKey (lookup_node hs_src mod) node_map :: NodeMap SummaryNode node_map = Map.fromList [ ((moduleName (ms_mod s), hscSourceToIsBoot (ms_hsc_src s)), node) | node@(s, _, _) <- nodes ] -- We use integers as the keys for the SCC algorithm nodes :: [SummaryNode] nodes = [ (s, key, out_keys) | (s, key) <- numbered_summaries -- Drop the hi-boot ones if told to do so , not (isBootSummary s && drop_hs_boot_nodes) , let out_keys = out_edge_keys hs_boot_key (map unLoc (ms_home_srcimps s)) ++ out_edge_keys HsSrcFile (map unLoc (ms_home_imps s)) ++ (-- see [boot-edges] below if drop_hs_boot_nodes || ms_hsc_src s == HsBootFile then [] else case lookup_key HsBootFile (ms_mod_name s) of Nothing -> [] Just k -> [k]) ] -- [boot-edges] if this is a .hs and there is an equivalent -- .hs-boot, add a link from the former to the latter. This -- has the effect of detecting bogus cases where the .hs-boot -- depends on the .hs, by introducing a cycle. Additionally, -- it ensures that we will always process the .hs-boot before -- the .hs, and so the HomePackageTable will always have the -- most up to date information. -- Drop hs-boot nodes by using HsSrcFile as the key hs_boot_key | drop_hs_boot_nodes = HsSrcFile | otherwise = HsBootFile out_edge_keys :: HscSource -> [ModuleName] -> [Int] out_edge_keys hi_boot ms = mapMaybe (lookup_key hi_boot) ms -- If we want keep_hi_boot_nodes, then we do lookup_key with -- IsBoot; else NotBoot -- The nodes of the graph are keyed by (mod, is boot?) pairs -- NB: hsig files show up as *normal* nodes (not boot!), since they don't -- participate in cycles (for now)
2,432
false
true
29
13
794
460
247
213
null
null
shlevy/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
liftMIdKey = mkPreludeMiscIdUnique 195
43
liftMIdKey = mkPreludeMiscIdUnique 195
43
liftMIdKey = mkPreludeMiscIdUnique 195
43
false
false
0
5
8
9
4
5
null
null
kim/amazonka
amazonka-glacier/gen/Network/AWS/Glacier/ListParts.hs
mpl-2.0
-- | The name of the vault. lpVaultName :: Lens' ListParts Text lpVaultName = lens _lpVaultName (\s a -> s { _lpVaultName = a })
128
lpVaultName :: Lens' ListParts Text lpVaultName = lens _lpVaultName (\s a -> s { _lpVaultName = a })
100
lpVaultName = lens _lpVaultName (\s a -> s { _lpVaultName = a })
64
true
true
0
9
24
46
23
23
null
null
andyarvanitis/Idris-dev
src/IRTS/Compiler.hs
bsd-3-clause
irSC vs ImpossibleCase = return LNothing
40
irSC vs ImpossibleCase = return LNothing
40
irSC vs ImpossibleCase = return LNothing
40
false
false
0
5
5
16
6
10
null
null
nstoddard/unitcalc
Types.hs
mit
prettyPrintUnits units | not (null pos) && length neg == 1 = P.hsep (map prettyPrintUnit pos) <//> pretty "/" <//> prettyPrintUnit (second negate $ head neg) | otherwise = P.hsep (map prettyPrintUnit units) where (pos, neg) = partition ((>0).snd) units
280
prettyPrintUnits units | not (null pos) && length neg == 1 = P.hsep (map prettyPrintUnit pos) <//> pretty "/" <//> prettyPrintUnit (second negate $ head neg) | otherwise = P.hsep (map prettyPrintUnit units) where (pos, neg) = partition ((>0).snd) units
280
prettyPrintUnits units | not (null pos) && length neg == 1 = P.hsep (map prettyPrintUnit pos) <//> pretty "/" <//> prettyPrintUnit (second negate $ head neg) | otherwise = P.hsep (map prettyPrintUnit units) where (pos, neg) = partition ((>0).snd) units
280
false
false
0
12
67
125
59
66
null
null
santolucito/Euterpea_Projects
QuantumArt/Types.hs
mit
defaultBlock :: Block defaultBlock = Block {myColor = black ,currPos = (0,0) ,origPos = (0,0)}
101
defaultBlock :: Block defaultBlock = Block {myColor = black ,currPos = (0,0) ,origPos = (0,0)}
100
defaultBlock = Block {myColor = black ,currPos = (0,0) ,origPos = (0,0)}
78
false
true
0
8
21
47
28
19
null
null
beni55/haste-compiler
libraries/ghc-7.8/base/Foreign/C/Error.hs
bsd-3-clause
throwErrnoPathIf_ :: (a -> Bool) -> String -> FilePath -> IO a -> IO () throwErrnoPathIf_ pred loc path f = void $ throwErrnoPathIf pred loc path f
148
throwErrnoPathIf_ :: (a -> Bool) -> String -> FilePath -> IO a -> IO () throwErrnoPathIf_ pred loc path f = void $ throwErrnoPathIf pred loc path f
148
throwErrnoPathIf_ pred loc path f = void $ throwErrnoPathIf pred loc path f
76
false
true
0
10
28
64
31
33
null
null
quchen/stg
src/Stg/Util.hs
bsd-3-clause
commaSep :: [Doc ann] -> Doc ann commaSep = encloseSep mempty mempty (comma <> space)
85
commaSep :: [Doc ann] -> Doc ann commaSep = encloseSep mempty mempty (comma <> space)
85
commaSep = encloseSep mempty mempty (comma <> space)
52
false
true
0
7
14
38
19
19
null
null
AaronFriel/hs-tls
core/Network/TLS/Record/Disengage.hs
bsd-3-clause
uncompressRecord :: Record Compressed -> RecordM (Record Plaintext) uncompressRecord record = onRecordFragment record $ fragmentUncompress $ \bytes -> withCompression $ compressionInflate bytes
197
uncompressRecord :: Record Compressed -> RecordM (Record Plaintext) uncompressRecord record = onRecordFragment record $ fragmentUncompress $ \bytes -> withCompression $ compressionInflate bytes
197
uncompressRecord record = onRecordFragment record $ fragmentUncompress $ \bytes -> withCompression $ compressionInflate bytes
129
false
true
2
8
25
57
26
31
null
null
ellis/OnTopOfThings
old-20150308/src/DatabaseTables.hs
gpl-3.0
itemEmpty :: String -> UTCTime -> String -> String -> String -> Item itemEmpty uuid created creator type_ status = Item uuid created creator type_ status Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
251
itemEmpty :: String -> UTCTime -> String -> String -> String -> Item itemEmpty uuid created creator type_ status = Item uuid created creator type_ status Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
251
itemEmpty uuid created creator type_ status = Item uuid created creator type_ status Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
182
false
true
0
9
39
77
38
39
null
null
ice1000/OI-codes
codewars/301-400/three-simple-polyvariadic-haskell-functions.hs
agpl-3.0
a ->> b = b ++ [a]
18
a ->> b = b ++ [a]
18
a ->> b = b ++ [a]
18
false
false
5
5
6
23
10
13
null
null
ksaveljev/brainfuck-hs
brainfuck.hs
mit
runBFCommand :: BFCommand -> StateT (Int, IM.IntMap Word8) IO () runBFCommand cmd = do (n, tape) <- get let w = getOrZero $ IM.lookup n tape case cmd of MoveLeft -> put (n - 1, tape) MoveRight -> put (n + 1, tape) Increment -> put (n, IM.insert n (w + 1) tape) Decrement -> put (n, IM.insert n (w - 1) tape) Input -> do c <- liftIO getChar put (n, IM.insert n (fromIntegral $ fromEnum c) tape) Output -> liftIO $ putChar $ toEnum $ fromIntegral w loop@(Loop program) -> case w of 0 -> return () _ -> interpret program >> runBFCommand loop
670
runBFCommand :: BFCommand -> StateT (Int, IM.IntMap Word8) IO () runBFCommand cmd = do (n, tape) <- get let w = getOrZero $ IM.lookup n tape case cmd of MoveLeft -> put (n - 1, tape) MoveRight -> put (n + 1, tape) Increment -> put (n, IM.insert n (w + 1) tape) Decrement -> put (n, IM.insert n (w - 1) tape) Input -> do c <- liftIO getChar put (n, IM.insert n (fromIntegral $ fromEnum c) tape) Output -> liftIO $ putChar $ toEnum $ fromIntegral w loop@(Loop program) -> case w of 0 -> return () _ -> interpret program >> runBFCommand loop
670
runBFCommand cmd = do (n, tape) <- get let w = getOrZero $ IM.lookup n tape case cmd of MoveLeft -> put (n - 1, tape) MoveRight -> put (n + 1, tape) Increment -> put (n, IM.insert n (w + 1) tape) Decrement -> put (n, IM.insert n (w - 1) tape) Input -> do c <- liftIO getChar put (n, IM.insert n (fromIntegral $ fromEnum c) tape) Output -> liftIO $ putChar $ toEnum $ fromIntegral w loop@(Loop program) -> case w of 0 -> return () _ -> interpret program >> runBFCommand loop
605
false
true
6
22
237
291
144
147
null
null