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
ulyssesp/oscillare
src/Visuals.hs
gpl-3.0
lowPass = audiofilterCHOP (audiofilterCHOPfilter ?~ int 0) . (:[])
66
lowPass = audiofilterCHOP (audiofilterCHOPfilter ?~ int 0) . (:[])
66
lowPass = audiofilterCHOP (audiofilterCHOPfilter ?~ int 0) . (:[])
66
false
false
0
9
8
29
15
14
null
null
ARCCN/hcprobe
src/bench/icsumBench.hs
bsd-3-clause
bsFromW16 wlist16 = BS.pack $ wlist8 wlist16
44
bsFromW16 wlist16 = BS.pack $ wlist8 wlist16
44
bsFromW16 wlist16 = BS.pack $ wlist8 wlist16
44
false
false
1
6
6
21
8
13
null
null
peterokagey/haskellOEIS
src/AlecSequences/A270654.hs
apache-2.0
a270654 :: Integral a => a -> a a270654 i = genericIndex a270654_list (i - 1)
77
a270654 :: Integral a => a -> a a270654 i = genericIndex a270654_list (i - 1)
77
a270654 i = genericIndex a270654_list (i - 1)
45
false
true
0
8
15
43
19
24
null
null
gennady-em/haskel
src/E_Yi.hs
gpl-2.0
initSignals :: IO () initSignals = do tid <- myThreadId -- to pass \^C to keymap (think emacs mode) installHandler sigINT (Catch (return ())) Nothing -- ignore sequence_ $ flip map [sigPIPE, sigALRM] (\sig -> installHandler sig Ignore Nothing) -- and exit if we get the following: -- we have to do our own quitE here. sequence_ $ flip map [sigHUP, sigABRT, sigTERM] $ \sig -> do installHandler sig (CatchOnce $ do releaseSignals UI.end Editor.shutdown throwTo tid (ExitException (ExitFailure 2))) Nothing
660
initSignals :: IO () initSignals = do tid <- myThreadId -- to pass \^C to keymap (think emacs mode) installHandler sigINT (Catch (return ())) Nothing -- ignore sequence_ $ flip map [sigPIPE, sigALRM] (\sig -> installHandler sig Ignore Nothing) -- and exit if we get the following: -- we have to do our own quitE here. sequence_ $ flip map [sigHUP, sigABRT, sigTERM] $ \sig -> do installHandler sig (CatchOnce $ do releaseSignals UI.end Editor.shutdown throwTo tid (ExitException (ExitFailure 2))) Nothing
660
initSignals = do tid <- myThreadId -- to pass \^C to keymap (think emacs mode) installHandler sigINT (Catch (return ())) Nothing -- ignore sequence_ $ flip map [sigPIPE, sigALRM] (\sig -> installHandler sig Ignore Nothing) -- and exit if we get the following: -- we have to do our own quitE here. sequence_ $ flip map [sigHUP, sigABRT, sigTERM] $ \sig -> do installHandler sig (CatchOnce $ do releaseSignals UI.end Editor.shutdown throwTo tid (ExitException (ExitFailure 2))) Nothing
639
false
true
0
21
236
172
83
89
null
null
haskell-works/succinct-playground
app/Main.hs
bsd-3-clause
rank a (_:xs) i = 0 + (rank a xs (i - 1))
51
rank a (_:xs) i = 0 + (rank a xs (i - 1))
51
rank a (_:xs) i = 0 + (rank a xs (i - 1))
51
false
false
0
9
22
41
21
20
null
null
jacekszymanski/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxAUI_DOCKART_PANE_BORDER_SIZE :: Int wxAUI_DOCKART_PANE_BORDER_SIZE = 3
72
wxAUI_DOCKART_PANE_BORDER_SIZE :: Int wxAUI_DOCKART_PANE_BORDER_SIZE = 3
72
wxAUI_DOCKART_PANE_BORDER_SIZE = 3
34
false
true
0
4
5
11
6
5
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/topic/phantoms/2003-gibbons-demoor-jones-fun-with-phantom-types/src/Lib.hs
unlicense
toNumber :: [Bit] -> Int toNumber = toN 1 where toN t = \case [] -> 0 (b : bs) -> b * t + toN (t * 2) bs
122
toNumber :: [Bit] -> Int toNumber = toN 1 where toN t = \case [] -> 0 (b : bs) -> b * t + toN (t * 2) bs
122
toNumber = toN 1 where toN t = \case [] -> 0 (b : bs) -> b * t + toN (t * 2) bs
97
false
true
0
11
47
75
38
37
null
null
sdzivanovich/cs1699_deliverable5
Main.hs
bsd-3-clause
---------------- intercalate properties ---------------- -- intercalate definition from documentation. prop_intercalateIdentity :: [Int] -> [[Int]] -> Bool prop_intercalateIdentity x xs = My.intercalate x xs == My.concat (My.intersperse x xs)
243
prop_intercalateIdentity :: [Int] -> [[Int]] -> Bool prop_intercalateIdentity x xs = My.intercalate x xs == My.concat (My.intersperse x xs)
139
prop_intercalateIdentity x xs = My.intercalate x xs == My.concat (My.intersperse x xs)
86
true
true
0
9
28
66
33
33
null
null
TomMD/ghc
compiler/types/CoAxiom.hs
bsd-3-clause
brListMapM f (NextBranch h t) = do { fh <- f h ; ft <- brListMapM f t ; return (fh : ft) }
160
brListMapM f (NextBranch h t) = do { fh <- f h ; ft <- brListMapM f t ; return (fh : ft) }
160
brListMapM f (NextBranch h t) = do { fh <- f h ; ft <- brListMapM f t ; return (fh : ft) }
160
false
false
0
9
93
58
28
30
null
null
apollo-lang/apollo
src/Midi.hs
mit
- Best function exportMusic :: Int -> String -> Music -> IO () exportMusic tempo filename music = export (midiFromMusic music tempo) filename
142
exportMusic :: Int -> String -> Music -> IO () exportMusic tempo filename music = export (midiFromMusic music tempo) filename
125
exportMusic tempo filename music = export (midiFromMusic music tempo) filename
78
true
true
1
10
23
52
25
27
null
null
stoimenoff/functional-programming
examples/sorting.hs
mit
insertionsort [x] = [x]
23
insertionsort [x] = [x]
23
insertionsort [x] = [x]
23
false
false
0
6
3
15
8
7
null
null
yaxu/hstexture
Texture/Types.hs
gpl-3.0
resolve (Sig pA (Param nA)) sb = Sig (setIndex pA nA a') (Param nA) where (Sig pA' a') = resolve (Sig pA (pA !!! nA)) sb
122
resolve (Sig pA (Param nA)) sb = Sig (setIndex pA nA a') (Param nA) where (Sig pA' a') = resolve (Sig pA (pA !!! nA)) sb
122
resolve (Sig pA (Param nA)) sb = Sig (setIndex pA nA a') (Param nA) where (Sig pA' a') = resolve (Sig pA (pA !!! nA)) sb
122
false
false
0
9
27
82
40
42
null
null
GaloisInc/halvm-ghc
compiler/main/DynFlags.hs
bsd-3-clause
-- | Test whether a 'DumpFlag' is set dopt :: DumpFlag -> DynFlags -> Bool dopt f dflags = (fromEnum f `IntSet.member` dumpFlags dflags) || (verbosity dflags >= 4 && enableIfVerbose f) where enableIfVerbose Opt_D_dump_tc_trace = False enableIfVerbose Opt_D_dump_rn_trace = False enableIfVerbose Opt_D_dump_cs_trace = False enableIfVerbose Opt_D_dump_if_trace = False enableIfVerbose Opt_D_dump_vt_trace = False enableIfVerbose Opt_D_dump_tc = False enableIfVerbose Opt_D_dump_rn = False enableIfVerbose Opt_D_dump_rn_stats = False enableIfVerbose Opt_D_dump_hi_diffs = False enableIfVerbose Opt_D_verbose_core2core = False enableIfVerbose Opt_D_verbose_stg2stg = False enableIfVerbose Opt_D_dump_splices = False enableIfVerbose Opt_D_th_dec_file = False enableIfVerbose Opt_D_dump_rule_firings = False enableIfVerbose Opt_D_dump_rule_rewrites = False enableIfVerbose Opt_D_dump_simpl_trace = False enableIfVerbose Opt_D_dump_rtti = False enableIfVerbose Opt_D_dump_inlinings = False enableIfVerbose Opt_D_dump_core_stats = False enableIfVerbose Opt_D_dump_asm_stats = False enableIfVerbose Opt_D_dump_types = False enableIfVerbose Opt_D_dump_simpl_iterations = False enableIfVerbose Opt_D_dump_ticked = False enableIfVerbose Opt_D_dump_view_pattern_commoning = False enableIfVerbose Opt_D_dump_mod_cycles = False enableIfVerbose Opt_D_dump_mod_map = False enableIfVerbose _ = True -- | Set a 'DumpFlag'
2,055
dopt :: DumpFlag -> DynFlags -> Bool dopt f dflags = (fromEnum f `IntSet.member` dumpFlags dflags) || (verbosity dflags >= 4 && enableIfVerbose f) where enableIfVerbose Opt_D_dump_tc_trace = False enableIfVerbose Opt_D_dump_rn_trace = False enableIfVerbose Opt_D_dump_cs_trace = False enableIfVerbose Opt_D_dump_if_trace = False enableIfVerbose Opt_D_dump_vt_trace = False enableIfVerbose Opt_D_dump_tc = False enableIfVerbose Opt_D_dump_rn = False enableIfVerbose Opt_D_dump_rn_stats = False enableIfVerbose Opt_D_dump_hi_diffs = False enableIfVerbose Opt_D_verbose_core2core = False enableIfVerbose Opt_D_verbose_stg2stg = False enableIfVerbose Opt_D_dump_splices = False enableIfVerbose Opt_D_th_dec_file = False enableIfVerbose Opt_D_dump_rule_firings = False enableIfVerbose Opt_D_dump_rule_rewrites = False enableIfVerbose Opt_D_dump_simpl_trace = False enableIfVerbose Opt_D_dump_rtti = False enableIfVerbose Opt_D_dump_inlinings = False enableIfVerbose Opt_D_dump_core_stats = False enableIfVerbose Opt_D_dump_asm_stats = False enableIfVerbose Opt_D_dump_types = False enableIfVerbose Opt_D_dump_simpl_iterations = False enableIfVerbose Opt_D_dump_ticked = False enableIfVerbose Opt_D_dump_view_pattern_commoning = False enableIfVerbose Opt_D_dump_mod_cycles = False enableIfVerbose Opt_D_dump_mod_map = False enableIfVerbose _ = True -- | Set a 'DumpFlag'
2,017
dopt f dflags = (fromEnum f `IntSet.member` dumpFlags dflags) || (verbosity dflags >= 4 && enableIfVerbose f) where enableIfVerbose Opt_D_dump_tc_trace = False enableIfVerbose Opt_D_dump_rn_trace = False enableIfVerbose Opt_D_dump_cs_trace = False enableIfVerbose Opt_D_dump_if_trace = False enableIfVerbose Opt_D_dump_vt_trace = False enableIfVerbose Opt_D_dump_tc = False enableIfVerbose Opt_D_dump_rn = False enableIfVerbose Opt_D_dump_rn_stats = False enableIfVerbose Opt_D_dump_hi_diffs = False enableIfVerbose Opt_D_verbose_core2core = False enableIfVerbose Opt_D_verbose_stg2stg = False enableIfVerbose Opt_D_dump_splices = False enableIfVerbose Opt_D_th_dec_file = False enableIfVerbose Opt_D_dump_rule_firings = False enableIfVerbose Opt_D_dump_rule_rewrites = False enableIfVerbose Opt_D_dump_simpl_trace = False enableIfVerbose Opt_D_dump_rtti = False enableIfVerbose Opt_D_dump_inlinings = False enableIfVerbose Opt_D_dump_core_stats = False enableIfVerbose Opt_D_dump_asm_stats = False enableIfVerbose Opt_D_dump_types = False enableIfVerbose Opt_D_dump_simpl_iterations = False enableIfVerbose Opt_D_dump_ticked = False enableIfVerbose Opt_D_dump_view_pattern_commoning = False enableIfVerbose Opt_D_dump_mod_cycles = False enableIfVerbose Opt_D_dump_mod_map = False enableIfVerbose _ = True -- | Set a 'DumpFlag'
1,980
true
true
26
9
798
283
142
141
null
null
alanz/hroq
src/Data/Concurrent/Queue/Roq/AlarmServer.hs
bsd-3-clause
mkr :: String -> Process Regex mkr reg = makeRegexM reg
55
mkr :: String -> Process Regex mkr reg = makeRegexM reg
55
mkr reg = makeRegexM reg
24
false
true
0
6
10
24
11
13
null
null
ChadMcKinney/HaskellPortAudioExperiment
src/Main.hs
gpl-2.0
sineTable :: SineTable sineTable = newTable tableSize
53
sineTable :: SineTable sineTable = newTable tableSize
53
sineTable = newTable tableSize
30
false
true
0
5
6
14
7
7
null
null
codemac/yi-editor
src/Yi/UI/Cocoa/Utils.hs
gpl-2.0
new, autonew :: forall t. Class (NSObject_ t) -> IO (NSObject t) new x = do d <- description x >>= haskellString o <- alloc x logPutStrLn $ "New " ++ d init o
166
new, autonew :: forall t. Class (NSObject_ t) -> IO (NSObject t) new x = do d <- description x >>= haskellString o <- alloc x logPutStrLn $ "New " ++ d init o
166
new x = do d <- description x >>= haskellString o <- alloc x logPutStrLn $ "New " ++ d init o
101
false
true
2
10
41
93
40
53
null
null
purebred-mua/purebred
src/Purebred/Types/Parser/ByteString.hs
agpl-3.0
offset :: AT.Parser i Int offset = AT.Parser $ \t pos more _lose suc -> suc t pos more (AT.fromPos pos)
103
offset :: AT.Parser i Int offset = AT.Parser $ \t pos more _lose suc -> suc t pos more (AT.fromPos pos)
103
offset = AT.Parser $ \t pos more _lose suc -> suc t pos more (AT.fromPos pos)
77
false
true
0
10
20
54
27
27
null
null
jvilar/hrows
src/Cols.hs
gpl-2.0
parseSeparator "\\t" = '\t'
27
parseSeparator "\\t" = '\t'
27
parseSeparator "\\t" = '\t'
27
false
false
0
5
3
9
4
5
null
null
rahulmutt/ghcvm
compiler/Eta/Prelude/PrimOp.hs
bsd-3-clause
primOpCanFail IndexOffAddrOp_Word64 = True
42
primOpCanFail IndexOffAddrOp_Word64 = True
42
primOpCanFail IndexOffAddrOp_Word64 = True
42
false
false
0
5
3
9
4
5
null
null
reiddraper/cauterize
src/Cauterize/Lexer.hs
bsd-3-clause
charLiteral :: CauterizeP Char charLiteral = TOK.charLiteral lexer
66
charLiteral :: CauterizeP Char charLiteral = TOK.charLiteral lexer
66
charLiteral = TOK.charLiteral lexer
35
false
true
0
6
7
19
9
10
null
null
trezona-lecomte/quizster
src/Config.hs
mit
envPool Development = 1
23
envPool Development = 1
23
envPool Development = 1
23
false
false
0
5
3
9
4
5
null
null
maugier/cctk
src/CCTK/Edwards.hs
gpl-3.0
add :: forall c. EdwardsCurve c => Point c -> Point c -> Point c add (Point x1 y1 z1) (Point x2 y2 z2) = Point x3 y3 z3 where a = y1*z2 b = y1*z2 c = z1*x2 d = z1*y2 e = a*b f = c*d g = e+f h = e-f j = (a-c)*(b+d)-h k = (a+d)*(b+c)-g x3 = g*j y3 = h*k z3 = j*k*(curveK (Proxy :: Proxy c))
340
add :: forall c. EdwardsCurve c => Point c -> Point c -> Point c add (Point x1 y1 z1) (Point x2 y2 z2) = Point x3 y3 z3 where a = y1*z2 b = y1*z2 c = z1*x2 d = z1*y2 e = a*b f = c*d g = e+f h = e-f j = (a-c)*(b+d)-h k = (a+d)*(b+c)-g x3 = g*j y3 = h*k z3 = j*k*(curveK (Proxy :: Proxy c))
340
add (Point x1 y1 z1) (Point x2 y2 z2) = Point x3 y3 z3 where a = y1*z2 b = y1*z2 c = z1*x2 d = z1*y2 e = a*b f = c*d g = e+f h = e-f j = (a-c)*(b+d)-h k = (a+d)*(b+c)-g x3 = g*j y3 = h*k z3 = j*k*(curveK (Proxy :: Proxy c))
275
false
true
0
12
124
250
131
119
null
null
bluepeppers/highhockwho
src/Network/HighHock/Watcher.hs
agpl-3.0
getContainerDetails :: Runtime -> T.Text -> IO (Maybe A.Value) getContainerDetails r i = catch (get' $ dockerClientOpts r) handler where get' = D.decodeResponse . D._dockerGetQuery url url = T.unpack ("/containers/" `T.append` i `T.append` "/json") handler :: SomeException -> IO (Maybe A.Value) handler e = (errorM "getContainerDetails" $ "Failed to get container details: " ++ show e) >> return Nothing
450
getContainerDetails :: Runtime -> T.Text -> IO (Maybe A.Value) getContainerDetails r i = catch (get' $ dockerClientOpts r) handler where get' = D.decodeResponse . D._dockerGetQuery url url = T.unpack ("/containers/" `T.append` i `T.append` "/json") handler :: SomeException -> IO (Maybe A.Value) handler e = (errorM "getContainerDetails" $ "Failed to get container details: " ++ show e) >> return Nothing
450
getContainerDetails r i = catch (get' $ dockerClientOpts r) handler where get' = D.decodeResponse . D._dockerGetQuery url url = T.unpack ("/containers/" `T.append` i `T.append` "/json") handler :: SomeException -> IO (Maybe A.Value) handler e = (errorM "getContainerDetails" $ "Failed to get container details: " ++ show e) >> return Nothing
387
false
true
2
11
104
167
78
89
null
null
adept/hledger
hledger-lib/Hledger/Data/Journal.hs
gpl-3.0
journalToCost :: ConversionOp -> Journal -> Journal journalToCost cost j@Journal{jtxns=ts} = j{jtxns=map (transactionToCost styles cost) ts} where styles = journalCommodityStyles j -- | Add inferred equity postings to a 'Journal' using transaction prices.
262
journalToCost :: ConversionOp -> Journal -> Journal journalToCost cost j@Journal{jtxns=ts} = j{jtxns=map (transactionToCost styles cost) ts} where styles = journalCommodityStyles j -- | Add inferred equity postings to a 'Journal' using transaction prices.
262
journalToCost cost j@Journal{jtxns=ts} = j{jtxns=map (transactionToCost styles cost) ts} where styles = journalCommodityStyles j -- | Add inferred equity postings to a 'Journal' using transaction prices.
210
false
true
0
9
39
69
36
33
null
null
jystic/QuickSpec
qs1/TinyWMProperties.hs
bsd-3-clause
prop_push_I n (x :: T) = invariant $ push n x
57
prop_push_I n (x :: T) = invariant $ push n x
57
prop_push_I n (x :: T) = invariant $ push n x
57
false
false
0
6
22
29
13
16
null
null
aztecrex/haskell-experiments-free-monoid
src/Lib.hs
unlicense
-- express any monoid as a list in some "language" runMonoid :: Monoid b => (a -> b) -> [a] -> b runMonoid f [] = mempty
120
runMonoid :: Monoid b => (a -> b) -> [a] -> b runMonoid f [] = mempty
69
runMonoid f [] = mempty
23
true
true
0
8
26
44
23
21
null
null
cikusa/Eleco
Eleco/Core/QuadTree.hs
bsd-3-clause
foldRegion :: Region -> (b -> a -> b) -> (b -> a -> b) -> b -> QuadTree a -> b foldRegion (!ltx, !lty, !rbx, !rby) borderF f v tree = foldQr v $ treeRoot tree where !ltp = (ltx, lty) !rbp = (rbx, rby) foldQr !v (Node center rect subs@(a, b, c, d)) = if | total == 1 -> foldQr (foldQr v a) b | total == 5 -> foldQr (foldQr v c) d | total == 3 -> if ltqr == 0 then foldQr (foldQr v a) d else foldQr (foldQr v b) c | otherwise -> let (rltx, rlty, rrbx, rrby) = rect subsList = [a, b, c, d] in if rltx > ltx && rlty > lty && rrbx < rbx && rrby < rby then foldl (foldl f) v subsList else foldl foldQr v subsList where !ltqr = getQuadrant ltp center !rbqr = getQuadrant rbp center !total = ltqr + rbqr foldQr !v (Leaf _ !s) = borderF v s
940
foldRegion :: Region -> (b -> a -> b) -> (b -> a -> b) -> b -> QuadTree a -> b foldRegion (!ltx, !lty, !rbx, !rby) borderF f v tree = foldQr v $ treeRoot tree where !ltp = (ltx, lty) !rbp = (rbx, rby) foldQr !v (Node center rect subs@(a, b, c, d)) = if | total == 1 -> foldQr (foldQr v a) b | total == 5 -> foldQr (foldQr v c) d | total == 3 -> if ltqr == 0 then foldQr (foldQr v a) d else foldQr (foldQr v b) c | otherwise -> let (rltx, rlty, rrbx, rrby) = rect subsList = [a, b, c, d] in if rltx > ltx && rlty > lty && rrbx < rbx && rrby < rby then foldl (foldl f) v subsList else foldl foldQr v subsList where !ltqr = getQuadrant ltp center !rbqr = getQuadrant rbp center !total = ltqr + rbqr foldQr !v (Leaf _ !s) = borderF v s
940
foldRegion (!ltx, !lty, !rbx, !rby) borderF f v tree = foldQr v $ treeRoot tree where !ltp = (ltx, lty) !rbp = (rbx, rby) foldQr !v (Node center rect subs@(a, b, c, d)) = if | total == 1 -> foldQr (foldQr v a) b | total == 5 -> foldQr (foldQr v c) d | total == 3 -> if ltqr == 0 then foldQr (foldQr v a) d else foldQr (foldQr v b) c | otherwise -> let (rltx, rlty, rrbx, rrby) = rect subsList = [a, b, c, d] in if rltx > ltx && rlty > lty && rrbx < rbx && rrby < rby then foldl (foldl f) v subsList else foldl foldQr v subsList where !ltqr = getQuadrant ltp center !rbqr = getQuadrant rbp center !total = ltqr + rbqr foldQr !v (Leaf _ !s) = borderF v s
861
false
true
2
16
375
432
215
217
null
null
lstor/traxform
src/Main.hs
mit
outputFile = "formatted_transactions.csv"
41
outputFile = "formatted_transactions.csv"
41
outputFile = "formatted_transactions.csv"
41
false
false
0
4
2
6
3
3
null
null
lechimp-p/Typogenetics
TyGen.hs
mit
direction InG = -1
18
direction InG = -1
18
direction InG = -1
18
false
false
0
5
3
11
5
6
null
null
DanielWaterworth/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
constIsType (BI _) = False
26
constIsType (BI _) = False
26
constIsType (BI _) = False
26
false
false
0
7
4
15
7
8
null
null
geophf/1HaskellADay
exercises/HAD/Y2016/M10/D13/Solution.hs
mit
-- *Y2016.M10.D13.Solution> extent log ~> 73 -- What are the average number of days Ismael exercises each week? µdaysPerWeek :: ActivityLog d -> Float µdaysPerWeek = µ . map lengthr . groupBy ((==) `on` (\(y,w,d) -> w)) . map toWeekDate . Map.keys
252
µdaysPerWeek :: ActivityLog d -> Float µdaysPerWeek = µ . map lengthr . groupBy ((==) `on` (\(y,w,d) -> w)) . map toWeekDate . Map.keys
138
µdaysPerWeek = µ . map lengthr . groupBy ((==) `on` (\(y,w,d) -> w)) . map toWeekDate . Map.keys
99
true
true
0
13
46
75
42
33
null
null
ekr/tamarin-prover
lib/term/src/Term/LTerm.hs
gpl-3.0
-- | @m `evalFreshAvoiding` t@ evaluates the monadic action @m@ with a -- fresh-variable supply that avoids generating variables occurring in @t@. evalFreshAvoiding :: HasFrees t => Fresh a -> t -> a evalFreshAvoiding m a = evalFresh m (avoid a)
245
evalFreshAvoiding :: HasFrees t => Fresh a -> t -> a evalFreshAvoiding m a = evalFresh m (avoid a)
98
evalFreshAvoiding m a = evalFresh m (avoid a)
45
true
true
0
9
40
52
24
28
null
null
kolmodin/spdy
tests/Server.hs
bsd-3-clause
mkPipe :: IO Pipe mkPipe = liftM2 Pipe newTChanIO newTChanIO
60
mkPipe :: IO Pipe mkPipe = liftM2 Pipe newTChanIO newTChanIO
60
mkPipe = liftM2 Pipe newTChanIO newTChanIO
42
false
true
0
5
9
21
10
11
null
null
JohnLato/impulse
src/Reactive/Impulse/Internal/Weak.hs
lgpl-3.0
mkWeakTVarKey (TVar r#) v Nothing = IO $ \s -> case mkWeakNoFinalizer# r# v s of (# s1, w #) -> (# s1, Weak w #)
118
mkWeakTVarKey (TVar r#) v Nothing = IO $ \s -> case mkWeakNoFinalizer# r# v s of (# s1, w #) -> (# s1, Weak w #)
118
mkWeakTVarKey (TVar r#) v Nothing = IO $ \s -> case mkWeakNoFinalizer# r# v s of (# s1, w #) -> (# s1, Weak w #)
118
false
false
0
11
31
58
29
29
null
null
OS2World/DEV-UTIL-HUGS
oldlib/MinHeap.hs
bsd-3-clause
member (M y ys) x | x > y = C.member ys x | otherwise = (x == y)
72
member (M y ys) x | x > y = C.member ys x | otherwise = (x == y)
72
member (M y ys) x | x > y = C.member ys x | otherwise = (x == y)
72
false
false
0
8
26
57
25
32
null
null
sgraf812/fndiff
src/Disasm.hs
mit
takeWhileIncl :: (a -> Bool) -> [a] -> [a] takeWhileIncl p (x:xs) = x : if p x then takeWhileIncl p xs else []
110
takeWhileIncl :: (a -> Bool) -> [a] -> [a] takeWhileIncl p (x:xs) = x : if p x then takeWhileIncl p xs else []
110
takeWhileIncl p (x:xs) = x : if p x then takeWhileIncl p xs else []
67
false
true
0
7
23
66
35
31
null
null
phaazon/OpenGLRaw
RegistryProcessor/src/Main.hs
bsd-3-clause
isProfileDependent :: Modification -> Bool isProfileDependent = DM.isJust . modificationProfile
95
isProfileDependent :: Modification -> Bool isProfileDependent = DM.isJust . modificationProfile
95
isProfileDependent = DM.isJust . modificationProfile
52
false
true
0
6
9
21
11
10
null
null
brendanhay/gogol
gogol-classroom/gen/Network/Google/Resource/Classroom/Courses/CourseWorkMaterials/Create.hs
mpl-2.0
-- | V1 error format. ccwmcXgafv :: Lens' CoursesCourseWorkMaterialsCreate (Maybe Xgafv) ccwmcXgafv = lens _ccwmcXgafv (\ s a -> s{_ccwmcXgafv = a})
150
ccwmcXgafv :: Lens' CoursesCourseWorkMaterialsCreate (Maybe Xgafv) ccwmcXgafv = lens _ccwmcXgafv (\ s a -> s{_ccwmcXgafv = a})
128
ccwmcXgafv = lens _ccwmcXgafv (\ s a -> s{_ccwmcXgafv = a})
61
true
true
0
9
23
48
25
23
null
null
jbracker/supermonad-plugin
src/Control/Super/Plugin/Utils.hs
bsd-3-clause
- -- | Generates the set of all subsets of a given set. subsets :: (Ord a) => Set a -> Set (Set a) subsets s = case S.size s of 0 -> S.singleton S.empty _ -> let (x, s') = S.deleteFindMin s subs = subsets s' in S.map (S.insert x) subs `S.union` subs -} -- | Efficient removal of duplicate elements in O(n * log(n)). -- The result list is ordered in ascending order. removeDup :: (Ord a) => [a] -> [a] removeDup = (Set.toAscList) . (Set.fromList)
480
removeDup :: (Ord a) => [a] -> [a] removeDup = (Set.toAscList) . (Set.fromList)
79
removeDup = (Set.toAscList) . (Set.fromList)
44
true
true
1
15
122
176
91
85
null
null
christiaanb/ghc
compiler/basicTypes/MkId.hs
bsd-3-clause
unitBoxer :: Boxer unitBoxer = UnitBox
38
unitBoxer :: Boxer unitBoxer = UnitBox
38
unitBoxer = UnitBox
19
false
true
0
4
5
11
6
5
null
null
brendanhay/gogol
gogol-dataflow/gen/Network/Google/Resource/Dataflow/Projects/Locations/Jobs/List.hs
mpl-2.0
-- | The project which owns the jobs. pljlProjectId :: Lens' ProjectsLocationsJobsList Text pljlProjectId = lens _pljlProjectId (\ s a -> s{_pljlProjectId = a})
168
pljlProjectId :: Lens' ProjectsLocationsJobsList Text pljlProjectId = lens _pljlProjectId (\ s a -> s{_pljlProjectId = a})
130
pljlProjectId = lens _pljlProjectId (\ s a -> s{_pljlProjectId = a})
76
true
true
1
9
31
45
22
23
null
null
michaelficarra/purescript
src/Language/PureScript/Pretty/Values.hs
mit
prettyPrintCaseAlternative :: Int -> CaseAlternative -> Box prettyPrintCaseAlternative d _ | d < 0 = ellipsis
109
prettyPrintCaseAlternative :: Int -> CaseAlternative -> Box prettyPrintCaseAlternative d _ | d < 0 = ellipsis
109
prettyPrintCaseAlternative d _ | d < 0 = ellipsis
49
false
true
0
8
15
34
16
18
null
null
jcristovao/persistent
persistent-sqlite/Database/Persist/Sqlite.hs
mit
withStmt' :: MonadIO m => Sqlite.Connection -> Sqlite.Statement -> [PersistValue] -> Acquire (Source m [PersistValue]) withStmt' conn stmt vals = do _ <- mkAcquire (Sqlite.bind stmt vals >> return stmt) (Sqlite.reset conn) return pull where pull = do x <- liftIO $ Sqlite.step stmt case x of Sqlite.Done -> return () Sqlite.Row -> do cols <- liftIO $ Sqlite.columns stmt yield cols pull
554
withStmt' :: MonadIO m => Sqlite.Connection -> Sqlite.Statement -> [PersistValue] -> Acquire (Source m [PersistValue]) withStmt' conn stmt vals = do _ <- mkAcquire (Sqlite.bind stmt vals >> return stmt) (Sqlite.reset conn) return pull where pull = do x <- liftIO $ Sqlite.step stmt case x of Sqlite.Done -> return () Sqlite.Row -> do cols <- liftIO $ Sqlite.columns stmt yield cols pull
554
withStmt' conn stmt vals = do _ <- mkAcquire (Sqlite.bind stmt vals >> return stmt) (Sqlite.reset conn) return pull where pull = do x <- liftIO $ Sqlite.step stmt case x of Sqlite.Done -> return () Sqlite.Row -> do cols <- liftIO $ Sqlite.columns stmt yield cols pull
385
false
true
0
15
230
178
82
96
null
null
kadena-io/pact
src-tool/Pact/Analyze/Eval/Prop.hs
bsd-3-clause
evalProp :: SingI a => Prop a -> Query (S (Concrete a)) evalProp (CoreProp tm) = evalCore tm
95
evalProp :: SingI a => Prop a -> Query (S (Concrete a)) evalProp (CoreProp tm) = evalCore tm
95
evalProp (CoreProp tm) = evalCore tm
39
false
true
0
12
20
57
25
32
null
null
Denommus/stack
scripts/release/release.hs
bsd-3-clause
-- | @--arch@ command-line option name. archOptName :: String archOptName = "arch"
82
archOptName :: String archOptName = "arch"
42
archOptName = "arch"
20
true
true
0
4
11
12
7
5
null
null
onponomarev/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
iecNone :: String iecNone = "none"
34
iecNone :: String iecNone = "none"
34
iecNone = "none"
16
false
true
0
6
5
18
7
11
null
null
parapluu/encore
src/ir/AST/AST.hs
bsd-3-clause
hasBody Let {} = True
21
hasBody Let {} = True
21
hasBody Let {} = True
21
false
false
0
5
4
14
6
8
null
null
olsner/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
isCTyEqCan :: Ct -> Bool isCTyEqCan (CTyEqCan {}) = True
57
isCTyEqCan :: Ct -> Bool isCTyEqCan (CTyEqCan {}) = True
57
isCTyEqCan (CTyEqCan {}) = True
32
false
true
0
7
10
25
13
12
null
null
fbartnitzek/notes
7_languages/Haskell/io.hs
apache-2.0
tryIo = do putStr "Enter your name: " ; line <- getLine ; let {backwards = reverse line } ; return ("Hello. Your name backwards is " ++ backwards)
183
tryIo = do putStr "Enter your name: " ; line <- getLine ; let {backwards = reverse line } ; return ("Hello. Your name backwards is " ++ backwards)
183
tryIo = do putStr "Enter your name: " ; line <- getLine ; let {backwards = reverse line } ; return ("Hello. Your name backwards is " ++ backwards)
183
false
false
0
10
65
49
24
25
null
null
thoughtpolice/cabal
Cabal/Distribution/PackageDescription/Check.hs
bsd-3-clause
repoTypeDirname :: RepoType -> [FilePath] repoTypeDirname Darcs = ["_darcs"]
81
repoTypeDirname :: RepoType -> [FilePath] repoTypeDirname Darcs = ["_darcs"]
81
repoTypeDirname Darcs = ["_darcs"]
39
false
true
0
6
13
24
13
11
null
null
narurien/ganeti-ceph
src/Ganeti/OpParams.hs
gpl-2.0
-- | Pause instance at startup. pStartupPaused :: Field pStartupPaused = defaultFalse "startup_paused"
102
pStartupPaused :: Field pStartupPaused = defaultFalse "startup_paused"
70
pStartupPaused = defaultFalse "startup_paused"
46
true
true
0
6
12
21
9
12
null
null
tolysz/prepare-ghcjs
spec-lts8/cabal/Cabal/Distribution/Simple/Utils.hs
bsd-3-clause
moreRecentFile :: FilePath -> FilePath -> IO Bool moreRecentFile a b = do exists <- doesFileExist b if not exists then return True else do tb <- getModificationTime b ta <- getModificationTime a return (ta > tb) -- | Like 'moreRecentFile', but also checks that the first file exists.
320
moreRecentFile :: FilePath -> FilePath -> IO Bool moreRecentFile a b = do exists <- doesFileExist b if not exists then return True else do tb <- getModificationTime b ta <- getModificationTime a return (ta > tb) -- | Like 'moreRecentFile', but also checks that the first file exists.
320
moreRecentFile a b = do exists <- doesFileExist b if not exists then return True else do tb <- getModificationTime b ta <- getModificationTime a return (ta > tb) -- | Like 'moreRecentFile', but also checks that the first file exists.
270
false
true
0
12
85
88
40
48
null
null
ice1000/OI-codes
codewars/201-300/church-numbers.hs
agpl-3.0
add :: Number -> Number -> Number add (Nr a) (Nr b) = Nr $ \x -> a x . b x
74
add :: Number -> Number -> Number add (Nr a) (Nr b) = Nr $ \x -> a x . b x
74
add (Nr a) (Nr b) = Nr $ \x -> a x . b x
40
false
true
0
10
21
60
28
32
null
null
revnull/fixfile
src/Data/FixFile/BTree.hs
lgpl-3.0
-- | Lookup the values stored for the key 'k' in a 'Fixed' @('BTree' k v)@. lookupBTree :: (Ord k, Fixed g) => k -> g (BTree n k v) -> [v] lookupBTree k = ($ []) . cata phi where phi Empty l = l phi (Value v) l = v:l phi (Node 0 vec) l = let (_, eq, _) = split3 (splitRange k vec) vec in V.foldr (($) . snd) l eq phi (Node _ vec) l = let (_, eq, _) = split3 (s1 - 1, s2) vec (s1, s2) = splitRange k vec in V.foldr (($) . snd) l eq -- | 'Transaction' version of 'lookupBTree'.
536
lookupBTree :: (Ord k, Fixed g) => k -> g (BTree n k v) -> [v] lookupBTree k = ($ []) . cata phi where phi Empty l = l phi (Value v) l = v:l phi (Node 0 vec) l = let (_, eq, _) = split3 (splitRange k vec) vec in V.foldr (($) . snd) l eq phi (Node _ vec) l = let (_, eq, _) = split3 (s1 - 1, s2) vec (s1, s2) = splitRange k vec in V.foldr (($) . snd) l eq -- | 'Transaction' version of 'lookupBTree'.
460
lookupBTree k = ($ []) . cata phi where phi Empty l = l phi (Value v) l = v:l phi (Node 0 vec) l = let (_, eq, _) = split3 (splitRange k vec) vec in V.foldr (($) . snd) l eq phi (Node _ vec) l = let (_, eq, _) = split3 (s1 - 1, s2) vec (s1, s2) = splitRange k vec in V.foldr (($) . snd) l eq -- | 'Transaction' version of 'lookupBTree'.
397
true
true
0
13
171
259
135
124
null
null
nushio3/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
pprSkolInfo (RuleSkol name) = text "the RULE" <+> pprRuleName name
68
pprSkolInfo (RuleSkol name) = text "the RULE" <+> pprRuleName name
68
pprSkolInfo (RuleSkol name) = text "the RULE" <+> pprRuleName name
68
false
false
0
6
11
26
11
15
null
null
cimmanon/camellia-splices
Heist/Splices/Camellia/Session.hs
bsd-3-clause
sessionInfoSplice :: SnapletLens b SessionManager -> T.Text -> SnapletISplice b sessionInfoSplice = sessionTextSplice
117
sessionInfoSplice :: SnapletLens b SessionManager -> T.Text -> SnapletISplice b sessionInfoSplice = sessionTextSplice
117
sessionInfoSplice = sessionTextSplice
37
false
true
0
7
12
29
14
15
null
null
bigsleep/Wf
test/Wf/Web/JsonApiSpec.hs
mit
dicApp :: JsonRequest [Int] -> JsonResponse (M.Map String Int) dicApp (JsonRequest xs) = JsonResponse $ M.fromList $ zip (map show xs) xs
137
dicApp :: JsonRequest [Int] -> JsonResponse (M.Map String Int) dicApp (JsonRequest xs) = JsonResponse $ M.fromList $ zip (map show xs) xs
137
dicApp (JsonRequest xs) = JsonResponse $ M.fromList $ zip (map show xs) xs
74
false
true
0
9
21
66
32
34
null
null
ardumont/haskell-lab
src/functional-approach/ch3.hs
gpl-2.0
-- infinite function that never stops fn :: Num a => a -> t fn x = fn (x + 1)
77
fn :: Num a => a -> t fn x = fn (x + 1)
39
fn x = fn (x + 1)
17
true
true
0
8
20
42
19
23
null
null
m00nlight/hackerrank
functional/Interpreter-and-Compiler/BrainF__k-Interpreter/main.hs
gpl-2.0
mapBracket :: String -> [(Int, Int)] mapBracket prog = aux prog 0 [] [] where aux [] _ _ ret = ret aux ('[':ps) cur stack ret = aux ps (cur + 1) (('[',cur):stack) ret aux (']':ps) cur stack ret = let (_, idx) = head stack in aux ps (cur + 1) (tail stack) ((cur, idx):(idx,cur):ret) aux (_:ps) cur stack ret = aux ps (cur + 1) stack ret
411
mapBracket :: String -> [(Int, Int)] mapBracket prog = aux prog 0 [] [] where aux [] _ _ ret = ret aux ('[':ps) cur stack ret = aux ps (cur + 1) (('[',cur):stack) ret aux (']':ps) cur stack ret = let (_, idx) = head stack in aux ps (cur + 1) (tail stack) ((cur, idx):(idx,cur):ret) aux (_:ps) cur stack ret = aux ps (cur + 1) stack ret
411
mapBracket prog = aux prog 0 [] [] where aux [] _ _ ret = ret aux ('[':ps) cur stack ret = aux ps (cur + 1) (('[',cur):stack) ret aux (']':ps) cur stack ret = let (_, idx) = head stack in aux ps (cur + 1) (tail stack) ((cur, idx):(idx,cur):ret) aux (_:ps) cur stack ret = aux ps (cur + 1) stack ret
374
false
true
0
13
145
232
122
110
null
null
msakai/icfpc2015
src/Tactics/Util.hs
bsd-3-clause
test_allLockablePlaces = do Just input <- readProblem "problems/problem_1.json" let gs0 = head $ Game.initGameStates input [] m = allLockablePlaces gs0 Game.gameDisplay gs0 forM_ (Map.toList m) $ \(u, (cmds, g)) -> do putStrLn "----" Game.gameDisplay g
274
test_allLockablePlaces = do Just input <- readProblem "problems/problem_1.json" let gs0 = head $ Game.initGameStates input [] m = allLockablePlaces gs0 Game.gameDisplay gs0 forM_ (Map.toList m) $ \(u, (cmds, g)) -> do putStrLn "----" Game.gameDisplay g
274
test_allLockablePlaces = do Just input <- readProblem "problems/problem_1.json" let gs0 = head $ Game.initGameStates input [] m = allLockablePlaces gs0 Game.gameDisplay gs0 forM_ (Map.toList m) $ \(u, (cmds, g)) -> do putStrLn "----" Game.gameDisplay g
274
false
false
0
12
56
106
49
57
null
null
np/json-tools
json-select.hs
bsd-3-clause
selectJSONSegment :: Segment -> Value -> Either String (Frame, Value) selectJSONSegment (ArrayIndex ix) (Array vs) = case V.splitAt ix vs of (prefix, suffix) | V.null suffix -> Left msg | otherwise -> Right (ArrayFrm prefix (V.tail suffix), V.head suffix) where msg = "An array with an index "++show ix++" was expected"
349
selectJSONSegment :: Segment -> Value -> Either String (Frame, Value) selectJSONSegment (ArrayIndex ix) (Array vs) = case V.splitAt ix vs of (prefix, suffix) | V.null suffix -> Left msg | otherwise -> Right (ArrayFrm prefix (V.tail suffix), V.head suffix) where msg = "An array with an index "++show ix++" was expected"
349
selectJSONSegment (ArrayIndex ix) (Array vs) = case V.splitAt ix vs of (prefix, suffix) | V.null suffix -> Left msg | otherwise -> Right (ArrayFrm prefix (V.tail suffix), V.head suffix) where msg = "An array with an index "++show ix++" was expected"
279
false
true
0
14
80
139
67
72
null
null
tjakway/ghcjvm
compiler/types/Type.hs
bsd-3-clause
funArgTy (ForAllTy (Anon arg) _res) = arg
41
funArgTy (ForAllTy (Anon arg) _res) = arg
41
funArgTy (ForAllTy (Anon arg) _res) = arg
41
false
false
0
8
6
24
11
13
null
null
headprogrammingczar/cabal
Cabal/Distribution/Simple/Install.hs
bsd-3-clause
installIncludeFiles :: Verbosity -> Library -> FilePath -> IO () installIncludeFiles verbosity lib destIncludeDir = do let relincdirs = "." : filter (not.isAbsolute) (includeDirs lbi) lbi = libBuildInfo lib incs <- mapM (findInc relincdirs) (installIncludes lbi) sequence_ [ do createDirectoryIfMissingVerbose verbosity True destDir installOrdinaryFile verbosity srcFile destFile | (relFile, srcFile) <- incs , let destFile = destIncludeDir </> relFile destDir = takeDirectory destFile ] where findInc [] file = die ("can't find include file " ++ file) findInc (dir:dirs) file = do let path = dir </> file exists <- doesFileExist path if exists then return (file, path) else findInc dirs file
786
installIncludeFiles :: Verbosity -> Library -> FilePath -> IO () installIncludeFiles verbosity lib destIncludeDir = do let relincdirs = "." : filter (not.isAbsolute) (includeDirs lbi) lbi = libBuildInfo lib incs <- mapM (findInc relincdirs) (installIncludes lbi) sequence_ [ do createDirectoryIfMissingVerbose verbosity True destDir installOrdinaryFile verbosity srcFile destFile | (relFile, srcFile) <- incs , let destFile = destIncludeDir </> relFile destDir = takeDirectory destFile ] where findInc [] file = die ("can't find include file " ++ file) findInc (dir:dirs) file = do let path = dir </> file exists <- doesFileExist path if exists then return (file, path) else findInc dirs file
786
installIncludeFiles verbosity lib destIncludeDir = do let relincdirs = "." : filter (not.isAbsolute) (includeDirs lbi) lbi = libBuildInfo lib incs <- mapM (findInc relincdirs) (installIncludes lbi) sequence_ [ do createDirectoryIfMissingVerbose verbosity True destDir installOrdinaryFile verbosity srcFile destFile | (relFile, srcFile) <- incs , let destFile = destIncludeDir </> relFile destDir = takeDirectory destFile ] where findInc [] file = die ("can't find include file " ++ file) findInc (dir:dirs) file = do let path = dir </> file exists <- doesFileExist path if exists then return (file, path) else findInc dirs file
721
false
true
0
13
195
251
121
130
null
null
robstewart57/ripl
src/AstMappings.hs
bsd-3-clause
guardFromDimension comparator guardLhsExp dim = comparator guardLhsExp multExp where multExp = case dim of (Dim1 w) -> mkInt w (Dim2 w h) -> (C.BEMult (mkInt w) (mkInt h)) (Dim3 w h z) -> (C.BEMult (C.BEMult (mkInt w) (mkInt h)) (mkInt z))
311
guardFromDimension comparator guardLhsExp dim = comparator guardLhsExp multExp where multExp = case dim of (Dim1 w) -> mkInt w (Dim2 w h) -> (C.BEMult (mkInt w) (mkInt h)) (Dim3 w h z) -> (C.BEMult (C.BEMult (mkInt w) (mkInt h)) (mkInt z))
311
guardFromDimension comparator guardLhsExp dim = comparator guardLhsExp multExp where multExp = case dim of (Dim1 w) -> mkInt w (Dim2 w h) -> (C.BEMult (mkInt w) (mkInt h)) (Dim3 w h z) -> (C.BEMult (C.BEMult (mkInt w) (mkInt h)) (mkInt z))
311
false
false
0
13
112
136
66
70
null
null
wouwouwou/module_8
src/main/haskell/series4/exercise2.hs
apache-2.0
parse' :: NT -> String -> (TreeExt, String) parse' E (x:xs) | x == '(' = (BinNode n t1 t2, tail r3) -- verwacht: '(' E O E ')' | isDigit x = parse' N (x:xs) | isLetter x = parse' V (x:xs) where (t1, r1) = parse' E xs -- E (n, r2) = (toOperator (head r1), tail r1) -- O (t2, r3) = parse' E r2 -- E
402
parse' :: NT -> String -> (TreeExt, String) parse' E (x:xs) | x == '(' = (BinNode n t1 t2, tail r3) -- verwacht: '(' E O E ')' | isDigit x = parse' N (x:xs) | isLetter x = parse' V (x:xs) where (t1, r1) = parse' E xs -- E (n, r2) = (toOperator (head r1), tail r1) -- O (t2, r3) = parse' E r2 -- E
402
parse' E (x:xs) | x == '(' = (BinNode n t1 t2, tail r3) -- verwacht: '(' E O E ')' | isDigit x = parse' N (x:xs) | isLetter x = parse' V (x:xs) where (t1, r1) = parse' E xs -- E (n, r2) = (toOperator (head r1), tail r1) -- O (t2, r3) = parse' E r2 -- E
358
false
true
0
10
175
191
96
95
null
null
ezyang/ghc
hadrian/src/Hadrian/Oracles/TextFile.hs
bsd-3-clause
-- | Like 'lookupValues' but returns the empty list if the key is not found. lookupValuesOrEmpty :: FilePath -> String -> Action [String] lookupValuesOrEmpty file key = fromMaybe [] <$> lookupValues file key
207
lookupValuesOrEmpty :: FilePath -> String -> Action [String] lookupValuesOrEmpty file key = fromMaybe [] <$> lookupValues file key
130
lookupValuesOrEmpty file key = fromMaybe [] <$> lookupValues file key
69
true
true
0
8
32
45
22
23
null
null
janschulz/pandoc
src/Text/Pandoc/ImageSize.hs
gpl-2.0
imageSize :: ByteString -> Either String ImageSize imageSize img = case imageType img of Just Png -> mbToEither "could not determine PNG size" $ pngSize img Just Gif -> mbToEither "could not determine GIF size" $ gifSize img Just Jpeg -> jpegSize img Just Eps -> mbToEither "could not determine EPS size" $ epsSize img Just Pdf -> Left "could not determine PDF size" -- TODO Nothing -> Left "could not determine image type" where mbToEither msg Nothing = Left msg mbToEither _ (Just x) = Right x
558
imageSize :: ByteString -> Either String ImageSize imageSize img = case imageType img of Just Png -> mbToEither "could not determine PNG size" $ pngSize img Just Gif -> mbToEither "could not determine GIF size" $ gifSize img Just Jpeg -> jpegSize img Just Eps -> mbToEither "could not determine EPS size" $ epsSize img Just Pdf -> Left "could not determine PDF size" -- TODO Nothing -> Left "could not determine image type" where mbToEither msg Nothing = Left msg mbToEither _ (Just x) = Right x
558
imageSize img = case imageType img of Just Png -> mbToEither "could not determine PNG size" $ pngSize img Just Gif -> mbToEither "could not determine GIF size" $ gifSize img Just Jpeg -> jpegSize img Just Eps -> mbToEither "could not determine EPS size" $ epsSize img Just Pdf -> Left "could not determine PDF size" -- TODO Nothing -> Left "could not determine image type" where mbToEither msg Nothing = Left msg mbToEither _ (Just x) = Right x
507
false
true
1
9
150
154
69
85
null
null
mpickering/HaRe
old/testing/introNewDef/FunIn5_AstOut.hs
bsd-3-clause
foo x = zw + (zw * 5) where z = 3 w = 5 zw = z * w
74
foo x = zw + (zw * 5) where z = 3 w = 5 zw = z * w
74
foo x = zw + (zw * 5) where z = 3 w = 5 zw = z * w
74
false
false
7
6
43
57
22
35
null
null
roelvandijk/ftdi
Setup.hs
bsd-3-clause
runTests' ∷ Args → Bool → PackageDescription → LocalBuildInfo → IO () runTests' _ _ _ _ = system testcmd >> return () where testcmd = "." </> "dist" </> "build" </> "test" </> "test" -- Define __HADDOCK__ for CPP when running haddock.
237
runTests' ∷ Args → Bool → PackageDescription → LocalBuildInfo → IO () runTests' _ _ _ _ = system testcmd >> return () where testcmd = "." </> "dist" </> "build" </> "test" </> "test" -- Define __HADDOCK__ for CPP when running haddock.
237
runTests' _ _ _ _ = system testcmd >> return () where testcmd = "." </> "dist" </> "build" </> "test" </> "test" -- Define __HADDOCK__ for CPP when running haddock.
167
false
true
3
11
45
87
39
48
null
null
mattias-lundell/timber-llvm
src/Syntax.hs
bsd-3-clause
identQuals [] = []
36
identQuals [] = []
36
identQuals [] = []
36
false
false
1
6
21
17
6
11
null
null
jmitchell/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LASHR ITChar) [l, r] = doOp v (LASHR ITNative) [l, r]
61
doOp v (LASHR ITChar) [l, r] = doOp v (LASHR ITNative) [l, r]
61
doOp v (LASHR ITChar) [l, r] = doOp v (LASHR ITNative) [l, r]
61
false
false
0
7
12
44
23
21
null
null
johanneshilden/trombone
Trombone/Dispatch/Core.hs
bsd-3-clause
-- Comma-separate array elements and surround the output with parentheses. escVal (Array a) = listify a where f v = let (EscapedText t) = escVal v in t listify = EscapedText . Text.concat . intersperse "," . map f . Vect.toList
266
escVal (Array a) = listify a where f v = let (EscapedText t) = escVal v in t listify = EscapedText . Text.concat . intersperse "," . map f . Vect.toList
191
escVal (Array a) = listify a where f v = let (EscapedText t) = escVal v in t listify = EscapedText . Text.concat . intersperse "," . map f . Vect.toList
191
true
false
0
10
79
82
38
44
null
null
snowleopard/alga
src/Algebra/Graph.hs
mit
-- | Connect a given list of graphs. -- Complexity: /O(L)/ time and memory, and /O(S)/ size, where /L/ is the length -- of the given list, and /S/ is the sum of sizes of the graphs in the list. -- -- Good consumer of lists and producer of graphs. -- -- @ -- connects [] == 'empty' -- connects [x] == x -- connects [x,y] == 'connect' x y -- connects == 'foldr' 'connect' 'empty' -- 'isEmpty' . connects == 'all' 'isEmpty' -- @ connects :: [Graph a] -> Graph a connects xs = buildg $ \e v o c -> combineR e c (foldg e v o c) xs
552
connects :: [Graph a] -> Graph a connects xs = buildg $ \e v o c -> combineR e c (foldg e v o c) xs
99
connects xs = buildg $ \e v o c -> combineR e c (foldg e v o c) xs
66
true
true
0
9
137
76
44
32
null
null
ksallberg/block-battle
Block.hs
bsd-3-clause
clearField :: (Int -> Int) -> Field -> Field clearField changeRule f = [[changeRule r | r <- row] | row <- f]
109
clearField :: (Int -> Int) -> Field -> Field clearField changeRule f = [[changeRule r | r <- row] | row <- f]
109
clearField changeRule f = [[changeRule r | r <- row] | row <- f]
64
false
true
0
8
22
56
29
27
null
null
GaloisInc/halvm-ghc
compiler/basicTypes/Module.hs
bsd-3-clause
addBootSuffix :: FilePath -> FilePath -- ^ Add the @-boot@ suffix to .hs, .hi and .o files addBootSuffix path = path ++ "-boot"
127
addBootSuffix :: FilePath -> FilePath addBootSuffix path = path ++ "-boot"
74
addBootSuffix path = path ++ "-boot"
36
true
true
0
5
22
23
12
11
null
null
apunktbau/co4
test/CO4/Example/WCB_MatrixStandalone.hs
gpl-3.0
eqEnergy :: Energy -> Energy -> Bool eqEnergy a b = case a of MinusInfinity -> case b of MinusInfinity -> True Finite g -> False Finite f -> case b of MinusInfinity -> False Finite g -> eqNat f g
235
eqEnergy :: Energy -> Energy -> Bool eqEnergy a b = case a of MinusInfinity -> case b of MinusInfinity -> True Finite g -> False Finite f -> case b of MinusInfinity -> False Finite g -> eqNat f g
235
eqEnergy a b = case a of MinusInfinity -> case b of MinusInfinity -> True Finite g -> False Finite f -> case b of MinusInfinity -> False Finite g -> eqNat f g
198
false
true
0
11
80
86
41
45
null
null
olsner/ghc
testsuite/tests/gadt/red-black.hs
bsd-3-clause
ins n (BNode x m y) | n <= m = black (ins n x) m y
50
ins n (BNode x m y) | n <= m = black (ins n x) m y
50
ins n (BNode x m y) | n <= m = black (ins n x) m y
50
false
false
0
8
16
46
21
25
null
null
snoyberg/publicsuffixlist
CreateTest.hs
bsd-2-clause
startswithdot :: String -> Bool startswithdot = matchTest regex where regex = makeRegex "^checkPublicSuffix\\('\\.(.+)', (.+)\\);$" :: Regex
142
startswithdot :: String -> Bool startswithdot = matchTest regex where regex = makeRegex "^checkPublicSuffix\\('\\.(.+)', (.+)\\);$" :: Regex
142
startswithdot = matchTest regex where regex = makeRegex "^checkPublicSuffix\\('\\.(.+)', (.+)\\);$" :: Regex
110
false
true
0
7
18
41
18
23
null
null
ckaestne/CIDE
other/CaseStudies/fgl/CIDEfgl/Data/Graph/Inductive/Graphviz.hs
gpl-3.0
sq ('\'' : s) | last s == '\'' = init s | otherwise = s
63
sq ('\'' : s) | last s == '\'' = init s | otherwise = s
63
sq ('\'' : s) | last s == '\'' = init s | otherwise = s
63
false
false
1
9
23
41
18
23
null
null
LightAndLight/hindley-milner
src/Phil/PHP/AST.hs
bsd-3-clause
phpId :: Text -> PHPId phpId input = PHPId $ go input where go i = case uncons i of Nothing -> "" Just ('\'', rest) -> "Prime" <> go rest Just (c, rest) -> cons c $ go rest
196
phpId :: Text -> PHPId phpId input = PHPId $ go input where go i = case uncons i of Nothing -> "" Just ('\'', rest) -> "Prime" <> go rest Just (c, rest) -> cons c $ go rest
196
phpId input = PHPId $ go input where go i = case uncons i of Nothing -> "" Just ('\'', rest) -> "Prime" <> go rest Just (c, rest) -> cons c $ go rest
173
false
true
0
9
63
95
46
49
null
null
robrix/ui-effects
src/GL/Shader.hs
bsd-3-clause
toGLSLAlgebra :: forall x. ShaderF x -> (x -> ShowS) -> ShowS toGLSLAlgebra shader run = case shader of Bind var -> showVarDeclQualifier var . sp . showsGLSLType (Proxy :: Proxy x) . sp . showString (varName var) . showChar ';' . nl . run var Function name args body -> showsGLSLType (Proxy :: Proxy x) . sp . showString name . showParen True (foldr (.) id (intersperse (showString ", ") (if null args then [ showsGLSLType (Proxy :: Proxy ()) ] else run <$> args))) . sp . showBrace True (nl . sp . sp . run body) Get v -> var v Set v value -> var v . sp . showChar '=' . sp . run value . showChar ';' . nl V4 v -> showsGLSLValue v . run v Add a b -> op '+' a b Sub a b -> op '-' a b Mul a b -> op '*' a b Div a b -> op '/' a b Abs a -> fun "abs" a Signum a -> fun "sign" a MulMV matrix column -> recur vec matrix . showChar '*' . recur run column Sin a -> fun "sin" a Cos a -> fun "cos" a Tan a -> fun "tan" a ASin a -> fun "asin" a ACos a -> fun "acos" a ATan a -> fun "atan" a SinH a -> fun "sinh" a CosH a -> fun "cosh" a TanH a -> fun "tanh" a ASinH a -> fun "asinh" a ACosH a -> fun "acosh" a ATanH a -> fun "atanh" a Exp a -> fun "exp" a Log a -> fun "log" a where op o a b = showParen True $ run a . sp . showChar o . sp . run b fun f a = showString f . showParen True (run a) var = showString . varName sp = showChar ' ' nl = showChar '\n' vec v = showString "vec" . shows (length v) . showParen True (foldr (.) id (run <$> v)) recur = (iterFreer toGLSLAlgebra .) . fmap showBrace c b = if c then showChar '{' . b . showChar '}' else b showVarDeclQualifier var = showString $ case var of Uniform _ -> "uniform" In _ -> "in" Out _ -> "out"
1,816
toGLSLAlgebra :: forall x. ShaderF x -> (x -> ShowS) -> ShowS toGLSLAlgebra shader run = case shader of Bind var -> showVarDeclQualifier var . sp . showsGLSLType (Proxy :: Proxy x) . sp . showString (varName var) . showChar ';' . nl . run var Function name args body -> showsGLSLType (Proxy :: Proxy x) . sp . showString name . showParen True (foldr (.) id (intersperse (showString ", ") (if null args then [ showsGLSLType (Proxy :: Proxy ()) ] else run <$> args))) . sp . showBrace True (nl . sp . sp . run body) Get v -> var v Set v value -> var v . sp . showChar '=' . sp . run value . showChar ';' . nl V4 v -> showsGLSLValue v . run v Add a b -> op '+' a b Sub a b -> op '-' a b Mul a b -> op '*' a b Div a b -> op '/' a b Abs a -> fun "abs" a Signum a -> fun "sign" a MulMV matrix column -> recur vec matrix . showChar '*' . recur run column Sin a -> fun "sin" a Cos a -> fun "cos" a Tan a -> fun "tan" a ASin a -> fun "asin" a ACos a -> fun "acos" a ATan a -> fun "atan" a SinH a -> fun "sinh" a CosH a -> fun "cosh" a TanH a -> fun "tanh" a ASinH a -> fun "asinh" a ACosH a -> fun "acosh" a ATanH a -> fun "atanh" a Exp a -> fun "exp" a Log a -> fun "log" a where op o a b = showParen True $ run a . sp . showChar o . sp . run b fun f a = showString f . showParen True (run a) var = showString . varName sp = showChar ' ' nl = showChar '\n' vec v = showString "vec" . shows (length v) . showParen True (foldr (.) id (run <$> v)) recur = (iterFreer toGLSLAlgebra .) . fmap showBrace c b = if c then showChar '{' . b . showChar '}' else b showVarDeclQualifier var = showString $ case var of Uniform _ -> "uniform" In _ -> "in" Out _ -> "out"
1,816
toGLSLAlgebra shader run = case shader of Bind var -> showVarDeclQualifier var . sp . showsGLSLType (Proxy :: Proxy x) . sp . showString (varName var) . showChar ';' . nl . run var Function name args body -> showsGLSLType (Proxy :: Proxy x) . sp . showString name . showParen True (foldr (.) id (intersperse (showString ", ") (if null args then [ showsGLSLType (Proxy :: Proxy ()) ] else run <$> args))) . sp . showBrace True (nl . sp . sp . run body) Get v -> var v Set v value -> var v . sp . showChar '=' . sp . run value . showChar ';' . nl V4 v -> showsGLSLValue v . run v Add a b -> op '+' a b Sub a b -> op '-' a b Mul a b -> op '*' a b Div a b -> op '/' a b Abs a -> fun "abs" a Signum a -> fun "sign" a MulMV matrix column -> recur vec matrix . showChar '*' . recur run column Sin a -> fun "sin" a Cos a -> fun "cos" a Tan a -> fun "tan" a ASin a -> fun "asin" a ACos a -> fun "acos" a ATan a -> fun "atan" a SinH a -> fun "sinh" a CosH a -> fun "cosh" a TanH a -> fun "tanh" a ASinH a -> fun "asinh" a ACosH a -> fun "acosh" a ATanH a -> fun "atanh" a Exp a -> fun "exp" a Log a -> fun "log" a where op o a b = showParen True $ run a . sp . showChar o . sp . run b fun f a = showString f . showParen True (run a) var = showString . varName sp = showChar ' ' nl = showChar '\n' vec v = showString "vec" . shows (length v) . showParen True (foldr (.) id (run <$> v)) recur = (iterFreer toGLSLAlgebra .) . fmap showBrace c b = if c then showChar '{' . b . showChar '}' else b showVarDeclQualifier var = showString $ case var of Uniform _ -> "uniform" In _ -> "in" Out _ -> "out"
1,754
false
true
0
22
550
896
416
480
null
null
oldmanmike/ghc
compiler/typecheck/TcPluginM.hs
bsd-3-clause
-- | Create a new wanted constraint. newWanted :: CtLoc -> PredType -> TcPluginM CtEvidence newWanted loc pty = unsafeTcPluginTcM (TcM.newWanted (TcM.ctLocOrigin loc) Nothing pty)
182
newWanted :: CtLoc -> PredType -> TcPluginM CtEvidence newWanted loc pty = unsafeTcPluginTcM (TcM.newWanted (TcM.ctLocOrigin loc) Nothing pty)
145
newWanted loc pty = unsafeTcPluginTcM (TcM.newWanted (TcM.ctLocOrigin loc) Nothing pty)
89
true
true
0
10
27
56
26
30
null
null
equational/JL2012
HaskellExamples/src/AHeap.hs
mit
fromList l = mergeList (Prelude.map singleton l) where mergeList [a] = a mergeList x = mergeList (mergePairs x) mergePairs (a:b:c) = merge a b : mergePairs c mergePairs x = x -- | /O(1)/. 'head' returns the element root of the heap.
307
fromList l = mergeList (Prelude.map singleton l) where mergeList [a] = a mergeList x = mergeList (mergePairs x) mergePairs (a:b:c) = merge a b : mergePairs c mergePairs x = x -- | /O(1)/. 'head' returns the element root of the heap.
307
fromList l = mergeList (Prelude.map singleton l) where mergeList [a] = a mergeList x = mergeList (mergePairs x) mergePairs (a:b:c) = merge a b : mergePairs c mergePairs x = x -- | /O(1)/. 'head' returns the element root of the heap.
307
false
false
0
10
116
92
45
47
null
null
maxigit/sql-fragment
src/Database/SQLFragment/SQLFragment.hs
bsd-3-clause
-- | Extract the alias from an /aliased/ string -- -- >>> getAlias "table" -- "table" -- -- >>> getAlias "table alias" -- "alias" getAlias :: String -> String getAlias = last . words
184
getAlias :: String -> String getAlias = last . words
52
getAlias = last . words
23
true
true
0
5
35
26
17
9
null
null
lukexi/ghc-7.8-arm64
compiler/nativeGen/PPC/CodeGen.hs
bsd-3-clause
ondIntCode cond x y = do (src1, code1) <- getSomeReg x (src2, code2) <- getSomeReg y let code' = code1 `appOL` code2 `snocOL` (if condUnsigned cond then CMPL else CMP) II32 src1 (RIReg src2) return (CondCode False cond code')
268
condIntCode cond x y = do (src1, code1) <- getSomeReg x (src2, code2) <- getSomeReg y let code' = code1 `appOL` code2 `snocOL` (if condUnsigned cond then CMPL else CMP) II32 src1 (RIReg src2) return (CondCode False cond code')
268
condIntCode cond x y = do (src1, code1) <- getSomeReg x (src2, code2) <- getSomeReg y let code' = code1 `appOL` code2 `snocOL` (if condUnsigned cond then CMPL else CMP) II32 src1 (RIReg src2) return (CondCode False cond code')
268
false
false
0
14
81
109
55
54
null
null
nbloomf/carl
src/Carl/Struct/Matrix.hs
gpl-3.0
mEntryOf :: Index -> Matrix a -> Either AlgErr a _ `mEntryOf` Null = Left (NullMatrix "mEntryOf")
101
mEntryOf :: Index -> Matrix a -> Either AlgErr a _ `mEntryOf` Null = Left (NullMatrix "mEntryOf")
101
_ `mEntryOf` Null = Left (NullMatrix "mEntryOf")
52
false
true
0
7
20
44
21
23
null
null
silky/csound-expression
src/Csound/Options.hs
bsd-3-clause
setAdcBy :: String -> Options setAdcBy port = setInput name where name | null port = "adc" | otherwise = "adc:" ++ port
148
setAdcBy :: String -> Options setAdcBy port = setInput name where name | null port = "adc" | otherwise = "adc:" ++ port
148
setAdcBy port = setInput name where name | null port = "adc" | otherwise = "adc:" ++ port
118
false
true
0
8
51
62
26
36
null
null
brendanhay/gogol
gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs
mpl-2.0
-- | [Optional] Accept rows that contain values that do not match the schema. -- The unknown values are ignored. Default is false, which treats unknown -- values as errors. tdiarIgnoreUnknownValues :: Lens' TableDataInsertAllRequest (Maybe Bool) tdiarIgnoreUnknownValues = lens _tdiarIgnoreUnknownValues (\ s a -> s{_tdiarIgnoreUnknownValues = a})
355
tdiarIgnoreUnknownValues :: Lens' TableDataInsertAllRequest (Maybe Bool) tdiarIgnoreUnknownValues = lens _tdiarIgnoreUnknownValues (\ s a -> s{_tdiarIgnoreUnknownValues = a})
182
tdiarIgnoreUnknownValues = lens _tdiarIgnoreUnknownValues (\ s a -> s{_tdiarIgnoreUnknownValues = a})
109
true
true
0
9
54
50
27
23
null
null
manugunther/sat
Sat/GUI/IconTable.hs
gpl-3.0
makeLabelIcon :: Predicate -> GuiMonad Label makeLabelIcon = io . labelNew . Just . pname
89
makeLabelIcon :: Predicate -> GuiMonad Label makeLabelIcon = io . labelNew . Just . pname
89
makeLabelIcon = io . labelNew . Just . pname
44
false
true
0
7
14
30
15
15
null
null
brendanhay/gogol
gogol-container/gen/Network/Google/Resource/Container/Projects/Locations/Clusters/CompleteIPRotation.hs
mpl-2.0
-- | Creates a value of 'ProjectsLocationsClustersCompleteIPRotation' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'plccirXgafv' -- -- * 'plccirUploadProtocol' -- -- * 'plccirAccessToken' -- -- * 'plccirUploadType' -- -- * 'plccirPayload' -- -- * 'plccirName' -- -- * 'plccirCallback' projectsLocationsClustersCompleteIPRotation :: CompleteIPRotationRequest -- ^ 'plccirPayload' -> Text -- ^ 'plccirName' -> ProjectsLocationsClustersCompleteIPRotation projectsLocationsClustersCompleteIPRotation pPlccirPayload_ pPlccirName_ = ProjectsLocationsClustersCompleteIPRotation' { _plccirXgafv = Nothing , _plccirUploadProtocol = Nothing , _plccirAccessToken = Nothing , _plccirUploadType = Nothing , _plccirPayload = pPlccirPayload_ , _plccirName = pPlccirName_ , _plccirCallback = Nothing }
919
projectsLocationsClustersCompleteIPRotation :: CompleteIPRotationRequest -- ^ 'plccirPayload' -> Text -- ^ 'plccirName' -> ProjectsLocationsClustersCompleteIPRotation projectsLocationsClustersCompleteIPRotation pPlccirPayload_ pPlccirName_ = ProjectsLocationsClustersCompleteIPRotation' { _plccirXgafv = Nothing , _plccirUploadProtocol = Nothing , _plccirAccessToken = Nothing , _plccirUploadType = Nothing , _plccirPayload = pPlccirPayload_ , _plccirName = pPlccirName_ , _plccirCallback = Nothing }
546
projectsLocationsClustersCompleteIPRotation pPlccirPayload_ pPlccirName_ = ProjectsLocationsClustersCompleteIPRotation' { _plccirXgafv = Nothing , _plccirUploadProtocol = Nothing , _plccirAccessToken = Nothing , _plccirUploadType = Nothing , _plccirPayload = pPlccirPayload_ , _plccirName = pPlccirName_ , _plccirCallback = Nothing }
367
true
true
0
6
150
87
60
27
null
null
dbp/positionsites
src/Helpers/Misc.hs
bsd-3-clause
bsId (Just i) = readSafe $ unpack i
35
bsId (Just i) = readSafe $ unpack i
35
bsId (Just i) = readSafe $ unpack i
35
false
false
0
7
7
22
10
12
null
null
li-zhirui/EoplLangs
src/ContinuationPassing/Parser.hs
bsd-3-clause
comma = symbol ","
18
comma = symbol ","
18
comma = symbol ","
18
false
false
0
5
3
9
4
5
null
null
loadimpact/http2-test
hs-src/Rede/MainLoop/Tls.hs
bsd-3-clause
chooseFirstMatching (_:xs) suggested_protocolls = chooseFirstMatching xs suggested_protocolls
125
chooseFirstMatching (_:xs) suggested_protocolls = chooseFirstMatching xs suggested_protocolls
125
chooseFirstMatching (_:xs) suggested_protocolls = chooseFirstMatching xs suggested_protocolls
125
false
false
0
7
38
23
11
12
null
null
Axure/elm-compiler
src/Reporting/Report.hs
bsd-3-clause
-- REGIONS grabRegion :: (Monad m) => Renderer m -> Maybe R.Region -> R.Region -> String -> m () grabRegion renderer maybeSubRegion region@(R.Region start end) source = let (R.Position startLine startColumn) = start (R.Position endLine endColumn) = end (|>) = flip ($) relevantLines = lines source |> drop (startLine - 1) |> take (endLine - startLine + 1) in case relevantLines of [] -> normal renderer "" [sourceLine] -> singleLineRegion renderer startLine sourceLine $ case maybeSubRegion of Nothing -> (0, startColumn, endColumn, length sourceLine) Just (R.Region s e) -> (startColumn, R.column s, R.column e, endColumn) firstLine : rest -> let filteredFirstLine = replicate (startColumn - 1) ' ' ++ drop (startColumn - 1) firstLine filteredLastLine = take (endColumn) (last rest) focusedRelevantLines = filteredFirstLine : init rest ++ [filteredLastLine] lineNumbersWidth = length (show endLine) subregion = maybeSubRegion <|> Just region numberedLines = zipWith (addLineNumber renderer subregion lineNumbersWidth) [startLine .. endLine] focusedRelevantLines in mapM_ (\line -> line >> normal renderer "\n") numberedLines
1,536
grabRegion :: (Monad m) => Renderer m -> Maybe R.Region -> R.Region -> String -> m () grabRegion renderer maybeSubRegion region@(R.Region start end) source = let (R.Position startLine startColumn) = start (R.Position endLine endColumn) = end (|>) = flip ($) relevantLines = lines source |> drop (startLine - 1) |> take (endLine - startLine + 1) in case relevantLines of [] -> normal renderer "" [sourceLine] -> singleLineRegion renderer startLine sourceLine $ case maybeSubRegion of Nothing -> (0, startColumn, endColumn, length sourceLine) Just (R.Region s e) -> (startColumn, R.column s, R.column e, endColumn) firstLine : rest -> let filteredFirstLine = replicate (startColumn - 1) ' ' ++ drop (startColumn - 1) firstLine filteredLastLine = take (endColumn) (last rest) focusedRelevantLines = filteredFirstLine : init rest ++ [filteredLastLine] lineNumbersWidth = length (show endLine) subregion = maybeSubRegion <|> Just region numberedLines = zipWith (addLineNumber renderer subregion lineNumbersWidth) [startLine .. endLine] focusedRelevantLines in mapM_ (\line -> line >> normal renderer "\n") numberedLines
1,524
grabRegion renderer maybeSubRegion region@(R.Region start end) source = let (R.Position startLine startColumn) = start (R.Position endLine endColumn) = end (|>) = flip ($) relevantLines = lines source |> drop (startLine - 1) |> take (endLine - startLine + 1) in case relevantLines of [] -> normal renderer "" [sourceLine] -> singleLineRegion renderer startLine sourceLine $ case maybeSubRegion of Nothing -> (0, startColumn, endColumn, length sourceLine) Just (R.Region s e) -> (startColumn, R.column s, R.column e, endColumn) firstLine : rest -> let filteredFirstLine = replicate (startColumn - 1) ' ' ++ drop (startColumn - 1) firstLine filteredLastLine = take (endColumn) (last rest) focusedRelevantLines = filteredFirstLine : init rest ++ [filteredLastLine] lineNumbersWidth = length (show endLine) subregion = maybeSubRegion <|> Just region numberedLines = zipWith (addLineNumber renderer subregion lineNumbersWidth) [startLine .. endLine] focusedRelevantLines in mapM_ (\line -> line >> normal renderer "\n") numberedLines
1,414
true
true
39
9
570
423
224
199
null
null
ocramz/petsc-hs
src/Numerical/PETSc/Internal/InlineC.hs
gpl-3.0
-- EPSGetEigenpair(EPS eps,int i,PetscScalar *kr,PetscScalar *ki,Vec xr,Vec xi); epsGetEigenpair0' :: EPS -> CInt -- eigenpair index -> Ptr PetscScalar_ -- eigenvalue, Re -> Ptr PetscScalar_ -- ", Im -> Vec -- eigenvector, Re -> Vec -- ", Im -> IO CInt epsGetEigenpair0' e i kr ki xr xi = [C.exp|int{EPSGetEigenpair($(EPS e), $(int i), $(PetscScalar* kr), $(PetscScalar* ki), $(Vec xr), $(Vec xi))}|]
733
epsGetEigenpair0' :: EPS -> CInt -- eigenpair index -> Ptr PetscScalar_ -- eigenvalue, Re -> Ptr PetscScalar_ -- ", Im -> Vec -- eigenvector, Re -> Vec -- ", Im -> IO CInt epsGetEigenpair0' e i kr ki xr xi = [C.exp|int{EPSGetEigenpair($(EPS e), $(int i), $(PetscScalar* kr), $(PetscScalar* ki), $(Vec xr), $(Vec xi))}|]
652
epsGetEigenpair0' e i kr ki xr xi = [C.exp|int{EPSGetEigenpair($(EPS e), $(int i), $(PetscScalar* kr), $(PetscScalar* ki), $(Vec xr), $(Vec xi))}|]
317
true
true
0
11
393
69
38
31
null
null
meiersi/blaze-builder
benchmarks/Throughput/BlazeBuilder.hs
bsd-3-clause
writeByteN1 bytes = loop 0 0 where loop !s !n | n == bytes = mempty | otherwise = fromWord8 s `mappend` loop (s+1) (n+1)
176
writeByteN1 bytes = loop 0 0 where loop !s !n | n == bytes = mempty | otherwise = fromWord8 s `mappend` loop (s+1) (n+1)
176
writeByteN1 bytes = loop 0 0 where loop !s !n | n == bytes = mempty | otherwise = fromWord8 s `mappend` loop (s+1) (n+1)
176
false
false
2
8
80
80
36
44
null
null
phischu/fragnix
tests/packages/scotty/System.Process.Posix.hs
bsd-3-clause
createPipeInternalFd :: IO (FD, FD) createPipeInternalFd = do (Fd readfd, Fd writefd) <- Posix.createPipe return (readfd, writefd)
136
createPipeInternalFd :: IO (FD, FD) createPipeInternalFd = do (Fd readfd, Fd writefd) <- Posix.createPipe return (readfd, writefd)
136
createPipeInternalFd = do (Fd readfd, Fd writefd) <- Posix.createPipe return (readfd, writefd)
100
false
true
0
9
22
53
27
26
null
null
5outh/textlunky
src/Control/Process/Update.hs
mit
stepPlayer :: MonadState GameState m => m () stepPlayer = do st <- use $ player.p_state case st of Falling -> return () Standing -> return () Whipping -> return () Shooting d -> return () Stunned -> return ()
242
stepPlayer :: MonadState GameState m => m () stepPlayer = do st <- use $ player.p_state case st of Falling -> return () Standing -> return () Whipping -> return () Shooting d -> return () Stunned -> return ()
242
stepPlayer = do st <- use $ player.p_state case st of Falling -> return () Standing -> return () Whipping -> return () Shooting d -> return () Stunned -> return ()
197
false
true
0
11
73
103
47
56
null
null
momomimachli/Hedsql-tests
src/Database/Hedsql/Examples/Insert.hs
gpl-3.0
{-| Use the generic 'value' constructor instead of the specialised ones. MariaDB and PosgreSQL: > INSERT INTO "People" > VALUES (1, 'Mr', 'Gaius Julius', 'Ceasar', 2000, TRUE, NULL, NULL, 2) SqLite: > INSERT INTO "People" > ("id", "title", "firstName", "lastName", "age", "married", "passportNo" > , "father", "countryId") > VALUES (1, 'Mr', 'Gaius Julius', 'Ceasar', 2000, 1, NULL, NULL, 2) -} gaiusJuliusCeasar :: InsertStmt colType dbVendor gaiusJuliusCeasar = insert "People" [ assign idC $ value (2::Int) , assign title $ value "Mr" , assign firstName $ value "Gaius Julius" , assign lastName $ value "Ceasar" , assign age $ value (2000::Int) , assign married $ value True , assign passportNo null , assign father null , assign countryId $ value (2::Int) ]
881
gaiusJuliusCeasar :: InsertStmt colType dbVendor gaiusJuliusCeasar = insert "People" [ assign idC $ value (2::Int) , assign title $ value "Mr" , assign firstName $ value "Gaius Julius" , assign lastName $ value "Ceasar" , assign age $ value (2000::Int) , assign married $ value True , assign passportNo null , assign father null , assign countryId $ value (2::Int) ]
484
gaiusJuliusCeasar = insert "People" [ assign idC $ value (2::Int) , assign title $ value "Mr" , assign firstName $ value "Gaius Julius" , assign lastName $ value "Ceasar" , assign age $ value (2000::Int) , assign married $ value True , assign passportNo null , assign father null , assign countryId $ value (2::Int) ]
435
true
true
1
9
240
152
73
79
null
null
np/ling
Ling/Raw.hs
bsd-3-clause
paren :: Term -> ATerm paren (RawApp t []) = t
46
paren :: Term -> ATerm paren (RawApp t []) = t
46
paren (RawApp t []) = t
23
false
true
0
10
10
34
15
19
null
null