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
autocorr/lyah
chap6.hs
mit
-- maps and filters -- -- maps: -- maps are a useful alternative to list comprehensions where you're -- apply a function to a list of elements, or nested comprehensions, -- where the number of brackets and indentation can be tricky. -- cf. -- map (+3) [1..5] -- [x+3 | x <- [1..5]] -- find the largest number under 100,000 that's divisible 3829 largDiv :: (Integral a) => a largDiv = head (filter p [100000,99999..]) where p x = x `mod` 3829 == 0
451
largDiv :: (Integral a) => a largDiv = head (filter p [100000,99999..]) where p x = x `mod` 3829 == 0
105
largDiv = head (filter p [100000,99999..]) where p x = x `mod` 3829 == 0
76
true
true
1
7
88
81
43
38
null
null
Cahu/krpc-hs
src/KRPCHS/SpaceCenter.hs
gpl-3.0
{- - A list of all failed contracts. -} getContractManagerFailedContracts :: KRPCHS.SpaceCenter.ContractManager -> RPCContext ([KRPCHS.SpaceCenter.Contract]) getContractManagerFailedContracts thisArg = do let r = makeRequest "SpaceCenter" "ContractManager_get_FailedContracts" [makeArgument 0 thisArg] res <- sendRequest r processResponse res
356
getContractManagerFailedContracts :: KRPCHS.SpaceCenter.ContractManager -> RPCContext ([KRPCHS.SpaceCenter.Contract]) getContractManagerFailedContracts thisArg = do let r = makeRequest "SpaceCenter" "ContractManager_get_FailedContracts" [makeArgument 0 thisArg] res <- sendRequest r processResponse res
314
getContractManagerFailedContracts thisArg = do let r = makeRequest "SpaceCenter" "ContractManager_get_FailedContracts" [makeArgument 0 thisArg] res <- sendRequest r processResponse res
196
true
true
0
12
47
74
36
38
null
null
threetreeslight/learning-haskell
practice/old/20151004.hs
mit
-- ---------------------------------------- -- take, drop, splitAt -- ---------------------------------------- takeRaw, takeU :: Int -> [a] -> [a] takeRaw n (x : xs) | n > 0 = x : takeRaw (n - 1) xs
199
takeRaw, takeU :: Int -> [a] -> [a] takeRaw n (x : xs) | n > 0 = x : takeRaw (n - 1) xs
87
takeRaw n (x : xs) | n > 0 = x : takeRaw (n - 1) xs
51
true
true
0
9
33
68
37
31
null
null
rickynils/nixrbd
Nix.hs
bsd-3-clause
reqToNix :: Path -> Request -> String reqToNix path req = concat [ "{" , "fullPath = ", listToNix (pathInfo req), ";" , "path = ", listToNix path, ";" , "}" ]
168
reqToNix :: Path -> Request -> String reqToNix path req = concat [ "{" , "fullPath = ", listToNix (pathInfo req), ";" , "path = ", listToNix path, ";" , "}" ]
168
reqToNix path req = concat [ "{" , "fullPath = ", listToNix (pathInfo req), ";" , "path = ", listToNix path, ";" , "}" ]
130
false
true
0
9
41
69
35
34
null
null
ekmett/text
tests/Tests/Properties.hs
bsd-2-clause
t_scanr f z = L.scanr f z `eqP` (unpackS . T.scanr f z)
63
t_scanr f z = L.scanr f z `eqP` (unpackS . T.scanr f z)
63
t_scanr f z = L.scanr f z `eqP` (unpackS . T.scanr f z)
63
false
false
0
9
20
38
19
19
null
null
jgm/Markdown
Markdown.hs
bsd-3-clause
emailLink :: Text -> Inlines emailLink t = singleton $ Link (singleton $ Str t) (escapeUri $ "mailto:" <> t) (T.empty)
149
emailLink :: Text -> Inlines emailLink t = singleton $ Link (singleton $ Str t) (escapeUri $ "mailto:" <> t) (T.empty)
149
emailLink t = singleton $ Link (singleton $ Str t) (escapeUri $ "mailto:" <> t) (T.empty)
120
false
true
0
9
51
55
28
27
null
null
eugenkiss/loopgotowhile
src/Language/LoopGotoWhile/Goto/Transform.hs
bsd-3-clause
toStrictStat' (If (BOp "||" a b) stat1 Nothing) = do u <- getUnusedVar ltw <- loopToGoto $ Loop (Var u) stat1 toStrictStat' $ Seq [ Assign u (Const 0) , If a (Assign u (Const 1)) Nothing , If b (Assign u (Const 1)) Nothing , ltw ]
282
toStrictStat' (If (BOp "||" a b) stat1 Nothing) = do u <- getUnusedVar ltw <- loopToGoto $ Loop (Var u) stat1 toStrictStat' $ Seq [ Assign u (Const 0) , If a (Assign u (Const 1)) Nothing , If b (Assign u (Const 1)) Nothing , ltw ]
282
toStrictStat' (If (BOp "||" a b) stat1 Nothing) = do u <- getUnusedVar ltw <- loopToGoto $ Loop (Var u) stat1 toStrictStat' $ Seq [ Assign u (Const 0) , If a (Assign u (Const 1)) Nothing , If b (Assign u (Const 1)) Nothing , ltw ]
282
false
false
0
14
99
133
64
69
null
null
nbloomf/carl
src/Carl/Data/Natural.hs
gpl-3.0
natSub :: Natural -> Natural -> Either AlgErr Natural natSub (Nat a) (Nat b) | b > a = Left NatSubErr | otherwise = return $ Nat (a-b)
138
natSub :: Natural -> Natural -> Either AlgErr Natural natSub (Nat a) (Nat b) | b > a = Left NatSubErr | otherwise = return $ Nat (a-b)
138
natSub (Nat a) (Nat b) | b > a = Left NatSubErr | otherwise = return $ Nat (a-b)
84
false
true
1
8
31
75
36
39
null
null
davnils/katt
katt-lib/src/Utils/Katt/Init.hs
bsd-3-clause
retrieveTestFiles :: KattisProblem -> ConfigEnv IO TestContent retrieveTestFiles problem = do problemName <- tryIO $ retrieveProblemName problem problemPage <- retrievePublicPage $ problemAddress <> problemName case parseProblemPage problemPage of NoTestsAvailable -> do tryIO $ B.hPutStrLn stderr "No tests available" return [] TestAddress addr -> downloadTestArchive addr TestContents list -> return list -- | Page listing all problems associated with a problem session, relative 'Utils.host'.
527
retrieveTestFiles :: KattisProblem -> ConfigEnv IO TestContent retrieveTestFiles problem = do problemName <- tryIO $ retrieveProblemName problem problemPage <- retrievePublicPage $ problemAddress <> problemName case parseProblemPage problemPage of NoTestsAvailable -> do tryIO $ B.hPutStrLn stderr "No tests available" return [] TestAddress addr -> downloadTestArchive addr TestContents list -> return list -- | Page listing all problems associated with a problem session, relative 'Utils.host'.
527
retrieveTestFiles problem = do problemName <- tryIO $ retrieveProblemName problem problemPage <- retrievePublicPage $ problemAddress <> problemName case parseProblemPage problemPage of NoTestsAvailable -> do tryIO $ B.hPutStrLn stderr "No tests available" return [] TestAddress addr -> downloadTestArchive addr TestContents list -> return list -- | Page listing all problems associated with a problem session, relative 'Utils.host'.
464
false
true
0
15
94
116
51
65
null
null
seL4/capDL-tool
CapDL/State.hs
bsd-2-clause
koType :: KernelObject Word -> KOType koType Endpoint = Endpoint_T
66
koType :: KernelObject Word -> KOType koType Endpoint = Endpoint_T
66
koType Endpoint = Endpoint_T
28
false
true
0
6
9
21
10
11
null
null
league/yesod-crud
Yesod/Contrib/League/Crud/Sort.hs
bsd-3-clause
readEnumMay :: SortC k => String -> Maybe k readEnumMay s = readMay s >>= toEnumMay
83
readEnumMay :: SortC k => String -> Maybe k readEnumMay s = readMay s >>= toEnumMay
83
readEnumMay s = readMay s >>= toEnumMay
39
false
true
0
7
15
35
16
19
null
null
tphyahoo/gititpt
Network/Gitit/State.hs
gpl-2.0
updateUserFile = do conf <- getConfig usrs <- queryGititState users liftIO $ C.writeFile (userFile conf) $ "[" ++ intercalate "\n," (map show $ M.toList usrs) ++ "\n]"
174
updateUserFile = do conf <- getConfig usrs <- queryGititState users liftIO $ C.writeFile (userFile conf) $ "[" ++ intercalate "\n," (map show $ M.toList usrs) ++ "\n]"
174
updateUserFile = do conf <- getConfig usrs <- queryGititState users liftIO $ C.writeFile (userFile conf) $ "[" ++ intercalate "\n," (map show $ M.toList usrs) ++ "\n]"
174
false
false
1
13
33
77
33
44
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/simplCore/CoreMonad.hs
bsd-3-clause
getOrigNameCache :: CoreM OrigNameCache getOrigNameCache = do nameCacheRef <- fmap hsc_NC getHscEnv liftIO $ fmap nsNames $ readIORef nameCacheRef
154
getOrigNameCache :: CoreM OrigNameCache getOrigNameCache = do nameCacheRef <- fmap hsc_NC getHscEnv liftIO $ fmap nsNames $ readIORef nameCacheRef
154
getOrigNameCache = do nameCacheRef <- fmap hsc_NC getHscEnv liftIO $ fmap nsNames $ readIORef nameCacheRef
114
false
true
0
9
26
43
19
24
null
null
benkolera/talk-stacking-your-monads
code-classy/tests/DbTests/Internal.hs
mit
assertDbResult :: Either DbError a -> (a -> Assertion) -> Assertion assertDbResult e f = either (error . ("DB Failed: " <>) . show) f e
135
assertDbResult :: Either DbError a -> (a -> Assertion) -> Assertion assertDbResult e f = either (error . ("DB Failed: " <>) . show) f e
135
assertDbResult e f = either (error . ("DB Failed: " <>) . show) f e
67
false
true
0
9
25
58
30
28
null
null
diegomachadosoares/hcomp
Main.hs
gpl-3.0
parserFat = (empty_Env ,[] ,empty_M ,[Ccom (parseString " { proc fat ( acc int , resp int , ) begin if ( acc = 0) then print ( resp ) else { resp := resp * acc } ; { { acc := acc - 1 } ; { call fat ( acc , resp , ) } } endIF end } ; { call fat ( 3 , 1 , ) } ")] ,[])
303
parserFat = (empty_Env ,[] ,empty_M ,[Ccom (parseString " { proc fat ( acc int , resp int , ) begin if ( acc = 0) then print ( resp ) else { resp := resp * acc } ; { { acc := acc - 1 } ; { call fat ( acc , resp , ) } } endIF end } ; { call fat ( 3 , 1 , ) } ")] ,[])
303
parserFat = (empty_Env ,[] ,empty_M ,[Ccom (parseString " { proc fat ( acc int , resp int , ) begin if ( acc = 0) then print ( resp ) else { resp := resp * acc } ; { { acc := acc - 1 } ; { call fat ( acc , resp , ) } } endIF end } ; { call fat ( 3 , 1 , ) } ")] ,[])
303
false
false
1
10
111
41
21
20
null
null
rahulmutt/ghcvm
compiler/Eta/Prelude/THNames.hs
bsd-3-clause
parSName = libFun (fsLit "parS") parSIdKey
48
parSName = libFun (fsLit "parS") parSIdKey
48
parSName = libFun (fsLit "parS") parSIdKey
48
false
false
0
7
11
17
8
9
null
null
ivan-m/monad-levels
Control/Monad/Levels/Constraints.hs
mit
-- | Lift a value of the satisfying monad to the top of the tower. liftSat :: forall c m a. (SatisfyConstraint c m) => Proxy c -> SatMonad c m a -> m a liftSat p = _liftSat (Proxy :: Proxy (SatDepth c m)) p (Proxy :: Proxy m) (Proxy :: Proxy a)
255
liftSat :: forall c m a. (SatisfyConstraint c m) => Proxy c -> SatMonad c m a -> m a liftSat p = _liftSat (Proxy :: Proxy (SatDepth c m)) p (Proxy :: Proxy m) (Proxy :: Proxy a)
188
liftSat p = _liftSat (Proxy :: Proxy (SatDepth c m)) p (Proxy :: Proxy m) (Proxy :: Proxy a)
92
true
true
0
9
64
98
51
47
null
null
rubik/stack
src/Stack/Build/Installed.hs
bsd-3-clause
loadDatabase :: (M env m, PackageInstallInfo pii) => EnvOverride -> GetInstalledOpts -> Maybe InstalledCache -- ^ if Just, profiling or haddock is required -> Map PackageName pii -- ^ to determine which installed things we should include -> Maybe (InstalledPackageLocation, Path Abs Dir) -- ^ package database, Nothing for global -> [LoadHelper] -- ^ from parent databases -> m ([LoadHelper], [DumpPackage () ()]) loadDatabase menv opts mcache sourceMap mdb lhs0 = do wc <- getWhichCompiler (lhs1', dps) <- ghcPkgDump menv wc (fmap snd (maybeToList mdb)) $ conduitDumpPackage =$ sink let ghcjsHack = wc == Ghcjs && isNothing mdb lhs1 <- mapMaybeM (processLoadResult mdb ghcjsHack) lhs1' let lhs = pruneDeps id lhId lhDeps const (lhs0 ++ lhs1) return (map (\lh -> lh { lhDeps = [] }) $ Map.elems lhs, dps) where conduitProfilingCache = case mcache of Just cache | getInstalledProfiling opts -> addProfiling cache -- Just an optimization to avoid calculating the profiling -- values when they aren't necessary _ -> CL.map (\dp -> dp { dpProfiling = False }) conduitHaddockCache = case mcache of Just cache | getInstalledHaddock opts -> addHaddock cache -- Just an optimization to avoid calculating the haddock -- values when they aren't necessary _ -> CL.map (\dp -> dp { dpHaddock = False }) mloc = fmap fst mdb sinkDP = conduitProfilingCache =$ conduitHaddockCache =$ CL.map (\dp -> (isAllowed opts mcache sourceMap mloc dp, toLoadHelper mloc dp)) =$ CL.consume sink = getZipSink $ (,) <$> ZipSink sinkDP <*> ZipSink CL.consume
1,898
loadDatabase :: (M env m, PackageInstallInfo pii) => EnvOverride -> GetInstalledOpts -> Maybe InstalledCache -- ^ if Just, profiling or haddock is required -> Map PackageName pii -- ^ to determine which installed things we should include -> Maybe (InstalledPackageLocation, Path Abs Dir) -- ^ package database, Nothing for global -> [LoadHelper] -- ^ from parent databases -> m ([LoadHelper], [DumpPackage () ()]) loadDatabase menv opts mcache sourceMap mdb lhs0 = do wc <- getWhichCompiler (lhs1', dps) <- ghcPkgDump menv wc (fmap snd (maybeToList mdb)) $ conduitDumpPackage =$ sink let ghcjsHack = wc == Ghcjs && isNothing mdb lhs1 <- mapMaybeM (processLoadResult mdb ghcjsHack) lhs1' let lhs = pruneDeps id lhId lhDeps const (lhs0 ++ lhs1) return (map (\lh -> lh { lhDeps = [] }) $ Map.elems lhs, dps) where conduitProfilingCache = case mcache of Just cache | getInstalledProfiling opts -> addProfiling cache -- Just an optimization to avoid calculating the profiling -- values when they aren't necessary _ -> CL.map (\dp -> dp { dpProfiling = False }) conduitHaddockCache = case mcache of Just cache | getInstalledHaddock opts -> addHaddock cache -- Just an optimization to avoid calculating the haddock -- values when they aren't necessary _ -> CL.map (\dp -> dp { dpHaddock = False }) mloc = fmap fst mdb sinkDP = conduitProfilingCache =$ conduitHaddockCache =$ CL.map (\dp -> (isAllowed opts mcache sourceMap mloc dp, toLoadHelper mloc dp)) =$ CL.consume sink = getZipSink $ (,) <$> ZipSink sinkDP <*> ZipSink CL.consume
1,898
loadDatabase menv opts mcache sourceMap mdb lhs0 = do wc <- getWhichCompiler (lhs1', dps) <- ghcPkgDump menv wc (fmap snd (maybeToList mdb)) $ conduitDumpPackage =$ sink let ghcjsHack = wc == Ghcjs && isNothing mdb lhs1 <- mapMaybeM (processLoadResult mdb ghcjsHack) lhs1' let lhs = pruneDeps id lhId lhDeps const (lhs0 ++ lhs1) return (map (\lh -> lh { lhDeps = [] }) $ Map.elems lhs, dps) where conduitProfilingCache = case mcache of Just cache | getInstalledProfiling opts -> addProfiling cache -- Just an optimization to avoid calculating the profiling -- values when they aren't necessary _ -> CL.map (\dp -> dp { dpProfiling = False }) conduitHaddockCache = case mcache of Just cache | getInstalledHaddock opts -> addHaddock cache -- Just an optimization to avoid calculating the haddock -- values when they aren't necessary _ -> CL.map (\dp -> dp { dpHaddock = False }) mloc = fmap fst mdb sinkDP = conduitProfilingCache =$ conduitHaddockCache =$ CL.map (\dp -> (isAllowed opts mcache sourceMap mloc dp, toLoadHelper mloc dp)) =$ CL.consume sink = getZipSink $ (,) <$> ZipSink sinkDP <*> ZipSink CL.consume
1,393
false
true
6
19
615
470
240
230
null
null
tranma/big-oh
src/Test/BigOh/Fit/Hakaru.hs
bsd-3-clause
measureForOrder :: Order -> [Double] -> [Double] -> Measure [Double] measureForOrder order xs ys = measureForOrder' 0 (maximum $ fmap abs ys) (sd ys) order xs
160
measureForOrder :: Order -> [Double] -> [Double] -> Measure [Double] measureForOrder order xs ys = measureForOrder' 0 (maximum $ fmap abs ys) (sd ys) order xs
160
measureForOrder order xs ys = measureForOrder' 0 (maximum $ fmap abs ys) (sd ys) order xs
91
false
true
0
9
27
71
36
35
null
null
christiaanb/Idris-dev
src/Idris/IdeSlave.hs
bsd-3-clause
parseSExp :: String -> Either ParseError SExp parseSExp = parse pSExp "(unknown)"
81
parseSExp :: String -> Either ParseError SExp parseSExp = parse pSExp "(unknown)"
81
parseSExp = parse pSExp "(unknown)"
35
false
true
0
6
11
25
12
13
null
null
piyush-kurur/shakespeare
hamlet/Text/Hamlet/Parse.hs
bsd-2-clause
-- | Defaults settings: HTML5 doctype and HTML-style empty tags. defaultHamletSettings :: HamletSettings defaultHamletSettings = HamletSettings "<!DOCTYPE html>" False htmlCloseStyle
182
defaultHamletSettings :: HamletSettings defaultHamletSettings = HamletSettings "<!DOCTYPE html>" False htmlCloseStyle
117
defaultHamletSettings = HamletSettings "<!DOCTYPE html>" False htmlCloseStyle
77
true
true
0
5
19
19
10
9
null
null
jb55/rated
Data/Rated.hs
bsd-3-clause
fromRated x _ = x
26
fromRated x _ = x
26
fromRated x _ = x
26
false
false
0
5
13
11
5
6
null
null
brendanhay/gogol
gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/Reports/CompatibleFields/Query.hs
mpl-2.0
-- | Multipart request metadata. rcfqPayload :: Lens' ReportsCompatibleFieldsQuery Report rcfqPayload = lens _rcfqPayload (\ s a -> s{_rcfqPayload = a})
154
rcfqPayload :: Lens' ReportsCompatibleFieldsQuery Report rcfqPayload = lens _rcfqPayload (\ s a -> s{_rcfqPayload = a})
121
rcfqPayload = lens _rcfqPayload (\ s a -> s{_rcfqPayload = a})
64
true
true
0
9
22
42
22
20
null
null
dstruthers/Agate
VM.hs
mit
eval :: VM -> Op -> ThrowsError (LispValue, VM) eval vm op = case runState (exec op) vm of (Right result, vm') -> return (result, vm') (Left error, vm') -> throwError error
176
eval :: VM -> Op -> ThrowsError (LispValue, VM) eval vm op = case runState (exec op) vm of (Right result, vm') -> return (result, vm') (Left error, vm') -> throwError error
176
eval vm op = case runState (exec op) vm of (Right result, vm') -> return (result, vm') (Left error, vm') -> throwError error
128
false
true
2
8
35
91
46
45
null
null
dmcclean/HaTeX
Text/LaTeX/Base/Parser.hs
bsd-3-clause
cmdArg :: Parser TeXArg cmdArg = do c <- char '[' <|> char '{' let e = case c of '[' -> "]" '{' -> "}" _ -> error "this cannot happen!" b <- mconcat <$> manyTill latexBlockParser (string e) case c of '[' -> return $ OptArg b '{' -> return $ FixArg b _ -> error "this cannot happen!" ------------------------------------------------------------------------ -- Special commands (consisting of one char) ------------------------------------------------------------------------
536
cmdArg :: Parser TeXArg cmdArg = do c <- char '[' <|> char '{' let e = case c of '[' -> "]" '{' -> "}" _ -> error "this cannot happen!" b <- mconcat <$> manyTill latexBlockParser (string e) case c of '[' -> return $ OptArg b '{' -> return $ FixArg b _ -> error "this cannot happen!" ------------------------------------------------------------------------ -- Special commands (consisting of one char) ------------------------------------------------------------------------
536
cmdArg = do c <- char '[' <|> char '{' let e = case c of '[' -> "]" '{' -> "}" _ -> error "this cannot happen!" b <- mconcat <$> manyTill latexBlockParser (string e) case c of '[' -> return $ OptArg b '{' -> return $ FixArg b _ -> error "this cannot happen!" ------------------------------------------------------------------------ -- Special commands (consisting of one char) ------------------------------------------------------------------------
512
false
true
0
13
132
132
62
70
null
null
matthew-eads/agpl
CodeGen.hs
isc
possmovesDec :: PossMovesFun -> Q [Dec] possmovesDec (PossMovesFun e) = let f = ValD (VarP (mkName "possMoves")) (NormalB (e)) [] in do {return [f]}
156
possmovesDec :: PossMovesFun -> Q [Dec] possmovesDec (PossMovesFun e) = let f = ValD (VarP (mkName "possMoves")) (NormalB (e)) [] in do {return [f]}
156
possmovesDec (PossMovesFun e) = let f = ValD (VarP (mkName "possMoves")) (NormalB (e)) [] in do {return [f]}
116
false
true
0
13
31
86
42
44
null
null
zaxtax/hakaru
haskell/Language/Hakaru/Expect.hs
bsd-3-clause
expectMeasureOp :: forall abt typs args a . (ABT Term abt, typs ~ UnLCs args, args ~ LCs typs) => MeasureOp typs a -> SArgs abt args -> Expect abt (abt '[] a) expectMeasureOp Lebesgue = \End -> var <$> pushIntegrate P.negativeInfinity P.infinity
270
expectMeasureOp :: forall abt typs args a . (ABT Term abt, typs ~ UnLCs args, args ~ LCs typs) => MeasureOp typs a -> SArgs abt args -> Expect abt (abt '[] a) expectMeasureOp Lebesgue = \End -> var <$> pushIntegrate P.negativeInfinity P.infinity
270
expectMeasureOp Lebesgue = \End -> var <$> pushIntegrate P.negativeInfinity P.infinity
90
false
true
0
14
67
112
55
57
null
null
uuhan/Idris-dev
src/IRTS/JavaScript/Codegen.hs
bsd-3-clause
getConsId :: Name -> State CGBodyState (Int, Int) getConsId n = do st <- get case Map.lookup n (defs st) of Just (LConstructor _ conId arity) -> pure (conId, arity) _ -> error $ "Internal JS Backend error " ++ showCG n ++ " is not a constructor."
278
getConsId :: Name -> State CGBodyState (Int, Int) getConsId n = do st <- get case Map.lookup n (defs st) of Just (LConstructor _ conId arity) -> pure (conId, arity) _ -> error $ "Internal JS Backend error " ++ showCG n ++ " is not a constructor."
278
getConsId n = do st <- get case Map.lookup n (defs st) of Just (LConstructor _ conId arity) -> pure (conId, arity) _ -> error $ "Internal JS Backend error " ++ showCG n ++ " is not a constructor."
228
false
true
0
12
79
105
51
54
null
null
DavidAlphaFox/ghc
utils/hsc2hs/UtilsCodegen.hs
bsd-3-clause
withUtilsObject :: Config -> FilePath -> FilePath -> (FilePath -> IO a) -> IO a withUtilsObject config outDir outBase f = do let beVerbose = cVerbose config flags = cFlags config possiblyRemove = if cKeepFiles config then flip const else finallyRemove cUtilsName = outDir ++ outBase ++ "_hsc_utils.c" oUtilsName = outDir ++ outBase ++ "_hsc_utils.o" possiblyRemove cUtilsName $ do writeBinaryFile cUtilsName $ unlines $ ["#include <stddef.h>", "#include <string.h>", "#include <stdio.h>", "#include <stdarg.h>", "#include <ctype.h>", "", outTemplateHeaderCProg (cTemplate config), "", "int hsc_printf(const char *format, ...) {", " int r;", " va_list argp;", " va_start(argp, format);", " r = vprintf(format, argp);", " va_end(argp);", " return r;", "}", "", "int hsc_toupper(int c) {", " return toupper(c);", "}", "", "int hsc_tolower(int c) {", " return tolower(c);", "}", "", "int hsc_putchar(int c) {", " return putchar(c);", "}", "", -- "void" should really be "FILE", but we aren't able to -- refer to "FILE" in template-hsc.h as we don't want to -- include <stdio.h> there. We cast to FILE * so as to -- allow compiling with g++. "int hsc_fputs(const char *s, void *stream) {", " return fputs(s, (FILE *)stream);", "}", "", -- "void" should really be "FILE", but we aren't able to -- refer to "FILE" in template-hsc.h as we don't want to -- include <stdio.h> there. We explicitly cast to void * -- to allow compiling with g++. "void *hsc_stdout(void) {", " return (void *)stdout;", "}" ] possiblyRemove oUtilsName $ do unless (cNoCompile config) $ rawSystemL ("compiling " ++ cUtilsName) beVerbose (cCompiler config) (["-c", cUtilsName, "-o", oUtilsName] ++ [cFlag | CompFlag cFlag <- flags]) f oUtilsName
2,616
withUtilsObject :: Config -> FilePath -> FilePath -> (FilePath -> IO a) -> IO a withUtilsObject config outDir outBase f = do let beVerbose = cVerbose config flags = cFlags config possiblyRemove = if cKeepFiles config then flip const else finallyRemove cUtilsName = outDir ++ outBase ++ "_hsc_utils.c" oUtilsName = outDir ++ outBase ++ "_hsc_utils.o" possiblyRemove cUtilsName $ do writeBinaryFile cUtilsName $ unlines $ ["#include <stddef.h>", "#include <string.h>", "#include <stdio.h>", "#include <stdarg.h>", "#include <ctype.h>", "", outTemplateHeaderCProg (cTemplate config), "", "int hsc_printf(const char *format, ...) {", " int r;", " va_list argp;", " va_start(argp, format);", " r = vprintf(format, argp);", " va_end(argp);", " return r;", "}", "", "int hsc_toupper(int c) {", " return toupper(c);", "}", "", "int hsc_tolower(int c) {", " return tolower(c);", "}", "", "int hsc_putchar(int c) {", " return putchar(c);", "}", "", -- "void" should really be "FILE", but we aren't able to -- refer to "FILE" in template-hsc.h as we don't want to -- include <stdio.h> there. We cast to FILE * so as to -- allow compiling with g++. "int hsc_fputs(const char *s, void *stream) {", " return fputs(s, (FILE *)stream);", "}", "", -- "void" should really be "FILE", but we aren't able to -- refer to "FILE" in template-hsc.h as we don't want to -- include <stdio.h> there. We explicitly cast to void * -- to allow compiling with g++. "void *hsc_stdout(void) {", " return (void *)stdout;", "}" ] possiblyRemove oUtilsName $ do unless (cNoCompile config) $ rawSystemL ("compiling " ++ cUtilsName) beVerbose (cCompiler config) (["-c", cUtilsName, "-o", oUtilsName] ++ [cFlag | CompFlag cFlag <- flags]) f oUtilsName
2,616
withUtilsObject config outDir outBase f = do let beVerbose = cVerbose config flags = cFlags config possiblyRemove = if cKeepFiles config then flip const else finallyRemove cUtilsName = outDir ++ outBase ++ "_hsc_utils.c" oUtilsName = outDir ++ outBase ++ "_hsc_utils.o" possiblyRemove cUtilsName $ do writeBinaryFile cUtilsName $ unlines $ ["#include <stddef.h>", "#include <string.h>", "#include <stdio.h>", "#include <stdarg.h>", "#include <ctype.h>", "", outTemplateHeaderCProg (cTemplate config), "", "int hsc_printf(const char *format, ...) {", " int r;", " va_list argp;", " va_start(argp, format);", " r = vprintf(format, argp);", " va_end(argp);", " return r;", "}", "", "int hsc_toupper(int c) {", " return toupper(c);", "}", "", "int hsc_tolower(int c) {", " return tolower(c);", "}", "", "int hsc_putchar(int c) {", " return putchar(c);", "}", "", -- "void" should really be "FILE", but we aren't able to -- refer to "FILE" in template-hsc.h as we don't want to -- include <stdio.h> there. We cast to FILE * so as to -- allow compiling with g++. "int hsc_fputs(const char *s, void *stream) {", " return fputs(s, (FILE *)stream);", "}", "", -- "void" should really be "FILE", but we aren't able to -- refer to "FILE" in template-hsc.h as we don't want to -- include <stdio.h> there. We explicitly cast to void * -- to allow compiling with g++. "void *hsc_stdout(void) {", " return (void *)stdout;", "}" ] possiblyRemove oUtilsName $ do unless (cNoCompile config) $ rawSystemL ("compiling " ++ cUtilsName) beVerbose (cCompiler config) (["-c", cUtilsName, "-o", oUtilsName] ++ [cFlag | CompFlag cFlag <- flags]) f oUtilsName
2,504
false
true
0
20
1,165
350
194
156
null
null
haskell-ro/hs-dicebot
DBParser.hs
bsd-3-clause
parseCmd :: String -> DiceBotCmd parseCmd s = case parse cmd "(unknown)" s of Right c -> c _ -> None
110
parseCmd :: String -> DiceBotCmd parseCmd s = case parse cmd "(unknown)" s of Right c -> c _ -> None
110
parseCmd s = case parse cmd "(unknown)" s of Right c -> c _ -> None
77
false
true
0
8
30
44
21
23
null
null
Gabriel439/Haskell-Dhall-Library
dhall/src/Dhall/Parser/Token.hs
bsd-3-clause
{-| Parse the @showConstructor@ keyword This corresponds to the @showConstructor@ rule from the official grammar -} _showConstructor :: Parser () _showConstructor = keyword "showConstructor"
195
_showConstructor :: Parser () _showConstructor = keyword "showConstructor"
74
_showConstructor = keyword "showConstructor"
44
true
true
1
6
28
23
10
13
null
null
nevrenato/HetsAlloy
THF/Sign.hs
gpl-2.0
eitherMapHasDiagnosis :: EitherMap c x -> Bool eitherMapHasDiagnosis = Map.fold (\ a b -> case a of Right _ -> True _ -> b ) False
138
eitherMapHasDiagnosis :: EitherMap c x -> Bool eitherMapHasDiagnosis = Map.fold (\ a b -> case a of Right _ -> True _ -> b ) False
138
eitherMapHasDiagnosis = Map.fold (\ a b -> case a of Right _ -> True _ -> b ) False
91
false
true
0
11
33
64
29
35
null
null
jgm/texmath
src/Text/TeXMath/Readers/TeX/Macros.hs
gpl-2.0
pMacroDefinitions :: (Monad m, Stream s m Char) => ParsecT s st m ([Macro], s) pMacroDefinitions = do pSkipSpaceComments defs <- sepEndBy pMacroDefinition pSkipSpaceComments rest <- getInput return (reverse defs, rest) -- reversed so later macros shadow earlier -- | Parses a @\\newcommand@ or @\\renewcommand@ macro definition and -- returns a 'Macro'.
381
pMacroDefinitions :: (Monad m, Stream s m Char) => ParsecT s st m ([Macro], s) pMacroDefinitions = do pSkipSpaceComments defs <- sepEndBy pMacroDefinition pSkipSpaceComments rest <- getInput return (reverse defs, rest) -- reversed so later macros shadow earlier -- | Parses a @\\newcommand@ or @\\renewcommand@ macro definition and -- returns a 'Macro'.
381
pMacroDefinitions = do pSkipSpaceComments defs <- sepEndBy pMacroDefinition pSkipSpaceComments rest <- getInput return (reverse defs, rest) -- reversed so later macros shadow earlier -- | Parses a @\\newcommand@ or @\\renewcommand@ macro definition and -- returns a 'Macro'.
284
false
true
0
9
79
88
45
43
null
null
brendanhay/gogol
gogol-cloudsearch/gen/Network/Google/CloudSearch/Types/Product.hs
mpl-2.0
-- | The name of the top-level property as defined in a property definition -- for the object. If the name is not a defined property in the schema, an -- error is given when attempting to update the schema. dpPropertyName :: Lens' DisplayedProperty (Maybe Text) dpPropertyName = lens _dpPropertyName (\ s a -> s{_dpPropertyName = a})
341
dpPropertyName :: Lens' DisplayedProperty (Maybe Text) dpPropertyName = lens _dpPropertyName (\ s a -> s{_dpPropertyName = a})
134
dpPropertyName = lens _dpPropertyName (\ s a -> s{_dpPropertyName = a})
79
true
true
1
9
64
54
27
27
null
null
vikraman/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
eqCanRewriteFR _ _ = False
56
eqCanRewriteFR _ _ = False
56
eqCanRewriteFR _ _ = False
56
false
false
1
5
34
12
5
7
null
null
nikita-volkov/refined
src/Refined.hs
mit
-- | Constructs a 'Refined' value at run-time, -- calling 'Control.Monad.Error.throwError' if the value -- does not satisfy the predicate. -- -- @since 0.2.0.0 refineError :: (Predicate p x, MonadError RefineException m) => x -> m (Refined p x) refineError = refine .> either MonadError.throwError pure
320
refineError :: (Predicate p x, MonadError RefineException m) => x -> m (Refined p x) refineError = refine .> either MonadError.throwError pure
154
refineError = refine .> either MonadError.throwError pure
57
true
true
2
10
63
70
35
35
null
null
agocorona/RefSerialize
Data/RefSerialize/Parser.hs
bsd-3-clause
oneOf xs= STR(\(StatR(cs,s,v)) -> if null s then Left (Error $ unexpectedEndOfInput) else let c= head s in if c `Prelude.elem` xs then Right(StatR(cs,tail s,v), c) else Left (Error ( "expected digit at the head of " ++ unpack s )))
283
oneOf xs= STR(\(StatR(cs,s,v)) -> if null s then Left (Error $ unexpectedEndOfInput) else let c= head s in if c `Prelude.elem` xs then Right(StatR(cs,tail s,v), c) else Left (Error ( "expected digit at the head of " ++ unpack s )))
283
oneOf xs= STR(\(StatR(cs,s,v)) -> if null s then Left (Error $ unexpectedEndOfInput) else let c= head s in if c `Prelude.elem` xs then Right(StatR(cs,tail s,v), c) else Left (Error ( "expected digit at the head of " ++ unpack s )))
283
false
false
1
17
92
134
68
66
null
null
adept/hledger
hledger-lib/Hledger/Data/Amount.hs
gpl-3.0
-- A 'Commodity' is a symbol representing a currency or some other kind of -- thing we are tracking, and some display preferences that tell how to -- display 'Amount's of the commodity - is the symbol on the left or right, -- are thousands separated by comma, significant decimal places and so on. -- | Show space-containing commodity symbols quoted, as they are in a journal. showCommoditySymbol :: T.Text -> T.Text showCommoditySymbol = textQuoteIfNeeded
457
showCommoditySymbol :: T.Text -> T.Text showCommoditySymbol = textQuoteIfNeeded
79
showCommoditySymbol = textQuoteIfNeeded
39
true
true
0
6
75
24
15
9
null
null
zc1036/Compiler-project
src/LIR.hs
gpl-3.0
astToLIR state (P.TAssign { P.tavar=n@(P.TName { P.tsrepr }), P.tavalue }) = let (_, (Just namereg, [])) = astToLIR state n (newstate, (Just valreg, valinstrs)) = astToLIR state tavalue in (state ↖ newstate, (Just namereg, valinstrs ++ [Move namereg valreg]))
275
astToLIR state (P.TAssign { P.tavar=n@(P.TName { P.tsrepr }), P.tavalue }) = let (_, (Just namereg, [])) = astToLIR state n (newstate, (Just valreg, valinstrs)) = astToLIR state tavalue in (state ↖ newstate, (Just namereg, valinstrs ++ [Move namereg valreg]))
275
astToLIR state (P.TAssign { P.tavar=n@(P.TName { P.tsrepr }), P.tavalue }) = let (_, (Just namereg, [])) = astToLIR state n (newstate, (Just valreg, valinstrs)) = astToLIR state tavalue in (state ↖ newstate, (Just namereg, valinstrs ++ [Move namereg valreg]))
275
false
false
0
14
54
139
74
65
null
null
candu/haskellbook
ch5/typeKwonDo.hs
mit
:: X -> Z xz = undefined
24
:: X -> Z xz = undefined
24
:: X -> Z xz = undefined
24
false
false
0
7
6
19
8
11
null
null
jship/metronome
local_deps/netwire/Control/Wire/Core.hs
bsd-3-clause
-- | Evaluate the input signal using the given 'Strategy' here. This -- wire evaluates only produced values. -- -- * Depends: now. evalWith :: Strategy a -> Wire s e m a a evalWith s = WArr $ \mx -> case mx of Right x -> (x `using` s) `seq` mx Left _ -> mx -- | Force the input signal to WHNF here. This wire forces both -- produced values and inhibition values. -- -- * Depends: now.
422
evalWith :: Strategy a -> Wire s e m a a evalWith s = WArr $ \mx -> case mx of Right x -> (x `using` s) `seq` mx Left _ -> mx -- | Force the input signal to WHNF here. This wire forces both -- produced values and inhibition values. -- -- * Depends: now.
289
evalWith s = WArr $ \mx -> case mx of Right x -> (x `using` s) `seq` mx Left _ -> mx -- | Force the input signal to WHNF here. This wire forces both -- produced values and inhibition values. -- -- * Depends: now.
248
true
true
0
12
117
86
48
38
null
null
anton-k/sharc-timbre
src/Sharc/Instruments/ViolinPizzicato.hs
bsd-3-clause
note16 :: Note note16 = Note (Pitch 493.883 59 "b4") 17 (Range (NoteRange (NoteRangeAmplitude 9383.77 19 0.16) (NoteRangeHarmonicFreq 1 493.88)) (NoteRange (NoteRangeAmplitude 493.88 1 10004.0) (NoteRangeHarmonicFreq 20 9877.66))) [Harmonic 1 (-2.219) 10004.0 ,Harmonic 2 (-1.81) 9544.2 ,Harmonic 3 (-1.714) 2650.38 ,Harmonic 4 (-2.743) 366.66 ,Harmonic 5 (-1.142) 1004.32 ,Harmonic 6 0.416 1230.52 ,Harmonic 7 (-0.888) 102.32 ,Harmonic 8 (-0.996) 330.6 ,Harmonic 9 2.847 382.97 ,Harmonic 10 (-0.152) 108.19 ,Harmonic 11 (-2.389) 52.63 ,Harmonic 12 (-0.489) 59.5 ,Harmonic 13 2.758 7.47 ,Harmonic 14 (-1.121) 16.13 ,Harmonic 15 (-8.1e-2) 8.62 ,Harmonic 16 1.925 7.12 ,Harmonic 17 0.276 10.65 ,Harmonic 18 9.6e-2 2.4 ,Harmonic 19 (-1.726) 0.16 ,Harmonic 20 3.116 3.99]
923
note16 :: Note note16 = Note (Pitch 493.883 59 "b4") 17 (Range (NoteRange (NoteRangeAmplitude 9383.77 19 0.16) (NoteRangeHarmonicFreq 1 493.88)) (NoteRange (NoteRangeAmplitude 493.88 1 10004.0) (NoteRangeHarmonicFreq 20 9877.66))) [Harmonic 1 (-2.219) 10004.0 ,Harmonic 2 (-1.81) 9544.2 ,Harmonic 3 (-1.714) 2650.38 ,Harmonic 4 (-2.743) 366.66 ,Harmonic 5 (-1.142) 1004.32 ,Harmonic 6 0.416 1230.52 ,Harmonic 7 (-0.888) 102.32 ,Harmonic 8 (-0.996) 330.6 ,Harmonic 9 2.847 382.97 ,Harmonic 10 (-0.152) 108.19 ,Harmonic 11 (-2.389) 52.63 ,Harmonic 12 (-0.489) 59.5 ,Harmonic 13 2.758 7.47 ,Harmonic 14 (-1.121) 16.13 ,Harmonic 15 (-8.1e-2) 8.62 ,Harmonic 16 1.925 7.12 ,Harmonic 17 0.276 10.65 ,Harmonic 18 9.6e-2 2.4 ,Harmonic 19 (-1.726) 0.16 ,Harmonic 20 3.116 3.99]
923
note16 = Note (Pitch 493.883 59 "b4") 17 (Range (NoteRange (NoteRangeAmplitude 9383.77 19 0.16) (NoteRangeHarmonicFreq 1 493.88)) (NoteRange (NoteRangeAmplitude 493.88 1 10004.0) (NoteRangeHarmonicFreq 20 9877.66))) [Harmonic 1 (-2.219) 10004.0 ,Harmonic 2 (-1.81) 9544.2 ,Harmonic 3 (-1.714) 2650.38 ,Harmonic 4 (-2.743) 366.66 ,Harmonic 5 (-1.142) 1004.32 ,Harmonic 6 0.416 1230.52 ,Harmonic 7 (-0.888) 102.32 ,Harmonic 8 (-0.996) 330.6 ,Harmonic 9 2.847 382.97 ,Harmonic 10 (-0.152) 108.19 ,Harmonic 11 (-2.389) 52.63 ,Harmonic 12 (-0.489) 59.5 ,Harmonic 13 2.758 7.47 ,Harmonic 14 (-1.121) 16.13 ,Harmonic 15 (-8.1e-2) 8.62 ,Harmonic 16 1.925 7.12 ,Harmonic 17 0.276 10.65 ,Harmonic 18 9.6e-2 2.4 ,Harmonic 19 (-1.726) 0.16 ,Harmonic 20 3.116 3.99]
908
false
true
0
11
263
355
184
171
null
null
svenssonjoel/EmbArBB
Intel/ArBB/Language.hs
bsd-3-clause
eltCoord3D = getEltCoord
24
eltCoord3D = getEltCoord
24
eltCoord3D = getEltCoord
24
false
false
0
4
2
6
3
3
null
null
energyflowanalysis/efa-2.1
src/EFA/Graph/Topology/StateAnalysis.hs
bsd-3-clause
setCoverUndirEdges, setCoverDirEdges :: (Node.C node) => Topology node -> [SetCover.Assign [Graph.EitherEdge node] (Set (SetCoverItem node))] setCoverUndirEdges topo = Map.elems $ Map.mapWithKey (\e _ -> SetCover.assign [Graph.eUndirEdge (Graph.from e) (Graph.to e)] (Set.fromList [SetCoverEdge e Topo.In, SetCoverEdge e Topo.Out])) $ Graph.edgeLabels topo
413
setCoverUndirEdges, setCoverDirEdges :: (Node.C node) => Topology node -> [SetCover.Assign [Graph.EitherEdge node] (Set (SetCoverItem node))] setCoverUndirEdges topo = Map.elems $ Map.mapWithKey (\e _ -> SetCover.assign [Graph.eUndirEdge (Graph.from e) (Graph.to e)] (Set.fromList [SetCoverEdge e Topo.In, SetCoverEdge e Topo.Out])) $ Graph.edgeLabels topo
413
setCoverUndirEdges topo = Map.elems $ Map.mapWithKey (\e _ -> SetCover.assign [Graph.eUndirEdge (Graph.from e) (Graph.to e)] (Set.fromList [SetCoverEdge e Topo.In, SetCoverEdge e Topo.Out])) $ Graph.edgeLabels topo
262
false
true
0
13
96
155
78
77
null
null
jvictor0/JoSQL
CodeGen/Metadata/Metadata.hs
mit
dbToken (SimpleSubInstanceMetadata _ _ _ _ _ _) = SimpleSubInstanceToken
72
dbToken (SimpleSubInstanceMetadata _ _ _ _ _ _) = SimpleSubInstanceToken
72
dbToken (SimpleSubInstanceMetadata _ _ _ _ _ _) = SimpleSubInstanceToken
72
false
false
0
7
9
25
12
13
null
null
literate-unitb/literate-unitb
src/UnitB/Event.hs
mit
ba_pred (BcmIn v e) = Word (prime v) `zelemUnchecked` getExpr e
64
ba_pred (BcmIn v e) = Word (prime v) `zelemUnchecked` getExpr e
64
ba_pred (BcmIn v e) = Word (prime v) `zelemUnchecked` getExpr e
64
false
false
0
7
11
36
17
19
null
null
byorgey/Idris-dev
src/Core/ProofState.hs
bsd-3-clause
eval_in :: Raw -> RunTactic eval_in t ctxt env tm = do (val, valty) <- lift $ check ctxt env t let val' = normalise ctxt env val let valty' = normalise ctxt env valty addLog (showEnv env val ++ " : " ++ showEnv env valty ++ -- " in " ++ show env ++ " ==>\n " ++ showEnv env val' ++ " : " ++ showEnv env valty') return tm
437
eval_in :: Raw -> RunTactic eval_in t ctxt env tm = do (val, valty) <- lift $ check ctxt env t let val' = normalise ctxt env val let valty' = normalise ctxt env valty addLog (showEnv env val ++ " : " ++ showEnv env valty ++ -- " in " ++ show env ++ " ==>\n " ++ showEnv env val' ++ " : " ++ showEnv env valty') return tm
437
eval_in t ctxt env tm = do (val, valty) <- lift $ check ctxt env t let val' = normalise ctxt env val let valty' = normalise ctxt env valty addLog (showEnv env val ++ " : " ++ showEnv env valty ++ -- " in " ++ show env ++ " ==>\n " ++ showEnv env val' ++ " : " ++ showEnv env valty') return tm
409
false
true
1
10
189
127
63
64
null
null
LightAndLight/hindley-milner
src/Phil/Core/Kinds.hs
bsd-3-clause
freshKindVar :: MonadFresh m => m Kind freshKindVar = KindVar . Ident . ("k" <>) <$> fresh
90
freshKindVar :: MonadFresh m => m Kind freshKindVar = KindVar . Ident . ("k" <>) <$> fresh
90
freshKindVar = KindVar . Ident . ("k" <>) <$> fresh
51
false
true
0
7
16
37
19
18
null
null
elieux/ghc
compiler/cmm/PprCmmDecl.hs
bsd-3-clause
pprSection :: Section -> SDoc pprSection (Section t suffix) = section <+> doubleQuotes (pprSectionType t <+> char '.' <+> ppr suffix) where section = ptext (sLit "section")
180
pprSection :: Section -> SDoc pprSection (Section t suffix) = section <+> doubleQuotes (pprSectionType t <+> char '.' <+> ppr suffix) where section = ptext (sLit "section")
180
pprSection (Section t suffix) = section <+> doubleQuotes (pprSectionType t <+> char '.' <+> ppr suffix) where section = ptext (sLit "section")
150
false
true
3
9
34
80
34
46
null
null
asr/apia
src/Apia/Options.hs
mit
ithZ3Opt name opts = Right opts { optWithZ3 = name }
53
withZ3Opt name opts = Right opts { optWithZ3 = name }
53
withZ3Opt name opts = Right opts { optWithZ3 = name }
53
false
false
1
6
11
29
12
17
null
null
urbanslug/ghc
utils/hpc/HpcOverlay.hs
bsd-3-clause
concatSpec :: [Spec] -> Spec concatSpec = foldr (\ (Spec pre1 body1) (Spec pre2 body2) -> Spec (pre1 ++ pre2) (body1 ++ body2)) (Spec [] [])
192
concatSpec :: [Spec] -> Spec concatSpec = foldr (\ (Spec pre1 body1) (Spec pre2 body2) -> Spec (pre1 ++ pre2) (body1 ++ body2)) (Spec [] [])
192
concatSpec = foldr (\ (Spec pre1 body1) (Spec pre2 body2) -> Spec (pre1 ++ pre2) (body1 ++ body2)) (Spec [] [])
163
false
true
0
9
77
87
43
44
null
null
Drezil/FFF
Application.hs
apache-2.0
-- | For yesod devel, return the Warp settings and WAI Application. getApplicationDev :: IO (Settings, Application) getApplicationDev = do settings <- getAppSettings foundation <- makeFoundation settings wsettings <- getDevSettings $ warpSettings foundation app <- makeApplication foundation return (wsettings, app)
335
getApplicationDev :: IO (Settings, Application) getApplicationDev = do settings <- getAppSettings foundation <- makeFoundation settings wsettings <- getDevSettings $ warpSettings foundation app <- makeApplication foundation return (wsettings, app)
267
getApplicationDev = do settings <- getAppSettings foundation <- makeFoundation settings wsettings <- getDevSettings $ warpSettings foundation app <- makeApplication foundation return (wsettings, app)
219
true
true
0
10
59
80
36
44
null
null
SwiftsNamesake/ALUT
src/Sound/ALUT/Loaders.hs
bsd-3-clause
loadMemoryWaveform :: ALenum -> Float -> Float -> Float -> Ptr ALenum -> Ptr ALsizei -> Ptr ALfloat -> IO (Ptr b) loadMemoryWaveform w f p d = alut_LoadMemoryWaveform w (realToFrac f) (realToFrac p) (realToFrac d)
216
loadMemoryWaveform :: ALenum -> Float -> Float -> Float -> Ptr ALenum -> Ptr ALsizei -> Ptr ALfloat -> IO (Ptr b) loadMemoryWaveform w f p d = alut_LoadMemoryWaveform w (realToFrac f) (realToFrac p) (realToFrac d)
216
loadMemoryWaveform w f p d = alut_LoadMemoryWaveform w (realToFrac f) (realToFrac p) (realToFrac d)
102
false
true
0
14
38
93
44
49
null
null
anttisalonen/economics
src/UtilityTree.hs
mit
f :: UtilityTree -> MiddleTree f t@(NodeR (n, u) l r) = NodeR (n, u, p) (f l) (f r) where p = getPrice t
106
f :: UtilityTree -> MiddleTree f t@(NodeR (n, u) l r) = NodeR (n, u, p) (f l) (f r) where p = getPrice t
106
f t@(NodeR (n, u) l r) = NodeR (n, u, p) (f l) (f r) where p = getPrice t
75
false
true
1
9
26
83
41
42
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/WebGLRenderingContextBase.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContextBase.isFramebuffer Mozilla WebGLRenderingContextBase.isFramebuffer documentation> isFramebuffer :: (MonadDOM m, IsWebGLRenderingContextBase self) => self -> Maybe WebGLFramebuffer -> m GLboolean isFramebuffer self framebuffer = liftDOM (((toWebGLRenderingContextBase self) ^. jsf "isFramebuffer" [toJSVal framebuffer]) >>= fromJSValUnchecked)
476
isFramebuffer :: (MonadDOM m, IsWebGLRenderingContextBase self) => self -> Maybe WebGLFramebuffer -> m GLboolean isFramebuffer self framebuffer = liftDOM (((toWebGLRenderingContextBase self) ^. jsf "isFramebuffer" [toJSVal framebuffer]) >>= fromJSValUnchecked)
317
isFramebuffer self framebuffer = liftDOM (((toWebGLRenderingContextBase self) ^. jsf "isFramebuffer" [toJSVal framebuffer]) >>= fromJSValUnchecked)
174
true
true
0
12
91
85
41
44
null
null
jesserobertson/xmonad-conf
xmonad.hs
mit
{- Workspace navigation keybindings. This is probably the part of the configuration I have spent the most time messing with, but understand the least. Be very careful if messing with this section. -} -- We define two lists of keycodes for use in the rest of the -- keyboard configuration. The first is the list of numpad keys, -- in the order they occur on the keyboard (left to right and -- top to bottom). The second is the list of number keys, in an -- order corresponding to the numpad. We will use these to -- make workspace navigation commands work the same whether you -- use the numpad or the top-row number keys. And, we also -- use them to figure out where to go when the user -- uses the arrow keys. numPadKeys = [ xK_KP_Home, xK_KP_Up, xK_KP_Page_Up , xK_KP_Left, xK_KP_Begin,xK_KP_Right , xK_KP_End, xK_KP_Down, xK_KP_Page_Down , xK_KP_Insert, xK_KP_Delete, xK_KP_Enter ]
911
numPadKeys = [ xK_KP_Home, xK_KP_Up, xK_KP_Page_Up , xK_KP_Left, xK_KP_Begin,xK_KP_Right , xK_KP_End, xK_KP_Down, xK_KP_Page_Down , xK_KP_Insert, xK_KP_Delete, xK_KP_Enter ]
193
numPadKeys = [ xK_KP_Home, xK_KP_Up, xK_KP_Page_Up , xK_KP_Left, xK_KP_Begin,xK_KP_Right , xK_KP_End, xK_KP_Down, xK_KP_Page_Down , xK_KP_Insert, xK_KP_Delete, xK_KP_Enter ]
193
true
false
0
5
179
52
37
15
null
null
np/umm
UMMData.hs
gpl-3.0
-- This returns an integer which is the Julian day number at noon + eps, ie, -- an instant after it has incremented to a new (Julian) day. Inputs are -- 4-digit (or whatever is appropriate) year, month from 1 to 12, day from -- 1 to 28/31 as appropriate. -- -- Jan 1 2000 = 2451545 julianDate :: Date -> Int julianDate (Date y m d) = let a = quot (14 - m) 12 y1 = y + 4800 - a m1 = m + 12*a - 3 in d + quot (153*m1 + 2) 5 + 365*y1 + quot y1 4 + quot y1 400 - quot y1 100 - 32045
502
julianDate :: Date -> Int julianDate (Date y m d) = let a = quot (14 - m) 12 y1 = y + 4800 - a m1 = m + 12*a - 3 in d + quot (153*m1 + 2) 5 + 365*y1 + quot y1 4 + quot y1 400 - quot y1 100 - 32045
219
julianDate (Date y m d) = let a = quot (14 - m) 12 y1 = y + 4800 - a m1 = m + 12*a - 3 in d + quot (153*m1 + 2) 5 + 365*y1 + quot y1 4 + quot y1 400 - quot y1 100 - 32045
193
true
true
0
17
137
146
75
71
null
null
rvion/lamdu
Lamdu/GUI/ExpressionEdit/ListEdit.hs
gpl-3.0
lastLens :: Lens.Traversal' [a] a lastLens = Lens.taking 1 . Lens.backwards $ Lens.traversed
92
lastLens :: Lens.Traversal' [a] a lastLens = Lens.taking 1 . Lens.backwards $ Lens.traversed
92
lastLens = Lens.taking 1 . Lens.backwards $ Lens.traversed
58
false
true
1
7
12
45
20
25
null
null
SeanRBurton/aeson
Data/Aeson/TH.hs
bsd-3-clause
argsToEncoding opts multiCons (RecC conName ts) = case (unwrapUnaryRecords opts, not multiCons, ts) of (True,True,[(_,st,ty)]) -> argsToEncoding opts multiCons (NormalC conName [(st,ty)]) _ -> do args <- mapM newName ["arg" ++ show n | (_, n) <- zip ts [1 :: Integer ..]] let exp = object objBody objBody = [|mconcat|] `appE` ([|intersperse (E.char7 ',')|] `appE` pairs) pairs | omitNothingFields opts = infixApp maybeFields [|(<>)|] restFields | otherwise = listE (map toPair argCons) argCons = zip args ts maybeFields = [|catMaybes|] `appE` listE (map maybeToPair maybes) restFields = listE (map toPair rest) (maybes, rest) = partition isMaybe argCons maybeToPair (arg, (field, _, _)) = infixApp (infixE (Just $ toFieldName field) [|(.=)|] Nothing) [|(<$>)|] (varE arg) toPair (arg, (field, _, _)) = toFieldName field <:> [|E.builder|] `appE` varE arg toFieldName field = [|E.text|] `appE` ([|T.pack|] `appE` fieldLabelExp opts field) match (conP conName $ map varP args) ( normalB $ if multiCons then case sumEncoding opts of TwoElemArray -> array $ encStr opts conName <%> [|fromEncoding|] `appE` exp TaggedObject{tagFieldName} -> object $ ([|E.text (T.pack tagFieldName)|] <:> encStr opts conName) <%> objBody ObjectWithSingleField -> object $ encStr opts conName <:> [|fromEncoding|] `appE` exp else exp ) [] -- Infix constructors.
1,935
argsToEncoding opts multiCons (RecC conName ts) = case (unwrapUnaryRecords opts, not multiCons, ts) of (True,True,[(_,st,ty)]) -> argsToEncoding opts multiCons (NormalC conName [(st,ty)]) _ -> do args <- mapM newName ["arg" ++ show n | (_, n) <- zip ts [1 :: Integer ..]] let exp = object objBody objBody = [|mconcat|] `appE` ([|intersperse (E.char7 ',')|] `appE` pairs) pairs | omitNothingFields opts = infixApp maybeFields [|(<>)|] restFields | otherwise = listE (map toPair argCons) argCons = zip args ts maybeFields = [|catMaybes|] `appE` listE (map maybeToPair maybes) restFields = listE (map toPair rest) (maybes, rest) = partition isMaybe argCons maybeToPair (arg, (field, _, _)) = infixApp (infixE (Just $ toFieldName field) [|(.=)|] Nothing) [|(<$>)|] (varE arg) toPair (arg, (field, _, _)) = toFieldName field <:> [|E.builder|] `appE` varE arg toFieldName field = [|E.text|] `appE` ([|T.pack|] `appE` fieldLabelExp opts field) match (conP conName $ map varP args) ( normalB $ if multiCons then case sumEncoding opts of TwoElemArray -> array $ encStr opts conName <%> [|fromEncoding|] `appE` exp TaggedObject{tagFieldName} -> object $ ([|E.text (T.pack tagFieldName)|] <:> encStr opts conName) <%> objBody ObjectWithSingleField -> object $ encStr opts conName <:> [|fromEncoding|] `appE` exp else exp ) [] -- Infix constructors.
1,935
argsToEncoding opts multiCons (RecC conName ts) = case (unwrapUnaryRecords opts, not multiCons, ts) of (True,True,[(_,st,ty)]) -> argsToEncoding opts multiCons (NormalC conName [(st,ty)]) _ -> do args <- mapM newName ["arg" ++ show n | (_, n) <- zip ts [1 :: Integer ..]] let exp = object objBody objBody = [|mconcat|] `appE` ([|intersperse (E.char7 ',')|] `appE` pairs) pairs | omitNothingFields opts = infixApp maybeFields [|(<>)|] restFields | otherwise = listE (map toPair argCons) argCons = zip args ts maybeFields = [|catMaybes|] `appE` listE (map maybeToPair maybes) restFields = listE (map toPair rest) (maybes, rest) = partition isMaybe argCons maybeToPair (arg, (field, _, _)) = infixApp (infixE (Just $ toFieldName field) [|(.=)|] Nothing) [|(<$>)|] (varE arg) toPair (arg, (field, _, _)) = toFieldName field <:> [|E.builder|] `appE` varE arg toFieldName field = [|E.text|] `appE` ([|T.pack|] `appE` fieldLabelExp opts field) match (conP conName $ map varP args) ( normalB $ if multiCons then case sumEncoding opts of TwoElemArray -> array $ encStr opts conName <%> [|fromEncoding|] `appE` exp TaggedObject{tagFieldName} -> object $ ([|E.text (T.pack tagFieldName)|] <:> encStr opts conName) <%> objBody ObjectWithSingleField -> object $ encStr opts conName <:> [|fromEncoding|] `appE` exp else exp ) [] -- Infix constructors.
1,935
false
false
0
21
794
574
319
255
null
null
nevrenato/Hets_Fork
GUI/hets_cgi.hs
gpl-2.0
-- link to the hetcasl.sty file hetcaslStyUrl :: String hetcaslStyUrl = hetsUrl ++ "hetcasl.sty"
96
hetcaslStyUrl :: String hetcaslStyUrl = hetsUrl ++ "hetcasl.sty"
64
hetcaslStyUrl = hetsUrl ++ "hetcasl.sty"
40
true
true
2
6
13
24
10
14
null
null
JohnLato/impulse
src/Reactive/Impulse/Internal/Chain.hs
lgpl-3.0
removeEdges :: ChainEdgeMap -> Chain r a -> Chain r a removeEdges chainMap' chain = f chain where chainMap = chainMap'^.from chainEdgeMap fromSet = IM.keysSet chainMap toSet fromLbl = IM.lookup fromLbl chainMap^._Just pruneNode :: Label -> ChainNode (Chain r x) -> ChainNode (Chain r x) pruneNode fromLbl cn -- pushing from fromSet, so we remove all children that match toSet -- and descend into remaining children. | IntSet.member fromLbl fromSet = alterChildren cn (map f . filter (\x -> IntSet.notMember (x^.label) (toSet fromLbl))) | not . IntSet.null $ cn^.cnPushSet.to (IntSet.intersection fromSet) = alterChildren cn (map f) | otherwise = cn f :: Chain r x -> Chain r x f c = case c of (CEvent lbl cn) -> CEvent lbl (pruneNode lbl cn) (CMap lbl mf cn) -> CMap lbl mf (pruneNode lbl cn) (CSwchE lbl prevSet a cn) -> CSwchE lbl prevSet a (pruneNode lbl cn) (CApply lbl beh cn) -> CApply lbl beh (pruneNode lbl cn) _ -> c
1,032
removeEdges :: ChainEdgeMap -> Chain r a -> Chain r a removeEdges chainMap' chain = f chain where chainMap = chainMap'^.from chainEdgeMap fromSet = IM.keysSet chainMap toSet fromLbl = IM.lookup fromLbl chainMap^._Just pruneNode :: Label -> ChainNode (Chain r x) -> ChainNode (Chain r x) pruneNode fromLbl cn -- pushing from fromSet, so we remove all children that match toSet -- and descend into remaining children. | IntSet.member fromLbl fromSet = alterChildren cn (map f . filter (\x -> IntSet.notMember (x^.label) (toSet fromLbl))) | not . IntSet.null $ cn^.cnPushSet.to (IntSet.intersection fromSet) = alterChildren cn (map f) | otherwise = cn f :: Chain r x -> Chain r x f c = case c of (CEvent lbl cn) -> CEvent lbl (pruneNode lbl cn) (CMap lbl mf cn) -> CMap lbl mf (pruneNode lbl cn) (CSwchE lbl prevSet a cn) -> CSwchE lbl prevSet a (pruneNode lbl cn) (CApply lbl beh cn) -> CApply lbl beh (pruneNode lbl cn) _ -> c
1,032
removeEdges chainMap' chain = f chain where chainMap = chainMap'^.from chainEdgeMap fromSet = IM.keysSet chainMap toSet fromLbl = IM.lookup fromLbl chainMap^._Just pruneNode :: Label -> ChainNode (Chain r x) -> ChainNode (Chain r x) pruneNode fromLbl cn -- pushing from fromSet, so we remove all children that match toSet -- and descend into remaining children. | IntSet.member fromLbl fromSet = alterChildren cn (map f . filter (\x -> IntSet.notMember (x^.label) (toSet fromLbl))) | not . IntSet.null $ cn^.cnPushSet.to (IntSet.intersection fromSet) = alterChildren cn (map f) | otherwise = cn f :: Chain r x -> Chain r x f c = case c of (CEvent lbl cn) -> CEvent lbl (pruneNode lbl cn) (CMap lbl mf cn) -> CMap lbl mf (pruneNode lbl cn) (CSwchE lbl prevSet a cn) -> CSwchE lbl prevSet a (pruneNode lbl cn) (CApply lbl beh cn) -> CApply lbl beh (pruneNode lbl cn) _ -> c
978
false
true
1
12
268
410
196
214
null
null
ghc-android/ghc
testsuite/tests/ghci/should_run/ghcirun004.hs
bsd-3-clause
1305 = 1304
11
1305 = 1304
11
1305 = 1304
11
false
false
1
5
2
10
3
7
null
null
ganeti/ganeti
src/Ganeti/Locking/Locks.hs
bsd-2-clause
lockLevel (Network _) = LevelNetwork
36
lockLevel (Network _) = LevelNetwork
36
lockLevel (Network _) = LevelNetwork
36
false
false
0
6
4
16
7
9
null
null
moonKimura/vector-0.10.9.1
Data/Vector/Fusion/Stream/Monadic.hs
bsd-3-clause
null s = foldr (\_ _ -> False) True s
37
null s = foldr (\_ _ -> False) True s
37
null s = foldr (\_ _ -> False) True s
37
false
false
1
7
9
30
13
17
null
null
ghcjs/jsaddle-dom
src/JSDOM/Generated/History.hs
mit
-- | <https://developer.mozilla.org/en-US/docs/Web/API/History.go Mozilla History.go documentation> go :: (MonadDOM m) => History -> Maybe Int -> m () go self distance = liftDOM (void (self ^. jsf "go" [toJSVal distance]))
225
go :: (MonadDOM m) => History -> Maybe Int -> m () go self distance = liftDOM (void (self ^. jsf "go" [toJSVal distance]))
124
go self distance = liftDOM (void (self ^. jsf "go" [toJSVal distance]))
73
true
true
0
12
32
74
35
39
null
null
input-output-hk/pos-haskell-prototype
core/test/Test/Pos/Core/SafeCopy.hs
mit
golden_Address'6 :: Property golden_Address'6 = goldenTestSafeCopy exampleAddress'6 "test/golden/safecopy/Address'6_HasNetworkMagic"
152
golden_Address'6 :: Property golden_Address'6 = goldenTestSafeCopy exampleAddress'6 "test/golden/safecopy/Address'6_HasNetworkMagic"
152
golden_Address'6 = goldenTestSafeCopy exampleAddress'6 "test/golden/safecopy/Address'6_HasNetworkMagic"
123
false
true
0
6
27
24
9
15
null
null
SamirTalwar/advent-of-code
2016/AOC_01_1.hs
mit
decode "" = []
14
decode "" = []
14
decode "" = []
14
false
false
0
5
3
11
5
6
null
null
mcschroeder/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
tyCoVarsOfCtAcc (CFunEqCan { cc_tyargs = tys, cc_fsk = fsk }) = tyCoVarsOfTypesAcc tys `unionFV` oneVar fsk `unionFV` tyCoVarsOfTypeAcc (tyVarKind fsk)
153
tyCoVarsOfCtAcc (CFunEqCan { cc_tyargs = tys, cc_fsk = fsk }) = tyCoVarsOfTypesAcc tys `unionFV` oneVar fsk `unionFV` tyCoVarsOfTypeAcc (tyVarKind fsk)
153
tyCoVarsOfCtAcc (CFunEqCan { cc_tyargs = tys, cc_fsk = fsk }) = tyCoVarsOfTypesAcc tys `unionFV` oneVar fsk `unionFV` tyCoVarsOfTypeAcc (tyVarKind fsk)
153
false
false
0
9
21
54
29
25
null
null
gcampax/ghc
compiler/typecheck/TcRules.hs
bsd-3-clause
simplifyRule :: RuleName -> WantedConstraints -- Constraints from LHS -> WantedConstraints -- Constraints from RHS -> TcM ([EvVar], WantedConstraints) -- LHS evidence variables -- See Note [Simplifying RULE constraints] -- -- This function could be in TcSimplify, but that's a very big -- module and this is a small one. Moreover, it's easier to -- understand tcRule when you can see simplifyRule too simplifyRule name lhs_wanted rhs_wanted = do { -- We allow ourselves to unify environment -- variables: runTcS runs with topTcLevel (insoluble, _) <- runTcS $ do { -- First solve the LHS and *then* solve the RHS -- See Note [Solve order for RULES] lhs_resid <- solveWanteds lhs_wanted ; rhs_resid <- solveWanteds rhs_wanted ; return (insolubleWC lhs_resid || insolubleWC rhs_resid) } ; zonked_lhs_simples <- zonkSimples (wc_simple lhs_wanted) ; let (q_cts, non_q_cts) = partitionBag quantify_me zonked_lhs_simples quantify_me -- Note [RULE quantification over equalities] | insoluble = quantify_insol | otherwise = quantify_normal quantify_insol ct = not (isEqPred (ctPred ct)) quantify_normal ct | EqPred NomEq t1 t2 <- classifyPredType (ctPred ct) = not (t1 `tcEqType` t2) | otherwise = True ; traceTc "simplifyRule" $ vcat [ ptext (sLit "LHS of rule") <+> doubleQuotes (ftext name) , text "lhs_wantd" <+> ppr lhs_wanted , text "rhs_wantd" <+> ppr rhs_wanted , text "zonked_lhs_simples" <+> ppr zonked_lhs_simples , text "q_cts" <+> ppr q_cts , text "non_q_cts" <+> ppr non_q_cts ] ; return ( map (ctEvId . ctEvidence) (bagToList q_cts) , lhs_wanted { wc_simple = non_q_cts }) }
2,016
simplifyRule :: RuleName -> WantedConstraints -- Constraints from LHS -> WantedConstraints -- Constraints from RHS -> TcM ([EvVar], WantedConstraints) simplifyRule name lhs_wanted rhs_wanted = do { -- We allow ourselves to unify environment -- variables: runTcS runs with topTcLevel (insoluble, _) <- runTcS $ do { -- First solve the LHS and *then* solve the RHS -- See Note [Solve order for RULES] lhs_resid <- solveWanteds lhs_wanted ; rhs_resid <- solveWanteds rhs_wanted ; return (insolubleWC lhs_resid || insolubleWC rhs_resid) } ; zonked_lhs_simples <- zonkSimples (wc_simple lhs_wanted) ; let (q_cts, non_q_cts) = partitionBag quantify_me zonked_lhs_simples quantify_me -- Note [RULE quantification over equalities] | insoluble = quantify_insol | otherwise = quantify_normal quantify_insol ct = not (isEqPred (ctPred ct)) quantify_normal ct | EqPred NomEq t1 t2 <- classifyPredType (ctPred ct) = not (t1 `tcEqType` t2) | otherwise = True ; traceTc "simplifyRule" $ vcat [ ptext (sLit "LHS of rule") <+> doubleQuotes (ftext name) , text "lhs_wantd" <+> ppr lhs_wanted , text "rhs_wantd" <+> ppr rhs_wanted , text "zonked_lhs_simples" <+> ppr zonked_lhs_simples , text "q_cts" <+> ppr q_cts , text "non_q_cts" <+> ppr non_q_cts ] ; return ( map (ctEvId . ctEvidence) (bagToList q_cts) , lhs_wanted { wc_simple = non_q_cts }) }
1,763
simplifyRule name lhs_wanted rhs_wanted = do { -- We allow ourselves to unify environment -- variables: runTcS runs with topTcLevel (insoluble, _) <- runTcS $ do { -- First solve the LHS and *then* solve the RHS -- See Note [Solve order for RULES] lhs_resid <- solveWanteds lhs_wanted ; rhs_resid <- solveWanteds rhs_wanted ; return (insolubleWC lhs_resid || insolubleWC rhs_resid) } ; zonked_lhs_simples <- zonkSimples (wc_simple lhs_wanted) ; let (q_cts, non_q_cts) = partitionBag quantify_me zonked_lhs_simples quantify_me -- Note [RULE quantification over equalities] | insoluble = quantify_insol | otherwise = quantify_normal quantify_insol ct = not (isEqPred (ctPred ct)) quantify_normal ct | EqPred NomEq t1 t2 <- classifyPredType (ctPred ct) = not (t1 `tcEqType` t2) | otherwise = True ; traceTc "simplifyRule" $ vcat [ ptext (sLit "LHS of rule") <+> doubleQuotes (ftext name) , text "lhs_wantd" <+> ppr lhs_wanted , text "rhs_wantd" <+> ppr rhs_wanted , text "zonked_lhs_simples" <+> ppr zonked_lhs_simples , text "q_cts" <+> ppr q_cts , text "non_q_cts" <+> ppr non_q_cts ] ; return ( map (ctEvId . ctEvidence) (bagToList q_cts) , lhs_wanted { wc_simple = non_q_cts }) }
1,561
true
true
0
16
677
397
200
197
null
null
ezyang/ghc
compiler/nativeGen/X86/Regs.hs
bsd-3-clause
regNames :: Platform -> A.Array Int String regNames platform = if target32Bit platform then A.listArray (0,8) ["%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp", "%esp"] else A.listArray (0,8) ["%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", "%rbp", "%rsp"]
278
regNames :: Platform -> A.Array Int String regNames platform = if target32Bit platform then A.listArray (0,8) ["%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp", "%esp"] else A.listArray (0,8) ["%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", "%rbp", "%rsp"]
278
regNames platform = if target32Bit platform then A.listArray (0,8) ["%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp", "%esp"] else A.listArray (0,8) ["%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", "%rbp", "%rsp"]
235
false
true
0
7
50
110
64
46
null
null
urbanslug/ghc
compiler/utils/BooleanFormula.hs
bsd-3-clause
mkBool True = mkTrue
21
mkBool True = mkTrue
21
mkBool True = mkTrue
21
false
false
0
4
4
10
4
6
null
null
rahulmutt/ghcvm
compiler/Eta/Main/StaticFlags.hs
bsd-3-clause
----------------------------------------------------------------------------- -- Static flags -- | Parses GHC's static flags from a list of command line arguments. -- -- These flags are static in the sense that they can be set only once and they -- are global, meaning that they affect every instance of GHC running; -- multiple GHC threads will use the same flags. -- -- This function must be called before any session is started, i.e., before -- the first call to 'GHC.withGhc'. -- -- Static flags are more of a hack and are static for more or less historical -- reasons. In the long run, most static flags should eventually become -- dynamic flags. -- -- XXX: can we add an auto-generated list of static flags here? -- parseStaticFlags :: [Located String] -> IO ([Located String], [Located String]) parseStaticFlags = parseStaticFlagsFull flagsStatic
855
parseStaticFlags :: [Located String] -> IO ([Located String], [Located String]) parseStaticFlags = parseStaticFlagsFull flagsStatic
131
parseStaticFlags = parseStaticFlagsFull flagsStatic
51
true
true
0
9
137
62
40
22
null
null
Fuuzetsu/yukari
src/Utils/Yukari/Formatter.hs
gpl-3.0
verbPrint :: Verbosity -> YukariSettings -> [String] -> IO () verbPrint v ys s = when (v <= _logVerbosity ys) (putStrLn $ unwords s)
132
verbPrint :: Verbosity -> YukariSettings -> [String] -> IO () verbPrint v ys s = when (v <= _logVerbosity ys) (putStrLn $ unwords s)
132
verbPrint v ys s = when (v <= _logVerbosity ys) (putStrLn $ unwords s)
70
false
true
0
9
23
63
31
32
null
null
sjcjoosten/amperspiegel
src/amperspiegel.hs
gpl-3.0
pad :: Int -> Text -> Text pad w s = let x = w - (tlength) s in s <> pack (Prelude.take x (repeat ' '))
107
pad :: Int -> Text -> Text pad w s = let x = w - (tlength) s in s <> pack (Prelude.take x (repeat ' '))
107
pad w s = let x = w - (tlength) s in s <> pack (Prelude.take x (repeat ' '))
80
false
true
2
11
30
75
34
41
null
null
siddhanathan/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
doubleFromIntegerIdKey = mkPreludeMiscIdUnique 86
56
doubleFromIntegerIdKey = mkPreludeMiscIdUnique 86
56
doubleFromIntegerIdKey = mkPreludeMiscIdUnique 86
56
false
false
0
5
10
9
4
5
null
null
Teaspot-Studio/GPipe-Core
src/Graphics/GPipe/Internal/Texture.hs
mit
texture2DLevels (RenderBuffer2D _ _) = 1
40
texture2DLevels (RenderBuffer2D _ _) = 1
40
texture2DLevels (RenderBuffer2D _ _) = 1
40
false
false
0
6
5
18
8
10
null
null
vito/atomo
src/Atomo/Parser/Base.hs
bsd-3-clause
optionSegment :: Parser a -> Parser (String, a) optionSegment p = do name <- optionalKeyword target <- p return (name, target)
138
optionSegment :: Parser a -> Parser (String, a) optionSegment p = do name <- optionalKeyword target <- p return (name, target)
138
optionSegment p = do name <- optionalKeyword target <- p return (name, target)
90
false
true
0
8
32
56
27
29
null
null
wouwouwou/module_8
src/main/haskell/series6/series6a.hs
apache-2.0
op = SyntCat Op
18
op = SyntCat Op
18
op = SyntCat Op
18
false
false
1
5
6
12
4
8
null
null
tel/enc
src/Data/Encrypted.hs
mit
pickKey :: Monad m => Id -> EncryptT m Key pickKey i = do keys <- getKeys case find (\k -> identity k == i) keys of Nothing -> errd NotAuthorized Just k -> return k
214
pickKey :: Monad m => Id -> EncryptT m Key pickKey i = do keys <- getKeys case find (\k -> identity k == i) keys of Nothing -> errd NotAuthorized Just k -> return k
214
pickKey i = do keys <- getKeys case find (\k -> identity k == i) keys of Nothing -> errd NotAuthorized Just k -> return k
171
false
true
0
12
85
85
39
46
null
null
Fermat/Gottlob
Language/Misc.hs
bsd-3-clause
deletion b (tr@(Node Leaf a (Node ltr1 al ltr2))) | a == b = Node ltr1 al ltr2 | b > a = Node Leaf a (deletion b (Node ltr1 al ltr2)) | otherwise = tr
156
deletion b (tr@(Node Leaf a (Node ltr1 al ltr2))) | a == b = Node ltr1 al ltr2 | b > a = Node Leaf a (deletion b (Node ltr1 al ltr2)) | otherwise = tr
156
deletion b (tr@(Node Leaf a (Node ltr1 al ltr2))) | a == b = Node ltr1 al ltr2 | b > a = Node Leaf a (deletion b (Node ltr1 al ltr2)) | otherwise = tr
156
false
false
2
11
41
100
48
52
null
null
koterpillar/tianbar
src/System/Tianbar/Plugin.hs
mit
nullDir :: ServerPart p () nullDir = do segments <- asks uriPathSegments guard $ null segments
102
nullDir :: ServerPart p () nullDir = do segments <- asks uriPathSegments guard $ null segments
102
nullDir = do segments <- asks uriPathSegments guard $ null segments
75
false
true
0
8
23
38
17
21
null
null
jtapolczai/Hephaestos
Crawling/Hephaestos/CLI.hs
apache-2.0
trans :: Lang -> Command (StateT AppState IO) T.Text () trans l = makeCommand2 ":[t]rans" (`elem'` [":t", ":trans"]) (msg l MsgTransC) True mfAsk (transformAsker l Nothing) trans' where mfAsk = predAsker (msgs l MsgTransEnterName) (msg l MsgFileDoesNotExist) (liftIO . D.doesFileExist . T.unpack) trans' _ (Verbatim mf) (Just trName) = do esc <- get >$> escapingFunction let tr = getTransformation trName esc (dir, name) = (parent &&& id) . decodeString $ T.unpack mf err <- liftIO $ tr dir name liftIO $ mapM_ (error . putErrLn . show) err liftIO $ report $ putStrLn (msg l MsgJobDone) -- Helpers ------------------------------------------------------------------------------- -- |Print a newline.
864
trans :: Lang -> Command (StateT AppState IO) T.Text () trans l = makeCommand2 ":[t]rans" (`elem'` [":t", ":trans"]) (msg l MsgTransC) True mfAsk (transformAsker l Nothing) trans' where mfAsk = predAsker (msgs l MsgTransEnterName) (msg l MsgFileDoesNotExist) (liftIO . D.doesFileExist . T.unpack) trans' _ (Verbatim mf) (Just trName) = do esc <- get >$> escapingFunction let tr = getTransformation trName esc (dir, name) = (parent &&& id) . decodeString $ T.unpack mf err <- liftIO $ tr dir name liftIO $ mapM_ (error . putErrLn . show) err liftIO $ report $ putStrLn (msg l MsgJobDone) -- Helpers ------------------------------------------------------------------------------- -- |Print a newline.
864
trans l = makeCommand2 ":[t]rans" (`elem'` [":t", ":trans"]) (msg l MsgTransC) True mfAsk (transformAsker l Nothing) trans' where mfAsk = predAsker (msgs l MsgTransEnterName) (msg l MsgFileDoesNotExist) (liftIO . D.doesFileExist . T.unpack) trans' _ (Verbatim mf) (Just trName) = do esc <- get >$> escapingFunction let tr = getTransformation trName esc (dir, name) = (parent &&& id) . decodeString $ T.unpack mf err <- liftIO $ tr dir name liftIO $ mapM_ (error . putErrLn . show) err liftIO $ report $ putStrLn (msg l MsgJobDone) -- Helpers ------------------------------------------------------------------------------- -- |Print a newline.
808
false
true
2
14
268
288
137
151
null
null
noexc/mapview-noexc
src/KD8ZRC/Flight/NBP4/Main.hs
mit
rawLog = "/var/tmp/" ++ flightId ++ "/raw.log"
46
rawLog = "/var/tmp/" ++ flightId ++ "/raw.log"
46
rawLog = "/var/tmp/" ++ flightId ++ "/raw.log"
46
false
false
3
5
6
18
7
11
null
null
nevrenato/HetsAlloy
OMDoc/OMDocInterface.hs
gpl-2.0
mkOMR :: IRI.IRI -> OMReference mkOMR = OMR
43
mkOMR :: IRI.IRI -> OMReference mkOMR = OMR
43
mkOMR = OMR
11
false
true
0
6
7
17
9
8
null
null
thomaseding/cgs
src/Transform/Extract.hs
bsd-3-clause
extract :: ExtractOptions -> FilePath -> [SyntaxToken Hoops] -> IO [SyntaxToken Hoops] extract opts basePath = fmap unblockify . runExtractor opts basePath . mapM extractM . blockify
182
extract :: ExtractOptions -> FilePath -> [SyntaxToken Hoops] -> IO [SyntaxToken Hoops] extract opts basePath = fmap unblockify . runExtractor opts basePath . mapM extractM . blockify
182
extract opts basePath = fmap unblockify . runExtractor opts basePath . mapM extractM . blockify
95
false
true
0
10
26
66
31
35
null
null
PipocaQuemada/ermine
tests/properties/Arbitrary/Arbitrary.hs
bsd-2-clause
-- | Combinator for decreasing the size of a generator. Should be used when -- generating tree structures, as relying on probability to terminate them -- can lead to excessive memory consumption. smaller :: Gen a -> Gen a smaller g = sized $ \n -> resize (n`div`3) g
266
smaller :: Gen a -> Gen a smaller g = sized $ \n -> resize (n`div`3) g
70
smaller g = sized $ \n -> resize (n`div`3) g
44
true
true
2
8
48
55
28
27
null
null
GaloisInc/ivory-tower-stm32
ivory-bsp-stm32/src/Ivory/BSP/STM32F405/GPIO/AF.hs
bsd-3-clause
gpio_af_i2c3 = gpio_af4
27
gpio_af_i2c3 = gpio_af4
27
gpio_af_i2c3 = gpio_af4
27
false
false
0
4
6
6
3
3
null
null
bennofs/cabal
Cabal/Distribution/PackageDescription/Check.hs
bsd-3-clause
checkSpecVersion :: PackageDescription -> [Int] -> Bool -> PackageCheck -> Maybe PackageCheck checkSpecVersion pkg specver cond pc | specVersion pkg >= Version specver [] = Nothing | otherwise = check cond pc
257
checkSpecVersion :: PackageDescription -> [Int] -> Bool -> PackageCheck -> Maybe PackageCheck checkSpecVersion pkg specver cond pc | specVersion pkg >= Version specver [] = Nothing | otherwise = check cond pc
257
checkSpecVersion pkg specver cond pc | specVersion pkg >= Version specver [] = Nothing | otherwise = check cond pc
146
false
true
1
10
80
74
35
39
null
null
tathougies/crane
src/Web/Crane/Types.hs
gpl-2.0
getMaster' :: (master -> a) -> CraneMonad app master a getMaster' f = asks (f . crMaster)
89
getMaster' :: (master -> a) -> CraneMonad app master a getMaster' f = asks (f . crMaster)
89
getMaster' f = asks (f . crMaster)
34
false
true
0
7
16
42
21
21
null
null
spechub/Hets
OMDoc/XmlInterface.hs
gpl-2.0
notationComponentToXml (ArgComp ind prec) = mkElement el_component [ Attr at_index $ show ind , Attr at_precedence $ show prec] []
161
notationComponentToXml (ArgComp ind prec) = mkElement el_component [ Attr at_index $ show ind , Attr at_precedence $ show prec] []
161
notationComponentToXml (ArgComp ind prec) = mkElement el_component [ Attr at_index $ show ind , Attr at_precedence $ show prec] []
161
false
false
0
8
50
53
24
29
null
null
k-bx/stack
src/Stack/PackageDump.hs
bsd-3-clause
eachPair :: Monad m => (ByteString -> Sink Line m a) -> Conduit Line m a eachPair inner = start where start = await >>= maybe (return ()) start' _colon = 58 _space = 32 start' bs1 = toConsumer (valSrc =$= inner key) >>= yield >> start where (key, bs2) = S.break (== _colon) bs1 (spaces, bs3) = S.span (== _space) $ S.drop 1 bs2 indent = S.length key + 1 + S.length spaces valSrc | S.null bs3 = noIndent | otherwise = yield bs3 >> loopIndent indent noIndent = do mx <- await case mx of Nothing -> return () Just bs -> do let (spaces, val) = S.span (== _space) bs if S.length spaces == 0 then leftover val else do yield val loopIndent (S.length spaces) loopIndent i = loop where loop = await >>= maybe (return ()) go go bs | S.length spaces == i && S.all (== _space) spaces = yield val >> loop | otherwise = leftover bs where (spaces, val) = S.splitAt i bs -- | General purpose utility
1,260
eachPair :: Monad m => (ByteString -> Sink Line m a) -> Conduit Line m a eachPair inner = start where start = await >>= maybe (return ()) start' _colon = 58 _space = 32 start' bs1 = toConsumer (valSrc =$= inner key) >>= yield >> start where (key, bs2) = S.break (== _colon) bs1 (spaces, bs3) = S.span (== _space) $ S.drop 1 bs2 indent = S.length key + 1 + S.length spaces valSrc | S.null bs3 = noIndent | otherwise = yield bs3 >> loopIndent indent noIndent = do mx <- await case mx of Nothing -> return () Just bs -> do let (spaces, val) = S.span (== _space) bs if S.length spaces == 0 then leftover val else do yield val loopIndent (S.length spaces) loopIndent i = loop where loop = await >>= maybe (return ()) go go bs | S.length spaces == i && S.all (== _space) spaces = yield val >> loop | otherwise = leftover bs where (spaces, val) = S.splitAt i bs -- | General purpose utility
1,260
eachPair inner = start where start = await >>= maybe (return ()) start' _colon = 58 _space = 32 start' bs1 = toConsumer (valSrc =$= inner key) >>= yield >> start where (key, bs2) = S.break (== _colon) bs1 (spaces, bs3) = S.span (== _space) $ S.drop 1 bs2 indent = S.length key + 1 + S.length spaces valSrc | S.null bs3 = noIndent | otherwise = yield bs3 >> loopIndent indent noIndent = do mx <- await case mx of Nothing -> return () Just bs -> do let (spaces, val) = S.span (== _space) bs if S.length spaces == 0 then leftover val else do yield val loopIndent (S.length spaces) loopIndent i = loop where loop = await >>= maybe (return ()) go go bs | S.length spaces == i && S.all (== _space) spaces = yield val >> loop | otherwise = leftover bs where (spaces, val) = S.splitAt i bs -- | General purpose utility
1,169
false
true
5
19
551
449
216
233
null
null
gencer/bond
compiler/src/Language/Bond/Codegen/TypeMapping.hs
mit
csType BT_Int16 = pure "short"
30
csType BT_Int16 = pure "short"
30
csType BT_Int16 = pure "short"
30
false
false
0
5
4
12
5
7
null
null
bravit/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LUDiv (ITFixed ty)) [x, y] = bitOp v "UDiv" ty [x, y]
61
doOp v (LUDiv (ITFixed ty)) [x, y] = bitOp v "UDiv" ty [x, y]
61
doOp v (LUDiv (ITFixed ty)) [x, y] = bitOp v "UDiv" ty [x, y]
61
false
false
0
9
13
46
24
22
null
null
ku-fpg/blank-canvas
Graphics/Blank/Style.hs
bsd-3-clause
-- | @#008000@, @rgb(0, 128, 0)@, @hsl(120, 100%, 25%)@ green :: Colour Double green = Names.green
98
green :: Colour Double green = Names.green
42
green = Names.green
19
true
true
0
5
15
17
9
8
null
null
siddhanathan/ghc
compiler/basicTypes/Module.hs
bsd-3-clause
thisGhcUnitId = fsToUnitId (fsLit "ghc")
44
thisGhcUnitId = fsToUnitId (fsLit "ghc")
44
thisGhcUnitId = fsToUnitId (fsLit "ghc")
44
false
false
0
7
8
15
7
8
null
null
pikajude/explain
src/Main.hs
mit
unName b (Symbol s) = \d -> if b then d <> string s else parens $ d <> string s
79
unName b (Symbol s) = \d -> if b then d <> string s else parens $ d <> string s
79
unName b (Symbol s) = \d -> if b then d <> string s else parens $ d <> string s
79
false
false
0
8
20
48
24
24
null
null
bitc/crap-chopper-game
Main.hs
mit
initProcessInputData :: ProcessInputData initProcessInputData = (False, False, False, False, False, False, 0, 0, False)
119
initProcessInputData :: ProcessInputData initProcessInputData = (False, False, False, False, False, False, 0, 0, False)
119
initProcessInputData = (False, False, False, False, False, False, 0, 0, False)
78
false
true
0
5
13
38
24
14
null
null
ilyasergey/GHC-XAppFix
compiler/cmm/PprC.hs
bsd-3-clause
-- True if (pprAsPtrReg reg) will give an expression with type StgPtr -- JD: THIS IS HORRIBLE AND SHOULD BE RENAMED, AT THE VERY LEAST. -- THE GARBAGE WITH THE VNonGcPtr HELPS MATCH THE OLD CODE GENERATOR'S OUTPUT; -- I'M NOT SURE IF IT SHOULD REALLY STAY THAT WAY. isPtrReg :: CmmReg -> Bool isPtrReg (CmmLocal _) = False
346
isPtrReg :: CmmReg -> Bool isPtrReg (CmmLocal _) = False
80
isPtrReg (CmmLocal _) = False
53
true
true
0
7
82
28
16
12
null
null
nushio3/Paraiso
attic/newexp/staging-rewrite.hs
bsd-3-clause
partial4 :: forall a. (Typeable a, Fractional a) => Expr Axis -> Expr (Pt -> a) -> Expr (Pt -> a) partial4 i f = Static "{\\partial^(4)}" partial4' :$ i :$ f
157
partial4 :: forall a. (Typeable a, Fractional a) => Expr Axis -> Expr (Pt -> a) -> Expr (Pt -> a) partial4 i f = Static "{\\partial^(4)}" partial4' :$ i :$ f
157
partial4 i f = Static "{\\partial^(4)}" partial4' :$ i :$ f
59
false
true
0
11
31
80
40
40
null
null
ivan-m/testbench
src/TestBench/Commands.hs
mit
parseWith :: Config -> Parser RunTestBench parseWith cfg = runParse <|> Version <$ switch (long "version" <> short 'V' <> help "Show version information") <|> List <$ switch (long "list" <> short 'l' <> help "List all benchmarks") <|> Weigh <$> option auto (long weighIndexArg <> internal) -- Hidden options! <*> strOption (long weighFileArg <> internal) where runParse = Run <$> (not <$> switch (long "no-tests" <> help "Don't run tests")) <*> (not <$> switch (long "no-bench" <> help "Don't run benchmarks")) <*> configParser cfg
608
parseWith :: Config -> Parser RunTestBench parseWith cfg = runParse <|> Version <$ switch (long "version" <> short 'V' <> help "Show version information") <|> List <$ switch (long "list" <> short 'l' <> help "List all benchmarks") <|> Weigh <$> option auto (long weighIndexArg <> internal) -- Hidden options! <*> strOption (long weighFileArg <> internal) where runParse = Run <$> (not <$> switch (long "no-tests" <> help "Don't run tests")) <*> (not <$> switch (long "no-bench" <> help "Don't run benchmarks")) <*> configParser cfg
608
parseWith cfg = runParse <|> Version <$ switch (long "version" <> short 'V' <> help "Show version information") <|> List <$ switch (long "list" <> short 'l' <> help "List all benchmarks") <|> Weigh <$> option auto (long weighIndexArg <> internal) -- Hidden options! <*> strOption (long weighFileArg <> internal) where runParse = Run <$> (not <$> switch (long "no-tests" <> help "Don't run tests")) <*> (not <$> switch (long "no-bench" <> help "Don't run benchmarks")) <*> configParser cfg
565
false
true
27
10
161
223
104
119
null
null