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
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 36975 = 5678
32
getValueFromProduct 36975 = 5678
32
getValueFromProduct 36975 = 5678
32
false
false
0
5
3
9
4
5
null
null
shapr/adventofcode2016
src/Twelve/Main.hs
bsd-3-clause
jnz :: Parser Expr jnz = do string "jnz" space z <- val space j <- val return $ Jnz z j
99
jnz :: Parser Expr jnz = do string "jnz" space z <- val space j <- val return $ Jnz z j
99
jnz = do string "jnz" space z <- val space j <- val return $ Jnz z j
80
false
true
0
9
33
58
23
35
null
null
frantisekfarka/ghc-dsi
compiler/codeGen/StgCmmMonad.hs
bsd-3-clause
addCodeBlocksFrom :: CgState -> CgState -> CgState -- Add code blocks from the latter to the former -- (The cgs_stmts will often be empty, but not always; see codeOnly) s1 `addCodeBlocksFrom` s2 = s1 { cgs_stmts = cgs_stmts s1 <*> cgs_stmts s2, cgs_tops = cgs_tops s1 `appOL` cgs_tops s2 }
303
addCodeBlocksFrom :: CgState -> CgState -> CgState s1 `addCodeBlocksFrom` s2 = s1 { cgs_stmts = cgs_stmts s1 <*> cgs_stmts s2, cgs_tops = cgs_tops s1 `appOL` cgs_tops s2 }
185
s1 `addCodeBlocksFrom` s2 = s1 { cgs_stmts = cgs_stmts s1 <*> cgs_stmts s2, cgs_tops = cgs_tops s1 `appOL` cgs_tops s2 }
134
true
true
0
9
63
72
37
35
null
null
tsuraan/optimal-blocks
src/Main.hs
bsd-3-clause
doFiles :: Args -> [String] -> IO [FileResult] doFiles args [] = do bs <- withFile "/dev/urandom" ReadMode (\h -> BS.hGet h (100*1024*1024)) return [getResult args "/dev/urandom" bs]
186
doFiles :: Args -> [String] -> IO [FileResult] doFiles args [] = do bs <- withFile "/dev/urandom" ReadMode (\h -> BS.hGet h (100*1024*1024)) return [getResult args "/dev/urandom" bs]
186
doFiles args [] = do bs <- withFile "/dev/urandom" ReadMode (\h -> BS.hGet h (100*1024*1024)) return [getResult args "/dev/urandom" bs]
139
false
true
0
14
31
91
45
46
null
null
unknownloner/pagerenc
src/Data/Transmission.hs
mit
pocsagBaudRate POCSAGBaudRate2400 = BaudRate 2400
49
pocsagBaudRate POCSAGBaudRate2400 = BaudRate 2400
49
pocsagBaudRate POCSAGBaudRate2400 = BaudRate 2400
49
false
false
0
5
4
12
5
7
null
null
fugyk/cabal
cabal-install/Distribution/Client/Sandbox.hs
bsd-3-clause
updateInstallDirs :: Flag Bool -> (UseSandbox, SavedConfig) -> (UseSandbox, SavedConfig) updateInstallDirs userInstallFlag (useSandbox, savedConfig) = case useSandbox of NoSandbox -> let savedConfig' = savedConfig { savedConfigureFlags = configureFlags { configInstallDirs = installDirs } } in (useSandbox, savedConfig') _ -> (useSandbox, savedConfig) where configureFlags = savedConfigureFlags savedConfig userInstallDirs = savedUserInstallDirs savedConfig globalInstallDirs = savedGlobalInstallDirs savedConfig installDirs | userInstall = userInstallDirs | otherwise = globalInstallDirs userInstall = fromFlagOrDefault defaultUserInstall (configUserInstall configureFlags `mappend` userInstallFlag) -- | Check which type of package environment we're in and return a -- correctly-initialised @SavedConfig@ and a @UseSandbox@ value that indicates -- whether we're working in a sandbox.
1,034
updateInstallDirs :: Flag Bool -> (UseSandbox, SavedConfig) -> (UseSandbox, SavedConfig) updateInstallDirs userInstallFlag (useSandbox, savedConfig) = case useSandbox of NoSandbox -> let savedConfig' = savedConfig { savedConfigureFlags = configureFlags { configInstallDirs = installDirs } } in (useSandbox, savedConfig') _ -> (useSandbox, savedConfig) where configureFlags = savedConfigureFlags savedConfig userInstallDirs = savedUserInstallDirs savedConfig globalInstallDirs = savedGlobalInstallDirs savedConfig installDirs | userInstall = userInstallDirs | otherwise = globalInstallDirs userInstall = fromFlagOrDefault defaultUserInstall (configUserInstall configureFlags `mappend` userInstallFlag) -- | Check which type of package environment we're in and return a -- correctly-initialised @SavedConfig@ and a @UseSandbox@ value that indicates -- whether we're working in a sandbox.
1,034
updateInstallDirs userInstallFlag (useSandbox, savedConfig) = case useSandbox of NoSandbox -> let savedConfig' = savedConfig { savedConfigureFlags = configureFlags { configInstallDirs = installDirs } } in (useSandbox, savedConfig') _ -> (useSandbox, savedConfig) where configureFlags = savedConfigureFlags savedConfig userInstallDirs = savedUserInstallDirs savedConfig globalInstallDirs = savedGlobalInstallDirs savedConfig installDirs | userInstall = userInstallDirs | otherwise = globalInstallDirs userInstall = fromFlagOrDefault defaultUserInstall (configUserInstall configureFlags `mappend` userInstallFlag) -- | Check which type of package environment we're in and return a -- correctly-initialised @SavedConfig@ and a @UseSandbox@ value that indicates -- whether we're working in a sandbox.
927
false
true
7
15
248
170
93
77
null
null
phischu/fragnix
tests/packages/scotty/Network.Wai.Handler.Warp.Response.hs
bsd-3-clause
checkChunk :: Request -> Bool checkChunk req = httpVersion req == H.http11
74
checkChunk :: Request -> Bool checkChunk req = httpVersion req == H.http11
74
checkChunk req = httpVersion req == H.http11
44
false
true
0
6
11
27
13
14
null
null
hguenther/fac
Formula.hs
gpl-3.0
simplify (Or x y) = case (simplify x,simplify y) of (Const True,_) -> Const True (Const False,y') -> y' (_,Const True) -> Const True (x',Const False) -> x' (x',y') -> if x'==y' then x' else Or x' y'
234
simplify (Or x y) = case (simplify x,simplify y) of (Const True,_) -> Const True (Const False,y') -> y' (_,Const True) -> Const True (x',Const False) -> x' (x',y') -> if x'==y' then x' else Or x' y'
234
simplify (Or x y) = case (simplify x,simplify y) of (Const True,_) -> Const True (Const False,y') -> y' (_,Const True) -> Const True (x',Const False) -> x' (x',y') -> if x'==y' then x' else Or x' y'
234
false
false
0
9
73
129
66
63
null
null
tolysz/prepare-ghcjs
spec-lts8/cabal/cabal-install/Distribution/Client/Dependency/Modular/Message.hs
bsd-3-clause
showFR _ (Conflicting ds) = " (conflict: " ++ L.intercalate ", " (map showDep ds) ++ ")"
104
showFR _ (Conflicting ds) = " (conflict: " ++ L.intercalate ", " (map showDep ds) ++ ")"
104
showFR _ (Conflicting ds) = " (conflict: " ++ L.intercalate ", " (map showDep ds) ++ ")"
104
false
false
1
9
32
43
19
24
null
null
martin-kolinek/stack
src/System/Process/PagerEditor.hs
bsd-3-clause
-- | Short-circuit first Just. orElse :: (Monad m) => m (Maybe a) -> m (Maybe a) -> m (Maybe a) orElse a b = do m <- a case m of Just _ -> return m Nothing -> b -- | Exception running pager.
243
orElse :: (Monad m) => m (Maybe a) -> m (Maybe a) -> m (Maybe a) orElse a b = do m <- a case m of Just _ -> return m Nothing -> b -- | Exception running pager.
212
orElse a b = do m <- a case m of Just _ -> return m Nothing -> b -- | Exception running pager.
147
true
true
0
11
97
100
46
54
null
null
ghc-android/ghc
compiler/codeGen/StgCmmMonad.hs
bsd-3-clause
emitProcWithStackFrame conv mb_info lbl stk_args args (graph, tscope) True -- do layout = do { dflags <- getDynFlags ; let (offset, live, entry) = mkCallEntry dflags conv args stk_args graph' = entry MkGraph.<*> graph ; emitProc_ mb_info lbl live (graph', tscope) offset True }
326
emitProcWithStackFrame conv mb_info lbl stk_args args (graph, tscope) True -- do layout = do { dflags <- getDynFlags ; let (offset, live, entry) = mkCallEntry dflags conv args stk_args graph' = entry MkGraph.<*> graph ; emitProc_ mb_info lbl live (graph', tscope) offset True }
326
emitProcWithStackFrame conv mb_info lbl stk_args args (graph, tscope) True -- do layout = do { dflags <- getDynFlags ; let (offset, live, entry) = mkCallEntry dflags conv args stk_args graph' = entry MkGraph.<*> graph ; emitProc_ mb_info lbl live (graph', tscope) offset True }
326
false
false
0
10
92
100
53
47
null
null
mcschroeder/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
ctEvId (CtGiven { ctev_evar = ev }) = ev
41
ctEvId (CtGiven { ctev_evar = ev }) = ev
41
ctEvId (CtGiven { ctev_evar = ev }) = ev
41
false
false
0
9
9
21
11
10
null
null
spl/dlist
tests/DNonEmptyProperties.hs
bsd-3-clause
prop_toList :: Bool prop_toList = toList exampleDNonEmpty == exampleList
72
prop_toList :: Bool prop_toList = toList exampleDNonEmpty == exampleList
72
prop_toList = toList exampleDNonEmpty == exampleList
52
false
true
0
6
8
18
9
9
null
null
lenary/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
-- | Transform the FCs in a PTerm. The first function transforms the -- general-purpose FCs, and the second transforms those that are used -- for semantic source highlighting, so they can be treated specially. mapPTermFC :: (FC -> FC) -> (FC -> FC) -> PTerm -> PTerm mapPTermFC f g (PQuote q) = PQuote q
303
mapPTermFC :: (FC -> FC) -> (FC -> FC) -> PTerm -> PTerm mapPTermFC f g (PQuote q) = PQuote q
93
mapPTermFC f g (PQuote q) = PQuote q
36
true
true
0
11
55
61
31
30
null
null
batterseapower/mini-ghc
Core/Parser.hs
bsd-3-clause
listCompCore :: LHE.Exp -> [LHE.Stmt] -> ParseM Term listCompCore e_inner stmts = go stmts where go [] = expCore e_inner >>= \e_inner -> listCore [e_inner] go (stmt:stmts) = case stmt of -- concatMap (\pat -> [[go stmts]]) e LHE.Generator _loc pat e -> do (x, _bound_xs, build) <- patCore pat arg1 <- liftM (lambda x . build) $ bindFloats $ go stmts arg2 <- expCore e var (name "concatMap") `appE` arg1 >>= (`appE` arg2) -- if e then [[go stmts]] else [] LHE.Qualifier e -> liftM3 if_ (expCore e) (go stmts) (listCore []) -- let [[binds]] in [[go stmts]] LHE.LetStmt (LHE.BDecls binds) -> bindFloatsWith $ liftM2 (,) (declsCore binds) (go stmts)
751
listCompCore :: LHE.Exp -> [LHE.Stmt] -> ParseM Term listCompCore e_inner stmts = go stmts where go [] = expCore e_inner >>= \e_inner -> listCore [e_inner] go (stmt:stmts) = case stmt of -- concatMap (\pat -> [[go stmts]]) e LHE.Generator _loc pat e -> do (x, _bound_xs, build) <- patCore pat arg1 <- liftM (lambda x . build) $ bindFloats $ go stmts arg2 <- expCore e var (name "concatMap") `appE` arg1 >>= (`appE` arg2) -- if e then [[go stmts]] else [] LHE.Qualifier e -> liftM3 if_ (expCore e) (go stmts) (listCore []) -- let [[binds]] in [[go stmts]] LHE.LetStmt (LHE.BDecls binds) -> bindFloatsWith $ liftM2 (,) (declsCore binds) (go stmts)
751
listCompCore e_inner stmts = go stmts where go [] = expCore e_inner >>= \e_inner -> listCore [e_inner] go (stmt:stmts) = case stmt of -- concatMap (\pat -> [[go stmts]]) e LHE.Generator _loc pat e -> do (x, _bound_xs, build) <- patCore pat arg1 <- liftM (lambda x . build) $ bindFloats $ go stmts arg2 <- expCore e var (name "concatMap") `appE` arg1 >>= (`appE` arg2) -- if e then [[go stmts]] else [] LHE.Qualifier e -> liftM3 if_ (expCore e) (go stmts) (listCore []) -- let [[binds]] in [[go stmts]] LHE.LetStmt (LHE.BDecls binds) -> bindFloatsWith $ liftM2 (,) (declsCore binds) (go stmts)
698
false
true
0
16
216
278
138
140
null
null
TOSPIO/yi
src/tests/data/haskell/3.hs
gpl-2.0
waitForExit :: ProcessHandle -> IO (Either Exception ExitCode) waitForExit ph = handle (\e -> return (Left e)) $ do mec <- getProcessExitCode ph case mec of Nothing -> threadDelay (500*1000) >> waitForExit ph Just ec -> return (Right ec)
273
waitForExit :: ProcessHandle -> IO (Either Exception ExitCode) waitForExit ph = handle (\e -> return (Left e)) $ do mec <- getProcessExitCode ph case mec of Nothing -> threadDelay (500*1000) >> waitForExit ph Just ec -> return (Right ec)
273
waitForExit ph = handle (\e -> return (Left e)) $ do mec <- getProcessExitCode ph case mec of Nothing -> threadDelay (500*1000) >> waitForExit ph Just ec -> return (Right ec)
210
false
true
0
14
74
111
52
59
null
null
jyp/lp-diagrams-svg
Graphics/Diagrams/Backend/SVGTree.hs
agpl-3.0
pathPoints :: Path' t -> [Point' t] pathPoints EmptyPath = []
61
pathPoints :: Path' t -> [Point' t] pathPoints EmptyPath = []
61
pathPoints EmptyPath = []
25
false
true
0
7
10
29
14
15
null
null
siddhanathan/ghc
compiler/prelude/THNames.hs
bsd-3-clause
moduleAnnotationIdKey = mkPreludeMiscIdUnique 492
49
moduleAnnotationIdKey = mkPreludeMiscIdUnique 492
49
moduleAnnotationIdKey = mkPreludeMiscIdUnique 492
49
false
false
0
5
3
9
4
5
null
null
unisonweb/platform
parser-typechecker/src/Unison/Runtime/Builtin.hs
mit
lzeron, tzeron, lzeroi, tzeroi, popn, popi :: Var v => SuperNormal v lzeron = unop LZRO Ty.natRef
97
lzeron, tzeron, lzeroi, tzeroi, popn, popi :: Var v => SuperNormal v lzeron = unop LZRO Ty.natRef
97
lzeron = unop LZRO Ty.natRef
28
false
true
0
6
16
38
23
15
null
null
brendanhay/gogol
gogol-jobs/gen/Network/Google/Jobs/Types/Product.hs
mpl-2.0
-- | Job resource that matches the specified SearchJobsRequest. mjJob :: Lens' MatchingJob (Maybe Job) mjJob = lens _mjJob (\ s a -> s{_mjJob = a})
147
mjJob :: Lens' MatchingJob (Maybe Job) mjJob = lens _mjJob (\ s a -> s{_mjJob = a})
83
mjJob = lens _mjJob (\ s a -> s{_mjJob = a})
44
true
true
0
9
25
46
25
21
null
null
carletes/project-euler
problem-10.hs
mit
result = sum $ primesUnder 2000000
34
result = sum $ primesUnder 2000000
34
result = sum $ primesUnder 2000000
34
false
false
1
6
5
16
6
10
null
null
JacksonGariety/euler.hs
049.hs
bsd-3-clause
where ps = (dropWhile (<1000) (takeWhile (<10000) primes))
58
where ps = (dropWhile (<1000) (takeWhile (<10000) primes))
58
where ps = (dropWhile (<1000) (takeWhile (<10000) primes))
58
false
false
0
9
7
33
18
15
null
null
HaskellTO/projects
babylon/Babylon.hs
mit
orelse [] t = t
15
orelse [] t = t
15
orelse [] t = t
15
false
false
1
5
4
18
6
12
null
null
daleooo/barrelfish
tools/mackerel/TypeTable.hs
mit
is_builtin :: Rec -> Bool is_builtin Primitive { tt_name = n } = TN.is_builtin_type n
85
is_builtin :: Rec -> Bool is_builtin Primitive { tt_name = n } = TN.is_builtin_type n
85
is_builtin Primitive { tt_name = n } = TN.is_builtin_type n
59
false
true
3
6
14
37
17
20
null
null
timbodeit/qpx-api
test/Tests.hs
mit
concatM :: Monad m => m [a] -> m [a] -> m [a] concatM = liftM2 (++)
67
concatM :: Monad m => m [a] -> m [a] -> m [a] concatM = liftM2 (++)
67
concatM = liftM2 (++)
21
false
true
0
9
16
49
25
24
null
null
raichoo/Idris-dev
src/IRTS/CodegenJavaScript.hs
bsd-3-clause
translateConstant (B8 b) = JSWord (JSWord8 b)
63
translateConstant (B8 b) = JSWord (JSWord8 b)
63
translateConstant (B8 b) = JSWord (JSWord8 b)
63
false
false
0
7
24
24
11
13
null
null
alistair/omnisharp-hs
src/Omnisharp/Neovim/Lib.hs
bsd-3-clause
getCurrentPosition :: Neovim r st (Int64, Int64) getCurrentPosition = extract <$> positionM where positionM = vim_get_current_window >>= window_get_cursor extract x = case x of (Right p) -> p (Left _) -> (0, 0)
259
getCurrentPosition :: Neovim r st (Int64, Int64) getCurrentPosition = extract <$> positionM where positionM = vim_get_current_window >>= window_get_cursor extract x = case x of (Right p) -> p (Left _) -> (0, 0)
259
getCurrentPosition = extract <$> positionM where positionM = vim_get_current_window >>= window_get_cursor extract x = case x of (Right p) -> p (Left _) -> (0, 0)
210
false
true
4
9
81
95
44
51
null
null
dimara/ganeti
src/Ganeti/HTools/Program/Hbal.hs
bsd-2-clause
iterateDepth :: Bool -- ^ Whether to print moves -> AlgorithmOptions -- ^ Algorithmic options to apply -> Cluster.Table -- ^ The starting table -> Int -- ^ Remaining length -> Int -- ^ Max node name len -> Int -- ^ Max instance name len -> [MoveJob] -- ^ Current command list -> Score -- ^ Score at which to stop -> IO (Cluster.Table, [MoveJob]) -- ^ The resulting table -- and commands iterateDepth printmove algOpts ini_tbl max_rounds nmlen imlen cmd_strs min_score = let Cluster.Table ini_nl ini_il _ _ = ini_tbl allowed_next = Cluster.doNextBalance ini_tbl max_rounds min_score m_fin_tbl = if allowed_next then Cluster.tryBalance algOpts ini_tbl else Nothing in case m_fin_tbl of Just fin_tbl -> do let (Cluster.Table _ _ _ fin_plc) = fin_tbl cur_plc@(idx, _, _, move, _) <- exitIfEmpty "Empty placement list returned for solution?!" fin_plc let fin_plc_len = length fin_plc (sol_line, cmds) = Cluster.printSolutionLine ini_nl ini_il nmlen imlen cur_plc fin_plc_len afn = Cluster.involvedNodes ini_il cur_plc upd_cmd_strs = (afn, idx, move, cmds):cmd_strs when printmove $ do putStrLn sol_line hFlush stdout iterateDepth printmove algOpts fin_tbl max_rounds nmlen imlen upd_cmd_strs min_score Nothing -> return (ini_tbl, cmd_strs) -- | Displays the cluster stats.
1,783
iterateDepth :: Bool -- ^ Whether to print moves -> AlgorithmOptions -- ^ Algorithmic options to apply -> Cluster.Table -- ^ The starting table -> Int -- ^ Remaining length -> Int -- ^ Max node name len -> Int -- ^ Max instance name len -> [MoveJob] -- ^ Current command list -> Score -- ^ Score at which to stop -> IO (Cluster.Table, [MoveJob]) iterateDepth printmove algOpts ini_tbl max_rounds nmlen imlen cmd_strs min_score = let Cluster.Table ini_nl ini_il _ _ = ini_tbl allowed_next = Cluster.doNextBalance ini_tbl max_rounds min_score m_fin_tbl = if allowed_next then Cluster.tryBalance algOpts ini_tbl else Nothing in case m_fin_tbl of Just fin_tbl -> do let (Cluster.Table _ _ _ fin_plc) = fin_tbl cur_plc@(idx, _, _, move, _) <- exitIfEmpty "Empty placement list returned for solution?!" fin_plc let fin_plc_len = length fin_plc (sol_line, cmds) = Cluster.printSolutionLine ini_nl ini_il nmlen imlen cur_plc fin_plc_len afn = Cluster.involvedNodes ini_il cur_plc upd_cmd_strs = (afn, idx, move, cmds):cmd_strs when printmove $ do putStrLn sol_line hFlush stdout iterateDepth printmove algOpts fin_tbl max_rounds nmlen imlen upd_cmd_strs min_score Nothing -> return (ini_tbl, cmd_strs) -- | Displays the cluster stats.
1,696
iterateDepth printmove algOpts ini_tbl max_rounds nmlen imlen cmd_strs min_score = let Cluster.Table ini_nl ini_il _ _ = ini_tbl allowed_next = Cluster.doNextBalance ini_tbl max_rounds min_score m_fin_tbl = if allowed_next then Cluster.tryBalance algOpts ini_tbl else Nothing in case m_fin_tbl of Just fin_tbl -> do let (Cluster.Table _ _ _ fin_plc) = fin_tbl cur_plc@(idx, _, _, move, _) <- exitIfEmpty "Empty placement list returned for solution?!" fin_plc let fin_plc_len = length fin_plc (sol_line, cmds) = Cluster.printSolutionLine ini_nl ini_il nmlen imlen cur_plc fin_plc_len afn = Cluster.involvedNodes ini_il cur_plc upd_cmd_strs = (afn, idx, move, cmds):cmd_strs when printmove $ do putStrLn sol_line hFlush stdout iterateDepth printmove algOpts fin_tbl max_rounds nmlen imlen upd_cmd_strs min_score Nothing -> return (ini_tbl, cmd_strs) -- | Displays the cluster stats.
1,174
true
true
0
17
707
343
177
166
null
null
omefire/megaparsec
tests/Prim.hs
bsd-2-clause
prop_notFollowedBy_2 :: NonNegative Int -> NonNegative Int -> NonNegative Int -> Property prop_notFollowedBy_2 a' b' c' = checkParser p r s where [a,b,c] = getNonNegative <$> [a',b',c'] p = many (char 'a') <* notFollowedBy eof <* many anyChar r | b > 0 || c > 0 = Right (replicate a 'a') | otherwise = posErr a s [uneEof, exCh 'a'] s = abcRow a b c -- We omit tests for 'eof' here because it's used virtually everywhere, it's -- already thoroughly tested.
521
prop_notFollowedBy_2 :: NonNegative Int -> NonNegative Int -> NonNegative Int -> Property prop_notFollowedBy_2 a' b' c' = checkParser p r s where [a,b,c] = getNonNegative <$> [a',b',c'] p = many (char 'a') <* notFollowedBy eof <* many anyChar r | b > 0 || c > 0 = Right (replicate a 'a') | otherwise = posErr a s [uneEof, exCh 'a'] s = abcRow a b c -- We omit tests for 'eof' here because it's used virtually everywhere, it's -- already thoroughly tested.
521
prop_notFollowedBy_2 a' b' c' = checkParser p r s where [a,b,c] = getNonNegative <$> [a',b',c'] p = many (char 'a') <* notFollowedBy eof <* many anyChar r | b > 0 || c > 0 = Right (replicate a 'a') | otherwise = posErr a s [uneEof, exCh 'a'] s = abcRow a b c -- We omit tests for 'eof' here because it's used virtually everywhere, it's -- already thoroughly tested.
407
false
true
3
10
149
193
90
103
null
null
MasseR/introitu
Handler/Edit.hs
bsd-2-clause
putEditR :: NoteId -> Handler RepJson putEditR noteId = do _ <- runDB $ get404 noteId ((result, _), _) <- runFormPost $ renderDivs (noteForm Nothing) case result of FormSuccess form -> do time <- liftIO getCurrentTime _ <- runDB $ modifyNote noteId form _ <- getUrlRender >>= indexNote noteId time jsonToRepJson $ object [("status", "ok" :: Text)] err -> jsonToRepJson $ object [("error", show err)]
455
putEditR :: NoteId -> Handler RepJson putEditR noteId = do _ <- runDB $ get404 noteId ((result, _), _) <- runFormPost $ renderDivs (noteForm Nothing) case result of FormSuccess form -> do time <- liftIO getCurrentTime _ <- runDB $ modifyNote noteId form _ <- getUrlRender >>= indexNote noteId time jsonToRepJson $ object [("status", "ok" :: Text)] err -> jsonToRepJson $ object [("error", show err)]
455
putEditR noteId = do _ <- runDB $ get404 noteId ((result, _), _) <- runFormPost $ renderDivs (noteForm Nothing) case result of FormSuccess form -> do time <- liftIO getCurrentTime _ <- runDB $ modifyNote noteId form _ <- getUrlRender >>= indexNote noteId time jsonToRepJson $ object [("status", "ok" :: Text)] err -> jsonToRepJson $ object [("error", show err)]
417
false
true
0
15
120
172
83
89
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_MAP1_TEXTURE_COORD_2 :: GLenum gl_MAP1_TEXTURE_COORD_2 = 0x0D94
66
gl_MAP1_TEXTURE_COORD_2 :: GLenum gl_MAP1_TEXTURE_COORD_2 = 0x0D94
66
gl_MAP1_TEXTURE_COORD_2 = 0x0D94
32
false
true
0
4
5
11
6
5
null
null
Crazycolorz5/Haskell-Code
FuncSet.hs
unlicense
insert :: (Eq a) => FuncSet a -> a -> FuncSet a insert (FS f) a = FS (\x -> x==a || f a)
88
insert :: (Eq a) => FuncSet a -> a -> FuncSet a insert (FS f) a = FS (\x -> x==a || f a)
88
insert (FS f) a = FS (\x -> x==a || f a)
40
false
true
0
11
23
72
34
38
null
null
input-output-hk/pos-haskell-prototype
db/src/Pos/DB/Delegation/Logic/Common.hs
mit
-- | Executes atomic action on delegation variable. runDelegationStateAction :: (MonadIO m, MonadDelegation ctx m) => DelegationStateAction a -> m a runDelegationStateAction action = do var <- askDelegationState atomically $ do v0 <- readTVar var let (r,v1) = runState action v0 -- The `$!` is necessary here, otherwise `runDelegationStateAction` will -- leak memory due to the fact `writeTVar` could end up accumulating thunks (if its -- content is never demanded). Note that using a strict State is not enough, -- as that ensure that only the sequencing of actions is strict, but the state -- `s` is still lazy, so is using `Control.Lens.%=`, which calls `modify` and -- not `modify'` under the hood. writeTVar var $! v1 pure r ---------------------------------------------------------------------------- -- Common functions ---------------------------------------------------------------------------- -- | Retrieves last PSK in chain of delegation started by public key -- and resolves the passed issuer to a public key. Uses database only.
1,141
runDelegationStateAction :: (MonadIO m, MonadDelegation ctx m) => DelegationStateAction a -> m a runDelegationStateAction action = do var <- askDelegationState atomically $ do v0 <- readTVar var let (r,v1) = runState action v0 -- The `$!` is necessary here, otherwise `runDelegationStateAction` will -- leak memory due to the fact `writeTVar` could end up accumulating thunks (if its -- content is never demanded). Note that using a strict State is not enough, -- as that ensure that only the sequencing of actions is strict, but the state -- `s` is still lazy, so is using `Control.Lens.%=`, which calls `modify` and -- not `modify'` under the hood. writeTVar var $! v1 pure r ---------------------------------------------------------------------------- -- Common functions ---------------------------------------------------------------------------- -- | Retrieves last PSK in chain of delegation started by public key -- and resolves the passed issuer to a public key. Uses database only.
1,089
runDelegationStateAction action = do var <- askDelegationState atomically $ do v0 <- readTVar var let (r,v1) = runState action v0 -- The `$!` is necessary here, otherwise `runDelegationStateAction` will -- leak memory due to the fact `writeTVar` could end up accumulating thunks (if its -- content is never demanded). Note that using a strict State is not enough, -- as that ensure that only the sequencing of actions is strict, but the state -- `s` is still lazy, so is using `Control.Lens.%=`, which calls `modify` and -- not `modify'` under the hood. writeTVar var $! v1 pure r ---------------------------------------------------------------------------- -- Common functions ---------------------------------------------------------------------------- -- | Retrieves last PSK in chain of delegation started by public key -- and resolves the passed issuer to a public key. Uses database only.
984
true
true
0
14
247
118
59
59
null
null
lubomir/dot-race
Handler/Game.hs
bsd-3-clause
readMayAdd :: Int -> a -> TMVar [a] -> STM (Maybe [a]) readMayAdd maxLen x var = do xs <- readTMVar var if length xs >= maxLen then return Nothing else do let xs' = xs ++ [x] _ <- takeTMVar var putTMVar var xs' return (Just xs')
300
readMayAdd :: Int -> a -> TMVar [a] -> STM (Maybe [a]) readMayAdd maxLen x var = do xs <- readTMVar var if length xs >= maxLen then return Nothing else do let xs' = xs ++ [x] _ <- takeTMVar var putTMVar var xs' return (Just xs')
300
readMayAdd maxLen x var = do xs <- readTMVar var if length xs >= maxLen then return Nothing else do let xs' = xs ++ [x] _ <- takeTMVar var putTMVar var xs' return (Just xs')
245
false
true
0
15
119
130
59
71
null
null
fjarri/wigner
src/Wigner/Symbols.hs
bsd-3-clause
-- for positive-P default_map = fromList [(a, alpha), (b, beta)]
65
default_map = fromList [(a, alpha), (b, beta)]
46
default_map = fromList [(a, alpha), (b, beta)]
46
true
false
0
7
10
28
17
11
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
doCopyMutableArrayOp :: CmmExpr -> CmmExpr -> CmmExpr -> CmmExpr -> WordOff -> FCode () doCopyMutableArrayOp = emitCopyArray copy where -- The only time the memory might overlap is when the two arrays -- we were provided are the same array! -- TODO: Optimize branch for common case of no aliasing. copy src dst dst_p src_p bytes = do dflags <- getDynFlags [moveCall, cpyCall] <- forkAlts [ getCode $ emitMemmoveCall dst_p src_p (mkIntExpr dflags bytes) (mkIntExpr dflags (wORD_SIZE dflags)), getCode $ emitMemcpyCall dst_p src_p (mkIntExpr dflags bytes) (mkIntExpr dflags (wORD_SIZE dflags)) ] emit =<< mkCmmIfThenElse (cmmEqWord dflags src dst) moveCall cpyCall
786
doCopyMutableArrayOp :: CmmExpr -> CmmExpr -> CmmExpr -> CmmExpr -> WordOff -> FCode () doCopyMutableArrayOp = emitCopyArray copy where -- The only time the memory might overlap is when the two arrays -- we were provided are the same array! -- TODO: Optimize branch for common case of no aliasing. copy src dst dst_p src_p bytes = do dflags <- getDynFlags [moveCall, cpyCall] <- forkAlts [ getCode $ emitMemmoveCall dst_p src_p (mkIntExpr dflags bytes) (mkIntExpr dflags (wORD_SIZE dflags)), getCode $ emitMemcpyCall dst_p src_p (mkIntExpr dflags bytes) (mkIntExpr dflags (wORD_SIZE dflags)) ] emit =<< mkCmmIfThenElse (cmmEqWord dflags src dst) moveCall cpyCall
786
doCopyMutableArrayOp = emitCopyArray copy where -- The only time the memory might overlap is when the two arrays -- we were provided are the same array! -- TODO: Optimize branch for common case of no aliasing. copy src dst dst_p src_p bytes = do dflags <- getDynFlags [moveCall, cpyCall] <- forkAlts [ getCode $ emitMemmoveCall dst_p src_p (mkIntExpr dflags bytes) (mkIntExpr dflags (wORD_SIZE dflags)), getCode $ emitMemcpyCall dst_p src_p (mkIntExpr dflags bytes) (mkIntExpr dflags (wORD_SIZE dflags)) ] emit =<< mkCmmIfThenElse (cmmEqWord dflags src dst) moveCall cpyCall
677
false
true
0
15
223
184
91
93
null
null
jbracker/supermonad-plugin
examples/monad/hmtc/original/Scanner.hs
bsd-3-clause
isOpChr '.' = True
19
isOpChr '.' = True
19
isOpChr '.' = True
19
false
false
0
4
4
10
4
6
null
null
lpeterse/koka
src/Type/Unify.hs
apache-2.0
matchKind _ _ = False
21
matchKind _ _ = False
21
matchKind _ _ = False
21
false
false
0
5
4
11
5
6
null
null
wangwangwar/cis194
src/ch4/Ch4.hs
bsd-3-clause
h :: Tree a -> Integer h Leaf = -1
34
h :: Tree a -> Integer h Leaf = -1
34
h Leaf = -1
11
false
true
0
6
9
27
12
15
null
null
leshchevds/ganeti
src/Ganeti/Types.hs
bsd-2-clause
-- | Builds a job ID. makeJobId :: (Monad m) => Int -> m JobId makeJobId i | i >= 0 = return $ JobId i | otherwise = fail $ "Invalid value for job ID ' " ++ show i ++ "'"
182
makeJobId :: (Monad m) => Int -> m JobId makeJobId i | i >= 0 = return $ JobId i | otherwise = fail $ "Invalid value for job ID ' " ++ show i ++ "'"
160
makeJobId i | i >= 0 = return $ JobId i | otherwise = fail $ "Invalid value for job ID ' " ++ show i ++ "'"
119
true
true
0
8
54
72
34
38
null
null
bitemyapp/bloodhound
tests/Test/Common.hs
bsd-3-clause
newAge :: Int newAge = 31337
28
newAge :: Int newAge = 31337
28
newAge = 31337
14
false
true
0
6
5
18
7
11
null
null
zhensydow/ljcsandbox
lang/haskell/spoj/solved/ADDREV.hs
gpl-3.0
testCase = do [a,b] <- liftM words $ getLine putStrLn . dropWhile (=='0') . reverse . show $ summ (read $ reverse a) (read $ reverse b)
141
testCase = do [a,b] <- liftM words $ getLine putStrLn . dropWhile (=='0') . reverse . show $ summ (read $ reverse a) (read $ reverse b)
141
testCase = do [a,b] <- liftM words $ getLine putStrLn . dropWhile (=='0') . reverse . show $ summ (read $ reverse a) (read $ reverse b)
141
false
false
0
12
32
77
38
39
null
null
reinerp/hmatrix-static
Data/Packed/Static/Syntax.hs
gpl-3.0
innerCode = fmap concat $ many (fmap return innerCodeChar <|> codeChoices)
74
innerCode = fmap concat $ many (fmap return innerCodeChar <|> codeChoices)
74
innerCode = fmap concat $ many (fmap return innerCodeChar <|> codeChoices)
74
false
false
3
8
10
32
13
19
null
null
FranklinChen/hugs98-plus-Sep2006
packages/GLUT/examples/Misc/ExtractContours.hs
bsd-3-clause
rectangle :: ComplexContour DontCare rectangle = ComplexContour [ AnnotatedVertex (Vertex3 50 50 0) 0, AnnotatedVertex (Vertex3 200 50 0) 0, AnnotatedVertex (Vertex3 200 200 0) 0, AnnotatedVertex (Vertex3 50 200 0) 0 ]
234
rectangle :: ComplexContour DontCare rectangle = ComplexContour [ AnnotatedVertex (Vertex3 50 50 0) 0, AnnotatedVertex (Vertex3 200 50 0) 0, AnnotatedVertex (Vertex3 200 200 0) 0, AnnotatedVertex (Vertex3 50 200 0) 0 ]
234
rectangle = ComplexContour [ AnnotatedVertex (Vertex3 50 50 0) 0, AnnotatedVertex (Vertex3 200 50 0) 0, AnnotatedVertex (Vertex3 200 200 0) 0, AnnotatedVertex (Vertex3 50 200 0) 0 ]
197
false
true
0
9
48
89
44
45
null
null
spacekitteh/smcghc
compiler/cmm/PprC.hs
bsd-3-clause
-- ----------------------------------------------------------------------------- -- Foreign Calls pprCall :: SDoc -> CCallConv -> [Hinted CmmFormal] -> [Hinted CmmActual] -> SDoc pprCall ppr_fn cconv results args | not (is_cishCC cconv) = panic $ "pprCall: unknown calling convention" | otherwise = ppr_assign results (ppr_fn <> parens (commafy (map pprArg args))) <> semi where ppr_assign [] rhs = rhs ppr_assign [(one,hint)] rhs = pprLocalReg one <> ptext (sLit " = ") <> pprUnHint hint (localRegType one) <> rhs ppr_assign _other _rhs = panic "pprCall: multiple results" pprArg (expr, AddrHint) = cCast (ptext (sLit "void *")) expr -- see comment by machRepHintCType below pprArg (expr, SignedHint) = sdocWithDynFlags $ \dflags -> cCast (machRep_S_CType $ typeWidth $ cmmExprType dflags expr) expr pprArg (expr, _other) = pprExpr expr pprUnHint AddrHint rep = parens (machRepCType rep) pprUnHint SignedHint rep = parens (machRepCType rep) pprUnHint _ _ = empty -- Currently we only have these two calling conventions, but this might -- change in the future...
1,217
pprCall :: SDoc -> CCallConv -> [Hinted CmmFormal] -> [Hinted CmmActual] -> SDoc pprCall ppr_fn cconv results args | not (is_cishCC cconv) = panic $ "pprCall: unknown calling convention" | otherwise = ppr_assign results (ppr_fn <> parens (commafy (map pprArg args))) <> semi where ppr_assign [] rhs = rhs ppr_assign [(one,hint)] rhs = pprLocalReg one <> ptext (sLit " = ") <> pprUnHint hint (localRegType one) <> rhs ppr_assign _other _rhs = panic "pprCall: multiple results" pprArg (expr, AddrHint) = cCast (ptext (sLit "void *")) expr -- see comment by machRepHintCType below pprArg (expr, SignedHint) = sdocWithDynFlags $ \dflags -> cCast (machRep_S_CType $ typeWidth $ cmmExprType dflags expr) expr pprArg (expr, _other) = pprExpr expr pprUnHint AddrHint rep = parens (machRepCType rep) pprUnHint SignedHint rep = parens (machRepCType rep) pprUnHint _ _ = empty -- Currently we only have these two calling conventions, but this might -- change in the future...
1,118
pprCall ppr_fn cconv results args | not (is_cishCC cconv) = panic $ "pprCall: unknown calling convention" | otherwise = ppr_assign results (ppr_fn <> parens (commafy (map pprArg args))) <> semi where ppr_assign [] rhs = rhs ppr_assign [(one,hint)] rhs = pprLocalReg one <> ptext (sLit " = ") <> pprUnHint hint (localRegType one) <> rhs ppr_assign _other _rhs = panic "pprCall: multiple results" pprArg (expr, AddrHint) = cCast (ptext (sLit "void *")) expr -- see comment by machRepHintCType below pprArg (expr, SignedHint) = sdocWithDynFlags $ \dflags -> cCast (machRep_S_CType $ typeWidth $ cmmExprType dflags expr) expr pprArg (expr, _other) = pprExpr expr pprUnHint AddrHint rep = parens (machRepCType rep) pprUnHint SignedHint rep = parens (machRepCType rep) pprUnHint _ _ = empty -- Currently we only have these two calling conventions, but this might -- change in the future...
1,037
true
true
8
14
310
333
169
164
null
null
ben-schulz/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
mapPTermFC f g (PMatchApp fc n) = PMatchApp (f fc) n
66
mapPTermFC f g (PMatchApp fc n) = PMatchApp (f fc) n
66
mapPTermFC f g (PMatchApp fc n) = PMatchApp (f fc) n
66
false
false
0
7
24
35
15
20
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/basicTypes/MkId.hs
bsd-3-clause
voidArgId :: Id -- Local lambda-bound :: Void# voidArgId = mkSysLocal (fsLit "void") voidArgIdKey voidPrimTy
114
voidArgId :: Id voidArgId = mkSysLocal (fsLit "void") voidArgIdKey voidPrimTy
77
voidArgId = mkSysLocal (fsLit "void") voidArgIdKey voidPrimTy
61
true
true
0
7
20
25
13
12
null
null
sashabu/libcspm
src/CSPM/Evaluator/ValueSet.hs
bsd-3-clause
flipOrder :: Maybe Ordering -> Maybe Ordering flipOrder Nothing = Nothing
73
flipOrder :: Maybe Ordering -> Maybe Ordering flipOrder Nothing = Nothing
73
flipOrder Nothing = Nothing
27
false
true
0
6
10
24
11
13
null
null
didmar/helm
src/FRP/Helm/Time.hs
mit
timestamp :: Signal a -> Signal (Time, a) timestamp = lift2 (,) pure_time where pure_time = fst <~ (Signal $ (fmap . fmap) pure (every'' millisecond)) {-| Delay a signal by a certain amount of time. So (delay second Mouse.clicks) will update one second later than any mouse click. -}
290
timestamp :: Signal a -> Signal (Time, a) timestamp = lift2 (,) pure_time where pure_time = fst <~ (Signal $ (fmap . fmap) pure (every'' millisecond)) {-| Delay a signal by a certain amount of time. So (delay second Mouse.clicks) will update one second later than any mouse click. -}
290
timestamp = lift2 (,) pure_time where pure_time = fst <~ (Signal $ (fmap . fmap) pure (every'' millisecond)) {-| Delay a signal by a certain amount of time. So (delay second Mouse.clicks) will update one second later than any mouse click. -}
248
false
true
0
10
56
73
38
35
null
null
abakst/liquidhaskell
src/Language/Haskell/Liquid/GHC/Misc.hs
bsd-3-clause
srcSpanFilename = maybe "" unpackFS . srcSpanFileName_maybe
62
srcSpanFilename = maybe "" unpackFS . srcSpanFileName_maybe
62
srcSpanFilename = maybe "" unpackFS . srcSpanFileName_maybe
62
false
false
0
6
9
15
7
8
null
null
ssaavedra/liquidhaskell
tests/neg/grty3.hs
bsd-3-clause
{-@ choo :: [a] -> {v: Int | v > 0 } @-} choo = poo
51
choo = poo
10
choo = poo
10
true
false
1
5
15
11
4
7
null
null
flowbox-public/hint
src/Hint/InterpreterT.hs
bsd-3-clause
mkGhcError :: (GHC.SDoc -> String) -> GHC.SrcSpan -> GHC.PprStyle -> GHC.Message -> GhcError mkGhcError render src_span style msg = GhcError{errMsg = niceErrMsg} where niceErrMsg = render . GHC.withPprStyle style $ Compat.mkLocMessage src_span msg -- The MonadInterpreter instance
311
mkGhcError :: (GHC.SDoc -> String) -> GHC.SrcSpan -> GHC.PprStyle -> GHC.Message -> GhcError mkGhcError render src_span style msg = GhcError{errMsg = niceErrMsg} where niceErrMsg = render . GHC.withPprStyle style $ Compat.mkLocMessage src_span msg -- The MonadInterpreter instance
311
mkGhcError render src_span style msg = GhcError{errMsg = niceErrMsg} where niceErrMsg = render . GHC.withPprStyle style $ Compat.mkLocMessage src_span msg -- The MonadInterpreter instance
218
false
true
0
9
67
88
45
43
null
null
olsner/ghc
compiler/prelude/THNames.hs
bsd-3-clause
mkNameIdKey = mkPreludeMiscIdUnique 205
48
mkNameIdKey = mkPreludeMiscIdUnique 205
48
mkNameIdKey = mkPreludeMiscIdUnique 205
48
false
false
0
5
12
9
4
5
null
null
potatosalad/cis194
test/Cis194/Week1/AcceptHanoi.hs
bsd-3-clause
placeHanoi (HanoiState4 (a:as) b c d) ['a'] disc | disc > a = Nothing | otherwise = Just (HanoiState4 (disc:a:as) b c d)
124
placeHanoi (HanoiState4 (a:as) b c d) ['a'] disc | disc > a = Nothing | otherwise = Just (HanoiState4 (disc:a:as) b c d)
124
placeHanoi (HanoiState4 (a:as) b c d) ['a'] disc | disc > a = Nothing | otherwise = Just (HanoiState4 (disc:a:as) b c d)
124
false
false
1
10
26
78
39
39
null
null
ptol/oczor
src/Oczor/Parser/Expr.hs
mit
guardArgItem = md $ L.parens (try call <|> anonFunc <|> exprRecord) <|> labelWith expr <|> exprItemCommon
105
guardArgItem = md $ L.parens (try call <|> anonFunc <|> exprRecord) <|> labelWith expr <|> exprItemCommon
105
guardArgItem = md $ L.parens (try call <|> anonFunc <|> exprRecord) <|> labelWith expr <|> exprItemCommon
105
false
false
0
12
15
40
19
21
null
null
kwibus/myLang
tests/TestSearchTree.hs
bsd-3-clause
setSearchTree :: [(SearchTree Identity Int ,SearchTree Identity Int,[Int],Int)] setSearchTree = [ ( do x <- try [1 .. 3 :: Int] guard (x == 4) return x , Search $ TreeT $ Identity $ Node [ Leaf Nothing , Leaf Nothing , Leaf Nothing ] , [] , 3) , ( do x <- try [1 .. 3 :: Int] guard (x == 3) return x , Search $ TreeT $ Identity $ Node [ Leaf Nothing , Leaf Nothing , Leaf ( Just 3)] , [3] , 2) ]
499
setSearchTree :: [(SearchTree Identity Int ,SearchTree Identity Int,[Int],Int)] setSearchTree = [ ( do x <- try [1 .. 3 :: Int] guard (x == 4) return x , Search $ TreeT $ Identity $ Node [ Leaf Nothing , Leaf Nothing , Leaf Nothing ] , [] , 3) , ( do x <- try [1 .. 3 :: Int] guard (x == 3) return x , Search $ TreeT $ Identity $ Node [ Leaf Nothing , Leaf Nothing , Leaf ( Just 3)] , [3] , 2) ]
499
setSearchTree = [ ( do x <- try [1 .. 3 :: Int] guard (x == 4) return x , Search $ TreeT $ Identity $ Node [ Leaf Nothing , Leaf Nothing , Leaf Nothing ] , [] , 3) , ( do x <- try [1 .. 3 :: Int] guard (x == 3) return x , Search $ TreeT $ Identity $ Node [ Leaf Nothing , Leaf Nothing , Leaf ( Just 3)] , [3] , 2) ]
419
false
true
2
13
193
229
116
113
null
null
achirkin/qua-view
src/Model/Scenario/ServicePlugin.hs
mit
spURL :: Functor f => (JSString -> f JSString) -> ServicePlugin -> f ServicePlugin spURL f s = (\x -> s { _spURL = x }) <$> f (_spURL s)
142
spURL :: Functor f => (JSString -> f JSString) -> ServicePlugin -> f ServicePlugin spURL f s = (\x -> s { _spURL = x }) <$> f (_spURL s)
142
spURL f s = (\x -> s { _spURL = x }) <$> f (_spURL s)
53
false
true
0
9
35
77
38
39
null
null
GaloisInc/verification-game
web-prover/src/Rewrite.hs
bsd-3-clause
-- ensures invariant of no v |-> v singleSubst :: Eq a => a -> a -> Subst a singleSubst k v | k == v = emptySubst | otherwise = Subst $ Map.singleton k v
160
singleSubst :: Eq a => a -> a -> Subst a singleSubst k v | k == v = emptySubst | otherwise = Subst $ Map.singleton k v
125
singleSubst k v | k == v = emptySubst | otherwise = Subst $ Map.singleton k v
84
true
true
1
8
42
63
30
33
null
null
Courseography/courseography
app/Export/GetImages.hs
gpl-3.0
addCourseToSchedule :: [[[T.Text]]] -> ((T.Text, T.Text, T.Text), [Time]) -> [[[T.Text]]] addCourseToSchedule schedule (course, courseTimes) = let time' = filter (\t-> mod' (startHour t) 1 == 0) courseTimes timeArray = concatMap convertTimeToArray time' in foldl (addCourseHelper course) schedule timeArray
316
addCourseToSchedule :: [[[T.Text]]] -> ((T.Text, T.Text, T.Text), [Time]) -> [[[T.Text]]] addCourseToSchedule schedule (course, courseTimes) = let time' = filter (\t-> mod' (startHour t) 1 == 0) courseTimes timeArray = concatMap convertTimeToArray time' in foldl (addCourseHelper course) schedule timeArray
316
addCourseToSchedule schedule (course, courseTimes) = let time' = filter (\t-> mod' (startHour t) 1 == 0) courseTimes timeArray = concatMap convertTimeToArray time' in foldl (addCourseHelper course) schedule timeArray
226
false
true
0
15
47
138
75
63
null
null
urbanslug/ghc
compiler/codeGen/StgCmmArgRep.hs
bsd-3-clause
toArgRep Word64Rep = L
30
toArgRep Word64Rep = L
30
toArgRep Word64Rep = L
30
false
false
0
5
11
9
4
5
null
null
MaxDaten/yage-rendering
src/Yage/Rendering/Backend/Renderer.hs
mit
afterRender :: Renderer () afterRender = GL.checkError "afterRender: "
70
afterRender :: Renderer () afterRender = GL.checkError "afterRender: "
70
afterRender = GL.checkError "afterRender: "
43
false
true
0
6
8
21
10
11
null
null
lukexi/rumpus
src/Rumpus/Systems/Creator.hs
bsd-3-clause
newEntitySize :: V3 GLfloat newEntitySize = V3 0.4 0.4 0.1
58
newEntitySize :: V3 GLfloat newEntitySize = V3 0.4 0.4 0.1
58
newEntitySize = V3 0.4 0.4 0.1
30
false
true
0
5
9
21
10
11
null
null
alexander-at-github/eta
compiler/ETA/Parser/ApiAnnotation.hs
bsd-3-clause
getAndRemoveAnnotationComments :: ApiAnns -> SrcSpan -> ([Located AnnotationComment],ApiAnns) getAndRemoveAnnotationComments (anns,canns) span = case Map.lookup span canns of Just cs -> (cs,(anns,Map.delete span canns)) Nothing -> ([],(anns,canns)) -- -------------------------------------------------------------------- -- | API Annotations exist so that tools can perform source to source -- conversions of Haskell code. They are used to keep track of the -- various syntactic keywords that are not captured in the existing -- AST. -- -- The annotations, together with original source comments are made -- available in the @'pm_annotations'@ field of @'GHC.ParsedModule'@. -- Comments are only retained if @'Opt_KeepRawTokenStream'@ is set in -- @'DynFlags.DynFlags'@ before parsing. -- -- The wiki page describing this feature is -- https://ghc.haskell.org/trac/ghc/wiki/ApiAnnotations -- -- Note: in general the names of these are taken from the -- corresponding token, unless otherwise noted -- See note [Api annotations] above for details of the usage
1,100
getAndRemoveAnnotationComments :: ApiAnns -> SrcSpan -> ([Located AnnotationComment],ApiAnns) getAndRemoveAnnotationComments (anns,canns) span = case Map.lookup span canns of Just cs -> (cs,(anns,Map.delete span canns)) Nothing -> ([],(anns,canns)) -- -------------------------------------------------------------------- -- | API Annotations exist so that tools can perform source to source -- conversions of Haskell code. They are used to keep track of the -- various syntactic keywords that are not captured in the existing -- AST. -- -- The annotations, together with original source comments are made -- available in the @'pm_annotations'@ field of @'GHC.ParsedModule'@. -- Comments are only retained if @'Opt_KeepRawTokenStream'@ is set in -- @'DynFlags.DynFlags'@ before parsing. -- -- The wiki page describing this feature is -- https://ghc.haskell.org/trac/ghc/wiki/ApiAnnotations -- -- Note: in general the names of these are taken from the -- corresponding token, unless otherwise noted -- See note [Api annotations] above for details of the usage
1,100
getAndRemoveAnnotationComments (anns,canns) span = case Map.lookup span canns of Just cs -> (cs,(anns,Map.delete span canns)) Nothing -> ([],(anns,canns)) -- -------------------------------------------------------------------- -- | API Annotations exist so that tools can perform source to source -- conversions of Haskell code. They are used to keep track of the -- various syntactic keywords that are not captured in the existing -- AST. -- -- The annotations, together with original source comments are made -- available in the @'pm_annotations'@ field of @'GHC.ParsedModule'@. -- Comments are only retained if @'Opt_KeepRawTokenStream'@ is set in -- @'DynFlags.DynFlags'@ before parsing. -- -- The wiki page describing this feature is -- https://ghc.haskell.org/trac/ghc/wiki/ApiAnnotations -- -- Note: in general the names of these are taken from the -- corresponding token, unless otherwise noted -- See note [Api annotations] above for details of the usage
975
false
true
3
9
183
115
71
44
null
null
AlexeyRaga/eta
compiler/ETA/Prelude/PrelNames.hs
bsd-3-clause
eqIntegerPrimIdKey = mkPreludeMiscIdUnique 70
56
eqIntegerPrimIdKey = mkPreludeMiscIdUnique 70
56
eqIntegerPrimIdKey = mkPreludeMiscIdUnique 70
56
false
false
0
5
14
9
4
5
null
null
rrnewton/accelerate
Data/Array/Accelerate/Interpreter.hs
bsd-3-clause
-- Initial cursor. -- cursor0 :: Idx senv a -> Cursor senv a cursor0 x = Cursor { ref = x, cpos = 0 }
101
cursor0 :: Idx senv a -> Cursor senv a cursor0 x = Cursor { ref = x, cpos = 0 }
79
cursor0 x = Cursor { ref = x, cpos = 0 }
40
true
true
0
7
24
49
25
24
null
null
copton/ocram
ocram/src/Ocram/Analysis/CallGraph.hs
gpl-2.0
nodesByAttr :: GraphData -> (Attribute -> Bool) -> [G.Node] -- {{{3 nodesByAttr g attr = map fst $ filter (any attr . lblAttr . snd) $ G.labNodes g
147
nodesByAttr :: GraphData -> (Attribute -> Bool) -> [G.Node] nodesByAttr g attr = map fst $ filter (any attr . lblAttr . snd) $ G.labNodes g
139
nodesByAttr g attr = map fst $ filter (any attr . lblAttr . snd) $ G.labNodes g
79
true
true
2
10
27
76
36
40
null
null
rvion/lamdu
Lamdu/Data/ExampleDB.hs
gpl-3.0
createPublics :: MonadA m => T m (Public m) createPublics = do blessAnchors valTParamId <- lift $ namedId "val" _ <- createList valTParamId _ <- createMaybe valTParamId _ <- createStream valTParamId _ <- createInfiniteStream valTParamId bool <- createBool let infixType lType rType resType = recordType [ (Builtins.infixlTag, lType) , (Builtins.infixrTag, rType) ] ~> resType let arith n i = newPublicBuiltinQualified_ ("Prelude." ++ n) (Infix i) (Scheme.mono (infixType T.TInt T.TInt T.TInt)) arith "+" 6 arith "-" 6 arith "*" 7 arith "^" 8 newPublicBuiltin_ "%" (Infix 7) ["Prelude"] "mod" $ Scheme.mono $ infixType T.TInt T.TInt T.TInt newPublicBuiltin_ "//" (Infix 7) ["Prelude"] "div" $ Scheme.mono $ infixType T.TInt T.TInt T.TInt newPublicBuiltinQualified_ "Prelude.negate" OO $ Scheme.mono $ T.TInt ~> T.TInt newPublicBuiltinQualified_ "Prelude.sqrt" OO $ Scheme.mono $ T.TInt ~> T.TInt let cmp n = newPublicBuiltinQualified_ ("Prelude." ++ n) (Infix 4) $ forAll 1 $ \[a] -> infixType a a bool traverse_ cmp ["==", "/=", "<=", ">=", "<", ">"] & Writer.runWriterT <&> snd where newPublicBuiltin_ name presentationMode ffiPath ffiName typ = void $ newPublicBuiltin name presentationMode ffiPath ffiName typ newPublicBuiltin name presentationMode ffiPath ffiName typ = newPublicDef $ DataOps.newDefinition name presentationMode . Definition.BodyBuiltin $ Definition.Builtin (Definition.FFIName ffiPath ffiName) typ newPublicBuiltinQualified fullyQualifiedName presMode = newPublicBuiltin name presMode path name where path = init fqPath name = last fqPath fqPath = splitOn "." fullyQualifiedName newPublicBuiltinQualified_ fullyQualifiedName presMode typ = void $ newPublicBuiltinQualified fullyQualifiedName presMode typ
2,215
createPublics :: MonadA m => T m (Public m) createPublics = do blessAnchors valTParamId <- lift $ namedId "val" _ <- createList valTParamId _ <- createMaybe valTParamId _ <- createStream valTParamId _ <- createInfiniteStream valTParamId bool <- createBool let infixType lType rType resType = recordType [ (Builtins.infixlTag, lType) , (Builtins.infixrTag, rType) ] ~> resType let arith n i = newPublicBuiltinQualified_ ("Prelude." ++ n) (Infix i) (Scheme.mono (infixType T.TInt T.TInt T.TInt)) arith "+" 6 arith "-" 6 arith "*" 7 arith "^" 8 newPublicBuiltin_ "%" (Infix 7) ["Prelude"] "mod" $ Scheme.mono $ infixType T.TInt T.TInt T.TInt newPublicBuiltin_ "//" (Infix 7) ["Prelude"] "div" $ Scheme.mono $ infixType T.TInt T.TInt T.TInt newPublicBuiltinQualified_ "Prelude.negate" OO $ Scheme.mono $ T.TInt ~> T.TInt newPublicBuiltinQualified_ "Prelude.sqrt" OO $ Scheme.mono $ T.TInt ~> T.TInt let cmp n = newPublicBuiltinQualified_ ("Prelude." ++ n) (Infix 4) $ forAll 1 $ \[a] -> infixType a a bool traverse_ cmp ["==", "/=", "<=", ">=", "<", ">"] & Writer.runWriterT <&> snd where newPublicBuiltin_ name presentationMode ffiPath ffiName typ = void $ newPublicBuiltin name presentationMode ffiPath ffiName typ newPublicBuiltin name presentationMode ffiPath ffiName typ = newPublicDef $ DataOps.newDefinition name presentationMode . Definition.BodyBuiltin $ Definition.Builtin (Definition.FFIName ffiPath ffiName) typ newPublicBuiltinQualified fullyQualifiedName presMode = newPublicBuiltin name presMode path name where path = init fqPath name = last fqPath fqPath = splitOn "." fullyQualifiedName newPublicBuiltinQualified_ fullyQualifiedName presMode typ = void $ newPublicBuiltinQualified fullyQualifiedName presMode typ
2,215
createPublics = do blessAnchors valTParamId <- lift $ namedId "val" _ <- createList valTParamId _ <- createMaybe valTParamId _ <- createStream valTParamId _ <- createInfiniteStream valTParamId bool <- createBool let infixType lType rType resType = recordType [ (Builtins.infixlTag, lType) , (Builtins.infixrTag, rType) ] ~> resType let arith n i = newPublicBuiltinQualified_ ("Prelude." ++ n) (Infix i) (Scheme.mono (infixType T.TInt T.TInt T.TInt)) arith "+" 6 arith "-" 6 arith "*" 7 arith "^" 8 newPublicBuiltin_ "%" (Infix 7) ["Prelude"] "mod" $ Scheme.mono $ infixType T.TInt T.TInt T.TInt newPublicBuiltin_ "//" (Infix 7) ["Prelude"] "div" $ Scheme.mono $ infixType T.TInt T.TInt T.TInt newPublicBuiltinQualified_ "Prelude.negate" OO $ Scheme.mono $ T.TInt ~> T.TInt newPublicBuiltinQualified_ "Prelude.sqrt" OO $ Scheme.mono $ T.TInt ~> T.TInt let cmp n = newPublicBuiltinQualified_ ("Prelude." ++ n) (Infix 4) $ forAll 1 $ \[a] -> infixType a a bool traverse_ cmp ["==", "/=", "<=", ">=", "<", ">"] & Writer.runWriterT <&> snd where newPublicBuiltin_ name presentationMode ffiPath ffiName typ = void $ newPublicBuiltin name presentationMode ffiPath ffiName typ newPublicBuiltin name presentationMode ffiPath ffiName typ = newPublicDef $ DataOps.newDefinition name presentationMode . Definition.BodyBuiltin $ Definition.Builtin (Definition.FFIName ffiPath ffiName) typ newPublicBuiltinQualified fullyQualifiedName presMode = newPublicBuiltin name presMode path name where path = init fqPath name = last fqPath fqPath = splitOn "." fullyQualifiedName newPublicBuiltinQualified_ fullyQualifiedName presMode typ = void $ newPublicBuiltinQualified fullyQualifiedName presMode typ
2,171
false
true
21
16
716
577
288
289
null
null
Chase-C/Flocking-Haskell
src/OctreePar.hs
gpl-2.0
kNearestNeighbors node pos k maxR | inBounds subtree pos topR && length nearest >= k = nearest | otherwise = take k $ foldl combineNeighbors nearest $ getOtherNeighbors node pos k topR where subtree = getSubtree node (getOctant (center node) pos) nearest = kNearestNeighbors subtree pos k maxR topR = if length nearest >= k then snd $ last nearest else maxR
394
kNearestNeighbors node pos k maxR | inBounds subtree pos topR && length nearest >= k = nearest | otherwise = take k $ foldl combineNeighbors nearest $ getOtherNeighbors node pos k topR where subtree = getSubtree node (getOctant (center node) pos) nearest = kNearestNeighbors subtree pos k maxR topR = if length nearest >= k then snd $ last nearest else maxR
394
kNearestNeighbors node pos k maxR | inBounds subtree pos topR && length nearest >= k = nearest | otherwise = take k $ foldl combineNeighbors nearest $ getOtherNeighbors node pos k topR where subtree = getSubtree node (getOctant (center node) pos) nearest = kNearestNeighbors subtree pos k maxR topR = if length nearest >= k then snd $ last nearest else maxR
394
false
false
3
10
98
140
66
74
null
null
fmapfmapfmap/amazonka
amazonka-kinesis/gen/Network/AWS/Kinesis/DescribeStream.hs
mpl-2.0
-- | The response status code. dsrsResponseStatus :: Lens' DescribeStreamResponse Int dsrsResponseStatus = lens _dsrsResponseStatus (\ s a -> s{_dsrsResponseStatus = a})
169
dsrsResponseStatus :: Lens' DescribeStreamResponse Int dsrsResponseStatus = lens _dsrsResponseStatus (\ s a -> s{_dsrsResponseStatus = a})
138
dsrsResponseStatus = lens _dsrsResponseStatus (\ s a -> s{_dsrsResponseStatus = a})
83
true
true
1
9
21
45
22
23
null
null
meiersi/blaze-builder
Blaze/ByteString/Builder/Word.hs
bsd-3-clause
-- | Serialize a list of 'Word32's in little endian format. fromWord32sle :: [Word32] -> Builder fromWord32sle = fromWriteList writeWord32le
140
fromWord32sle :: [Word32] -> Builder fromWord32sle = fromWriteList writeWord32le
80
fromWord32sle = fromWriteList writeWord32le
43
true
true
0
6
19
22
12
10
null
null
siddhanathan/SWMMoutGetMB
src/Water/SWMM.hs
lgpl-3.0
getValues :: Int -> Get [Float] getValues n = replicateM n getFloat32le
71
getValues :: Int -> Get [Float] getValues n = replicateM n getFloat32le
71
getValues n = replicateM n getFloat32le
39
false
true
0
7
11
29
14
15
null
null
bernstein/breakout
src/Main.hs
bsd-3-clause
wallHit :: Behavior t P2 -> Event t () -> Event t (Velocity -> Velocity) wallHit ballPos frame = R.unions [top,left,right] where cTop = colliding ceilingPic ceilingPos ballPic <$> ballPos top = (r2.second (negate.abs).unr2) <$ whenE cTop frame cLeft = colliding sidePic wallLeftPos ballPic <$> ballPos left = (r2.first abs.unr2) <$ whenE cLeft frame cRight = colliding sidePic wallRightPos ballPic <$> ballPos right = (r2.first (negate.abs).unr2) <$ whenE cRight frame
505
wallHit :: Behavior t P2 -> Event t () -> Event t (Velocity -> Velocity) wallHit ballPos frame = R.unions [top,left,right] where cTop = colliding ceilingPic ceilingPos ballPic <$> ballPos top = (r2.second (negate.abs).unr2) <$ whenE cTop frame cLeft = colliding sidePic wallLeftPos ballPic <$> ballPos left = (r2.first abs.unr2) <$ whenE cLeft frame cRight = colliding sidePic wallRightPos ballPic <$> ballPos right = (r2.first (negate.abs).unr2) <$ whenE cRight frame
505
wallHit ballPos frame = R.unions [top,left,right] where cTop = colliding ceilingPic ceilingPos ballPic <$> ballPos top = (r2.second (negate.abs).unr2) <$ whenE cTop frame cLeft = colliding sidePic wallLeftPos ballPic <$> ballPos left = (r2.first abs.unr2) <$ whenE cLeft frame cRight = colliding sidePic wallRightPos ballPic <$> ballPos right = (r2.first (negate.abs).unr2) <$ whenE cRight frame
432
false
true
0
10
106
195
98
97
null
null
nevrenato/Hets_Fork
CSL/Parse_AS_Basic.hs
gpl-2.0
formulaorexpression :: OperatorState st => CharParser st EXPRESSION formulaorexpression = try aFormula <|> plusmin
114
formulaorexpression :: OperatorState st => CharParser st EXPRESSION formulaorexpression = try aFormula <|> plusmin
114
formulaorexpression = try aFormula <|> plusmin
46
false
true
0
6
13
30
14
16
null
null
runjak/projectEuler
src/Problem79.hs
mit
main :: IO () main = do triplets <- input let code = foldl imposeTriplet "01236789" triplets print code
109
main :: IO () main = do triplets <- input let code = foldl imposeTriplet "01236789" triplets print code
109
main = do triplets <- input let code = foldl imposeTriplet "01236789" triplets print code
95
false
true
1
11
24
49
20
29
null
null
brendanhay/gogol
gogol-firebasehosting/gen/Network/Google/Resource/FirebaseHosting/Sites/Releases/Create.hs
mpl-2.0
-- | Upload protocol for media (e.g. \"raw\", \"multipart\"). srcUploadProtocol :: Lens' SitesReleasesCreate (Maybe Text) srcUploadProtocol = lens _srcUploadProtocol (\ s a -> s{_srcUploadProtocol = a})
210
srcUploadProtocol :: Lens' SitesReleasesCreate (Maybe Text) srcUploadProtocol = lens _srcUploadProtocol (\ s a -> s{_srcUploadProtocol = a})
148
srcUploadProtocol = lens _srcUploadProtocol (\ s a -> s{_srcUploadProtocol = a})
88
true
true
0
9
33
48
25
23
null
null
beni55/snap-server
src/Snap/Internal/Http/Server/Date.hs
bsd-3-clause
fetchTime :: IO (ByteString,ByteString,CTime) fetchTime = do now <- epochTime t1 <- formatHttpTime now t2 <- formatLogTime now return (t1, t2, now) ------------------------------------------------------------------------------
246
fetchTime :: IO (ByteString,ByteString,CTime) fetchTime = do now <- epochTime t1 <- formatHttpTime now t2 <- formatLogTime now return (t1, t2, now) ------------------------------------------------------------------------------
246
fetchTime = do now <- epochTime t1 <- formatHttpTime now t2 <- formatLogTime now return (t1, t2, now) ------------------------------------------------------------------------------
200
false
true
0
8
42
66
33
33
null
null
nvidia-compiler-sdk/hsnvvm
Test/llvm-gen/LLVMGen.hs
mit
main :: IO () main = withContext $ \llvm -> do -- (1) generate LLVM using llvm-general ll <- either error B.pack `fmap` runErrorT (withModuleFromAST llvm helloWorld moduleString) -- (2) compile the llvm using NVVM NVVM.Result log res <- NVVM.compileModule ll "HelloWorld" [] let fail c = error $ "libNVVM exited with code: " ++ show c ++ "\n\n Message log:\n" ++ B.unpack log ++ "\n\n Generated LLVM:\n" ++ B.unpack ll bc <- either fail return res -- (3) initialise a CUDA context, load the module, and invoke the kernel CUDA.initialise [] dev <- CUDA.device 0 ctx <- CUDA.create dev [] mdl <- CUDA.loadData bc hello <- CUDA.getFun mdl "helloWorld" CUDA.launchKernel hello (1,1,1) (1,1,1) 0 Nothing [] CUDA.destroy ctx -- Lower a Haskell LLVM AST into a C++ objects. Then, generate LLVM assembly -- from the module. --
1,077
main :: IO () main = withContext $ \llvm -> do -- (1) generate LLVM using llvm-general ll <- either error B.pack `fmap` runErrorT (withModuleFromAST llvm helloWorld moduleString) -- (2) compile the llvm using NVVM NVVM.Result log res <- NVVM.compileModule ll "HelloWorld" [] let fail c = error $ "libNVVM exited with code: " ++ show c ++ "\n\n Message log:\n" ++ B.unpack log ++ "\n\n Generated LLVM:\n" ++ B.unpack ll bc <- either fail return res -- (3) initialise a CUDA context, load the module, and invoke the kernel CUDA.initialise [] dev <- CUDA.device 0 ctx <- CUDA.create dev [] mdl <- CUDA.loadData bc hello <- CUDA.getFun mdl "helloWorld" CUDA.launchKernel hello (1,1,1) (1,1,1) 0 Nothing [] CUDA.destroy ctx -- Lower a Haskell LLVM AST into a C++ objects. Then, generate LLVM assembly -- from the module. --
1,077
main = withContext $ \llvm -> do -- (1) generate LLVM using llvm-general ll <- either error B.pack `fmap` runErrorT (withModuleFromAST llvm helloWorld moduleString) -- (2) compile the llvm using NVVM NVVM.Result log res <- NVVM.compileModule ll "HelloWorld" [] let fail c = error $ "libNVVM exited with code: " ++ show c ++ "\n\n Message log:\n" ++ B.unpack log ++ "\n\n Generated LLVM:\n" ++ B.unpack ll bc <- either fail return res -- (3) initialise a CUDA context, load the module, and invoke the kernel CUDA.initialise [] dev <- CUDA.device 0 ctx <- CUDA.create dev [] mdl <- CUDA.loadData bc hello <- CUDA.getFun mdl "helloWorld" CUDA.launchKernel hello (1,1,1) (1,1,1) 0 Nothing [] CUDA.destroy ctx -- Lower a Haskell LLVM AST into a C++ objects. Then, generate LLVM assembly -- from the module. --
1,063
false
true
0
17
396
262
125
137
null
null
elieux/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
rTyConName = tcQual gHC_GENERICS (fsLit "R") rTyConKey
55
rTyConName = tcQual gHC_GENERICS (fsLit "R") rTyConKey
55
rTyConName = tcQual gHC_GENERICS (fsLit "R") rTyConKey
55
false
false
0
7
7
19
9
10
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F15.hs
bsd-3-clause
ptr_glIsEnablediNV :: FunPtr (GLenum -> GLuint -> IO GLboolean) ptr_glIsEnablediNV = unsafePerformIO $ getCommand "glIsEnablediNV"
130
ptr_glIsEnablediNV :: FunPtr (GLenum -> GLuint -> IO GLboolean) ptr_glIsEnablediNV = unsafePerformIO $ getCommand "glIsEnablediNV"
130
ptr_glIsEnablediNV = unsafePerformIO $ getCommand "glIsEnablediNV"
66
false
true
2
8
14
37
17
20
null
null
music-suite/music-pitch
src/Music/Pitch/Scale.hs
bsd-3-clause
inorPentaTonic :: Mode Pitch minorPentaTonic = invertMode 4 majorPentaTonic
76
minorPentaTonic :: Mode Pitch minorPentaTonic = invertMode 4 majorPentaTonic
76
minorPentaTonic = invertMode 4 majorPentaTonic
46
false
true
0
5
9
19
9
10
null
null
akhileshs/stack
src/Stack/Build/Cache.hs
bsd-3-clause
writeCache :: (Binary a, MonadIO m) => Path Abs Dir -> (Path Abs Dir -> m (Path Abs File)) -> a -> m () writeCache dir get' content = do fp <- get' dir liftIO $ encodeFile (toFilePath fp) content
247
writeCache :: (Binary a, MonadIO m) => Path Abs Dir -> (Path Abs Dir -> m (Path Abs File)) -> a -> m () writeCache dir get' content = do fp <- get' dir liftIO $ encodeFile (toFilePath fp) content
247
writeCache dir get' content = do fp <- get' dir liftIO $ encodeFile (toFilePath fp) content
99
false
true
0
12
91
106
50
56
null
null
sebcrozet/falling
Physics/Falling/Collision/Detection/IncrementalContactManifold.hs
bsd-3-clause
updateContacts :: (Transform m v, UnitVector v n) => m -> m -> [CollisionDescr v n] -> [CollisionDescr v n] updateContacts t1 t2 = map (\(Just c) -> c) . filter isJust . map (updateContact t1 t2) where isJust Nothing = False isJust _ = True
333
updateContacts :: (Transform m v, UnitVector v n) => m -> m -> [CollisionDescr v n] -> [CollisionDescr v n] updateContacts t1 t2 = map (\(Just c) -> c) . filter isJust . map (updateContact t1 t2) where isJust Nothing = False isJust _ = True
333
updateContacts t1 t2 = map (\(Just c) -> c) . filter isJust . map (updateContact t1 t2) where isJust Nothing = False isJust _ = True
207
false
true
0
11
138
120
60
60
null
null
eb-gh-cr/XMonadContrib1
XMonad/Prompt/Project.hs
bsd-3-clause
update :: String -> X () update selection = do ts <- XS.get :: X Projects grp <- activeProjectGroup XS.modify (\st -> st { projects = (projects st) ++ (add selection st grp), current = selection }) switchToLastSubworkspace selection PH.projectHistoryHook selection where add selection st grp = -- Is it lastWorkspace state not needed because there is -- workspaces list sorted by last access already? if (inArray selection (projects st)) then [] else [Project { name = selection, lastWorkspace = "", projectGroup = grp }] inArray selection st = not (null (filter (\elem -> name elem == selection) st))
698
update :: String -> X () update selection = do ts <- XS.get :: X Projects grp <- activeProjectGroup XS.modify (\st -> st { projects = (projects st) ++ (add selection st grp), current = selection }) switchToLastSubworkspace selection PH.projectHistoryHook selection where add selection st grp = -- Is it lastWorkspace state not needed because there is -- workspaces list sorted by last access already? if (inArray selection (projects st)) then [] else [Project { name = selection, lastWorkspace = "", projectGroup = grp }] inArray selection st = not (null (filter (\elem -> name elem == selection) st))
698
update selection = do ts <- XS.get :: X Projects grp <- activeProjectGroup XS.modify (\st -> st { projects = (projects st) ++ (add selection st grp), current = selection }) switchToLastSubworkspace selection PH.projectHistoryHook selection where add selection st grp = -- Is it lastWorkspace state not needed because there is -- workspaces list sorted by last access already? if (inArray selection (projects st)) then [] else [Project { name = selection, lastWorkspace = "", projectGroup = grp }] inArray selection st = not (null (filter (\elem -> name elem == selection) st))
673
false
true
1
14
195
214
111
103
null
null
jstolarek/ghc
libraries/base/System/Exit.hs
bsd-3-clause
-- | The computation 'exitSuccess' is equivalent to -- 'exitWith' 'ExitSuccess', It terminates the program -- successfully. exitSuccess :: IO a exitSuccess = exitWith ExitSuccess
178
exitSuccess :: IO a exitSuccess = exitWith ExitSuccess
54
exitSuccess = exitWith ExitSuccess
34
true
true
0
6
24
26
12
14
null
null
AaronFriel/eff-experiments
src/Data/Iota/Tagged/Eff1.hs
bsd-3-clause
ts2r = ((30,20) ==) $ run (runState ts2 (0::Int))
49
ts2r = ((30,20) ==) $ run (runState ts2 (0::Int))
49
ts2r = ((30,20) ==) $ run (runState ts2 (0::Int))
49
false
false
3
8
8
41
21
20
null
null
cmahon/opengl-examples
executable/Cube.hs
bsd-3-clause
-- type ErrorCallback = Error -> String -> IO () errorCallback :: GLFW.ErrorCallback errorCallback _ = hPutStrLn stderr
119
errorCallback :: GLFW.ErrorCallback errorCallback _ = hPutStrLn stderr
70
errorCallback _ = hPutStrLn stderr
34
true
true
1
5
17
25
10
15
null
null
ku-fpg/kansas-amber
legacy/Shallow/SevenSegment.hs
bsd-3-clause
-- | Seven-segment display demo. For each key-press, we display an equivalent pattern -- on the connected 7-segment-display. Note that most characters are not-mappable, so -- we use approximations if available. We use a shift-register to reduce the pin -- requirements on the Arduino, setting the bits serially. -- -- Parts: -- -- * The seven-segment digit we use is a common-cathode single-digit display, such as -- TDSG5150 (<http://www.vishay.com/docs/83126/83126.pdf>), or Microvity's IS121, -- but almost any such digit would do. Just pay attention to the line-connections, -- and do not forget the limiting resistors: 220 ohm's should do nicely. -- -- * The shift-register is Texas-Instruments 74HC595: <http://www.ti.com/lit/ds/symlink/sn74hc595.pdf>. -- Make sure to connect the register output lines to the seven-segment displays with the corresponding -- letters. That is, shift-registers @Q_A@ (Chip-pin 15) should connect to segment @A@; @Q_B@ (Chip-pin 1) -- to segment @B@, and so on. We do not use the shift-register @Q_H'@ (Chip-pin 9) in this design. -- -- <<http://http://github.com/ku-fpg/arduino-lab/raw/master/System/Hardware/Haskino/SamplePrograms/Schematics/SevenSegment.png>> sevenSegment :: IO () sevenSegment = withArduino False "/dev/cu.usbmodem1421" $ do initialize sr liftIO $ do hSetBuffering stdin NoBuffering putStrLn "Seven-Segment-Display demo." putStrLn "For each key-press, we will try to display it as a 7-segment character." putStrLn "If there is no good mapping (which is common), we'll just display a dot." putStrLn "" putStrLn "Press-keys to be shown on the display, Ctrl-C to quit.." forever repl where pushWord w = do mapM_ (push sr) [w `testBit` i | i <- [0..7]] store sr repl = do c <- liftIO getChar case char2SS c of Just w -> pushWord w Nothing -> pushWord (0x01::Word8) -- the dot, which also nicely covers the '.'
2,183
sevenSegment :: IO () sevenSegment = withArduino False "/dev/cu.usbmodem1421" $ do initialize sr liftIO $ do hSetBuffering stdin NoBuffering putStrLn "Seven-Segment-Display demo." putStrLn "For each key-press, we will try to display it as a 7-segment character." putStrLn "If there is no good mapping (which is common), we'll just display a dot." putStrLn "" putStrLn "Press-keys to be shown on the display, Ctrl-C to quit.." forever repl where pushWord w = do mapM_ (push sr) [w `testBit` i | i <- [0..7]] store sr repl = do c <- liftIO getChar case char2SS c of Just w -> pushWord w Nothing -> pushWord (0x01::Word8) -- the dot, which also nicely covers the '.'
954
sevenSegment = withArduino False "/dev/cu.usbmodem1421" $ do initialize sr liftIO $ do hSetBuffering stdin NoBuffering putStrLn "Seven-Segment-Display demo." putStrLn "For each key-press, we will try to display it as a 7-segment character." putStrLn "If there is no good mapping (which is common), we'll just display a dot." putStrLn "" putStrLn "Press-keys to be shown on the display, Ctrl-C to quit.." forever repl where pushWord w = do mapM_ (push sr) [w `testBit` i | i <- [0..7]] store sr repl = do c <- liftIO getChar case char2SS c of Just w -> pushWord w Nothing -> pushWord (0x01::Word8) -- the dot, which also nicely covers the '.'
932
true
true
2
12
593
218
102
116
null
null
amccausl/Swish
Swish/HaskellRDF/VarBindingTest.hs
lgpl-2.1
testHasEqv :: (Eq a, Show a) => String -> [a] -> [[a]] -> Test testHasEqv lab a1 a2 = TestCase ( assertMember ("testHasEqv:"++lab) ma1 ma2 ) where ma1 = ListTest a1 ma2 = map ListTest a2
215
testHasEqv :: (Eq a, Show a) => String -> [a] -> [[a]] -> Test testHasEqv lab a1 a2 = TestCase ( assertMember ("testHasEqv:"++lab) ma1 ma2 ) where ma1 = ListTest a1 ma2 = map ListTest a2
214
testHasEqv lab a1 a2 = TestCase ( assertMember ("testHasEqv:"++lab) ma1 ma2 ) where ma1 = ListTest a1 ma2 = map ListTest a2
151
false
true
1
10
64
95
49
46
null
null
ruslantalpa/postgrest
src/PostgREST/OpenAPI.hs
mit
makeProperty :: [PrimaryKey] -> Column -> (Text, Referenced Schema) makeProperty pks c = (colName c, Inline s) where e = if null $ colEnum c then Nothing else decode $ encode $ colEnum c fk ForeignKey{fkCol=Column{colTable=Table{tableName=a}, colName=b}} = intercalate "" ["This is a Foreign Key to `", a, ".", b, "`.<fk table='", a, "' column='", b, "'/>"] pk :: Bool pk = any (\p -> pkTable p == colTable c && pkName p == colName c) pks n = catMaybes [ Just "Note:" , if pk then Just "This is a Primary Key.<pk/>" else Nothing , fk <$> colFK c ] d = if length n > 1 then Just $ append (fromMaybe "" ((`append` "\n\n") <$> colDescription c)) (intercalate "\n" n) else colDescription c s = (mempty :: Schema) & default_ .~ (decode . toS =<< colDefault c) & description .~ d & enum_ .~ e & format ?~ colType c & maxLength .~ (fromIntegral <$> colMaxLen c) & type_ .~ toSwaggerType (colType c)
1,033
makeProperty :: [PrimaryKey] -> Column -> (Text, Referenced Schema) makeProperty pks c = (colName c, Inline s) where e = if null $ colEnum c then Nothing else decode $ encode $ colEnum c fk ForeignKey{fkCol=Column{colTable=Table{tableName=a}, colName=b}} = intercalate "" ["This is a Foreign Key to `", a, ".", b, "`.<fk table='", a, "' column='", b, "'/>"] pk :: Bool pk = any (\p -> pkTable p == colTable c && pkName p == colName c) pks n = catMaybes [ Just "Note:" , if pk then Just "This is a Primary Key.<pk/>" else Nothing , fk <$> colFK c ] d = if length n > 1 then Just $ append (fromMaybe "" ((`append` "\n\n") <$> colDescription c)) (intercalate "\n" n) else colDescription c s = (mempty :: Schema) & default_ .~ (decode . toS =<< colDefault c) & description .~ d & enum_ .~ e & format ?~ colType c & maxLength .~ (fromIntegral <$> colMaxLen c) & type_ .~ toSwaggerType (colType c)
1,033
makeProperty pks c = (colName c, Inline s) where e = if null $ colEnum c then Nothing else decode $ encode $ colEnum c fk ForeignKey{fkCol=Column{colTable=Table{tableName=a}, colName=b}} = intercalate "" ["This is a Foreign Key to `", a, ".", b, "`.<fk table='", a, "' column='", b, "'/>"] pk :: Bool pk = any (\p -> pkTable p == colTable c && pkName p == colName c) pks n = catMaybes [ Just "Note:" , if pk then Just "This is a Primary Key.<pk/>" else Nothing , fk <$> colFK c ] d = if length n > 1 then Just $ append (fromMaybe "" ((`append` "\n\n") <$> colDescription c)) (intercalate "\n" n) else colDescription c s = (mempty :: Schema) & default_ .~ (decode . toS =<< colDefault c) & description .~ d & enum_ .~ e & format ?~ colType c & maxLength .~ (fromIntegral <$> colMaxLen c) & type_ .~ toSwaggerType (colType c)
965
false
true
0
18
306
399
210
189
null
null
sheyll/b9-vm-image-builder
src/lib/B9/B9Config/Docker.hs
mit
dockerConfigToCPDocument :: DockerConfig -> CPDocument -> Either CPError CPDocument dockerConfigToCPDocument c cp = do cp1 <- addSectionCP cp cfgFileSection cp2 <- setShowCP cp1 cfgFileSection networkIdK $ _dockerNetworkId c containerCapsToCPDocument cp2 cfgFileSection $ _dockerCapabilities c
315
dockerConfigToCPDocument :: DockerConfig -> CPDocument -> Either CPError CPDocument dockerConfigToCPDocument c cp = do cp1 <- addSectionCP cp cfgFileSection cp2 <- setShowCP cp1 cfgFileSection networkIdK $ _dockerNetworkId c containerCapsToCPDocument cp2 cfgFileSection $ _dockerCapabilities c
315
dockerConfigToCPDocument c cp = do cp1 <- addSectionCP cp cfgFileSection cp2 <- setShowCP cp1 cfgFileSection networkIdK $ _dockerNetworkId c containerCapsToCPDocument cp2 cfgFileSection $ _dockerCapabilities c
229
false
true
0
9
55
77
34
43
null
null
robbertkrebbers/fewdigits
Data/Multinomial.hs
bsd-2-clause
prop_test_dy = dy f == xP*xP
28
prop_test_dy = dy f == xP*xP
28
prop_test_dy = dy f == xP*xP
28
false
false
2
5
5
21
8
13
null
null
kim/amazonka
amazonka-ec2/gen/Network/AWS/EC2/DeleteVpcPeeringConnection.hs
mpl-2.0
-- | The ID of the VPC peering connection. dvpcVpcPeeringConnectionId :: Lens' DeleteVpcPeeringConnection Text dvpcVpcPeeringConnectionId = lens _dvpcVpcPeeringConnectionId (\s a -> s { _dvpcVpcPeeringConnectionId = a })
232
dvpcVpcPeeringConnectionId :: Lens' DeleteVpcPeeringConnection Text dvpcVpcPeeringConnectionId = lens _dvpcVpcPeeringConnectionId (\s a -> s { _dvpcVpcPeeringConnectionId = a })
189
dvpcVpcPeeringConnectionId = lens _dvpcVpcPeeringConnectionId (\s a -> s { _dvpcVpcPeeringConnectionId = a })
121
true
true
0
9
38
40
22
18
null
null
BartAdv/Idris-dev
src/Idris/ElabQuasiquote.hs
bsd-3-clause
extractTUnquotes :: Int -> PTactic -> Elab' aux (PTactic, [(Name, PTerm)]) extractTUnquotes n (Rewrite t) = extract1 n Rewrite t
128
extractTUnquotes :: Int -> PTactic -> Elab' aux (PTactic, [(Name, PTerm)]) extractTUnquotes n (Rewrite t) = extract1 n Rewrite t
128
extractTUnquotes n (Rewrite t) = extract1 n Rewrite t
53
false
true
0
10
19
62
31
31
null
null
pparkkin/eta
compiler/ETA/Utils/GraphOps.hs
bsd-3-clause
checkNode :: (Uniquable k, Eq color) => Graph k cls color -> Node k cls color -> Bool -- ^ True if this node is ok checkNode graph node | Just color <- nodeColor node , Just neighbors <- sequence $ map (lookupNode graph) $ nonDetEltsUniqSet $ nodeConflicts node -- See Note [Unique Determinism and code generation] , neighbourColors <- catMaybes $ map nodeColor neighbors , elem color neighbourColors = False | otherwise = True
604
checkNode :: (Uniquable k, Eq color) => Graph k cls color -> Node k cls color -> Bool checkNode graph node | Just color <- nodeColor node , Just neighbors <- sequence $ map (lookupNode graph) $ nonDetEltsUniqSet $ nodeConflicts node -- See Note [Unique Determinism and code generation] , neighbourColors <- catMaybes $ map nodeColor neighbors , elem color neighbourColors = False | otherwise = True
558
checkNode graph node | Just color <- nodeColor node , Just neighbors <- sequence $ map (lookupNode graph) $ nonDetEltsUniqSet $ nodeConflicts node -- See Note [Unique Determinism and code generation] , neighbourColors <- catMaybes $ map nodeColor neighbors , elem color neighbourColors = False | otherwise = True
439
true
true
0
14
251
141
66
75
null
null
keera-studios/hsQt
Qtc/Gui/QAbstractScrollArea.hs
bsd-2-clause
maximumViewportSize :: QAbstractScrollArea a -> (()) -> IO (Size) maximumViewportSize x0 () = withSizeResult $ \csize_ret_w csize_ret_h -> withObjectPtr x0 $ \cobj_x0 -> qtc_QAbstractScrollArea_maximumViewportSize_qth cobj_x0 csize_ret_w csize_ret_h
259
maximumViewportSize :: QAbstractScrollArea a -> (()) -> IO (Size) maximumViewportSize x0 () = withSizeResult $ \csize_ret_w csize_ret_h -> withObjectPtr x0 $ \cobj_x0 -> qtc_QAbstractScrollArea_maximumViewportSize_qth cobj_x0 csize_ret_w csize_ret_h
259
maximumViewportSize x0 () = withSizeResult $ \csize_ret_w csize_ret_h -> withObjectPtr x0 $ \cobj_x0 -> qtc_QAbstractScrollArea_maximumViewportSize_qth cobj_x0 csize_ret_w csize_ret_h
193
false
true
0
9
36
70
35
35
null
null
TomMD/ghc
compiler/iface/BuildTyCl.hs
bsd-3-clause
totallyAbstractTyConRhs = AbstractTyCon False
46
totallyAbstractTyConRhs = AbstractTyCon False
46
totallyAbstractTyConRhs = AbstractTyCon False
46
false
false
0
5
4
9
4
5
null
null
GaloisInc/halvm-ghc
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprFunctionDescriptor :: CLabel -> SDoc pprFunctionDescriptor lab = pprGloblDecl lab $$ text ".section \".opd\",\"aw\"" $$ text ".align 3" $$ ppr lab <> char ':' $$ text ".quad ." <> ppr lab <> text ",.TOC.@tocbase,0" $$ text ".previous" $$ text ".type " <> ppr lab <> text ", @function" $$ char '.' <> ppr lab <> char ':'
641
pprFunctionDescriptor :: CLabel -> SDoc pprFunctionDescriptor lab = pprGloblDecl lab $$ text ".section \".opd\",\"aw\"" $$ text ".align 3" $$ ppr lab <> char ':' $$ text ".quad ." <> ppr lab <> text ",.TOC.@tocbase,0" $$ text ".previous" $$ text ".type " <> ppr lab <> text ", @function" $$ char '.' <> ppr lab <> char ':'
641
pprFunctionDescriptor lab = pprGloblDecl lab $$ text ".section \".opd\",\"aw\"" $$ text ".align 3" $$ ppr lab <> char ':' $$ text ".quad ." <> ppr lab <> text ",.TOC.@tocbase,0" $$ text ".previous" $$ text ".type " <> ppr lab <> text ", @function" $$ char '.' <> ppr lab <> char ':'
601
false
true
0
19
375
119
52
67
null
null
conal/shady-render
src/Shady/Attribute.hs
agpl-3.0
-- Or maybe -- -- type SinkUse z = z -> IO (forall a. Unop (IO a)) setAttribute' :: Pat a -> GlProgram -> SinkUse [a] setAttribute' p prog = sink p where sink :: Pat a -> SinkUse [a] sink UnitG = const (return id) sink (pa :* pb) = sink pa >++> sink pb sink (BaseG v) = vsink' prog v
307
setAttribute' :: Pat a -> GlProgram -> SinkUse [a] setAttribute' p prog = sink p where sink :: Pat a -> SinkUse [a] sink UnitG = const (return id) sink (pa :* pb) = sink pa >++> sink pb sink (BaseG v) = vsink' prog v
235
setAttribute' p prog = sink p where sink :: Pat a -> SinkUse [a] sink UnitG = const (return id) sink (pa :* pb) = sink pa >++> sink pb sink (BaseG v) = vsink' prog v
184
true
true
0
9
86
131
61
70
null
null
JacquesCarette/literate-scientific-software
code/drasil-example/Drasil/SWHS/Requirements.hs
bsd-2-clause
-- calcTempWtrOverTime = cic "calcTempWtrOverTime" (foldlSent [ S "Calculate and", phrase output_, S "the", phrase tempW, sParen (ch tempW :+: sParen (ch time)), S "over the", phrase simulation, phrase time, sParen (S "from" +:+ makeRef2S eBalanceOnWtr)]) "Calculate-Temperature-Water-Over-Time" funcReqDom
314
calcTempWtrOverTime = cic "calcTempWtrOverTime" (foldlSent [ S "Calculate and", phrase output_, S "the", phrase tempW, sParen (ch tempW :+: sParen (ch time)), S "over the", phrase simulation, phrase time, sParen (S "from" +:+ makeRef2S eBalanceOnWtr)]) "Calculate-Temperature-Water-Over-Time" funcReqDom
311
calcTempWtrOverTime = cic "calcTempWtrOverTime" (foldlSent [ S "Calculate and", phrase output_, S "the", phrase tempW, sParen (ch tempW :+: sParen (ch time)), S "over the", phrase simulation, phrase time, sParen (S "from" +:+ makeRef2S eBalanceOnWtr)]) "Calculate-Temperature-Water-Over-Time" funcReqDom
311
true
false
0
14
45
110
53
57
null
null
acowley/ghc
compiler/llvmGen/LlvmMangler.hs
bsd-3-clause
rewriteAVX :: Rewrite rewriteAVX dflags s | not isX86_64 = Nothing | isVmovdqa s = Just $ replaceOnce (B.pack "vmovdqa") (B.pack "vmovdqu") s | isVmovap s = Just $ replaceOnce (B.pack "vmovap") (B.pack "vmovup") s | otherwise = Nothing where isX86_64 = platformArch (targetPlatform dflags) == ArchX86_64 isVmovdqa = B.isPrefixOf (B.pack "vmovdqa") isVmovap = B.isPrefixOf (B.pack "vmovap") -- | @replaceOnce match replace bs@ replaces the first occurrence of the -- substring @match@ in @bs@ with @replace@.
536
rewriteAVX :: Rewrite rewriteAVX dflags s | not isX86_64 = Nothing | isVmovdqa s = Just $ replaceOnce (B.pack "vmovdqa") (B.pack "vmovdqu") s | isVmovap s = Just $ replaceOnce (B.pack "vmovap") (B.pack "vmovup") s | otherwise = Nothing where isX86_64 = platformArch (targetPlatform dflags) == ArchX86_64 isVmovdqa = B.isPrefixOf (B.pack "vmovdqa") isVmovap = B.isPrefixOf (B.pack "vmovap") -- | @replaceOnce match replace bs@ replaces the first occurrence of the -- substring @match@ in @bs@ with @replace@.
536
rewriteAVX dflags s | not isX86_64 = Nothing | isVmovdqa s = Just $ replaceOnce (B.pack "vmovdqa") (B.pack "vmovdqu") s | isVmovap s = Just $ replaceOnce (B.pack "vmovap") (B.pack "vmovup") s | otherwise = Nothing where isX86_64 = platformArch (targetPlatform dflags) == ArchX86_64 isVmovdqa = B.isPrefixOf (B.pack "vmovdqa") isVmovap = B.isPrefixOf (B.pack "vmovap") -- | @replaceOnce match replace bs@ replaces the first occurrence of the -- substring @match@ in @bs@ with @replace@.
514
false
true
5
9
104
166
81
85
null
null