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
sherwoodwang/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_LOT_PASS :: Int wxSTC_LOT_PASS = 4
40
wxSTC_LOT_PASS :: Int wxSTC_LOT_PASS = 4
40
wxSTC_LOT_PASS = 4
18
false
true
0
6
5
18
7
11
null
null
Zigazou/HaMinitel
src/Minitel/Constants/MUnicode.hs
gpl-3.0
vulgarFractionOneQuarter = chr 0xbc
42
vulgarFractionOneQuarter = chr 0xbc
42
vulgarFractionOneQuarter = chr 0xbc
42
false
false
0
5
10
9
4
5
null
null
keera-studios/gtk-helpers
gtk3/src/Graphics/UI/Gtk/Helpers/TreeView.hs
bsd-3-clause
addTextColumn :: (TreeModelClass (model row), TypedTreeModelClass model) => TreeView -> model row -> (row -> Maybe String) -> IO() addTextColumn tv st f = void $ do col <- treeViewColumnNew renderer <- cellRendererTextNew cellLayoutPackStart col renderer True cellLayoutSetAttributes col renderer st $ map (cellText :=).maybeToList.f treeViewAppendColumn tv col
387
addTextColumn :: (TreeModelClass (model row), TypedTreeModelClass model) => TreeView -> model row -> (row -> Maybe String) -> IO() addTextColumn tv st f = void $ do col <- treeViewColumnNew renderer <- cellRendererTextNew cellLayoutPackStart col renderer True cellLayoutSetAttributes col renderer st $ map (cellText :=).maybeToList.f treeViewAppendColumn tv col
387
addTextColumn tv st f = void $ do col <- treeViewColumnNew renderer <- cellRendererTextNew cellLayoutPackStart col renderer True cellLayoutSetAttributes col renderer st $ map (cellText :=).maybeToList.f treeViewAppendColumn tv col
240
false
true
2
12
73
136
62
74
null
null
devonhollowood/adventofcode
2015/day5/day5.hs
mit
main = do input <- readFile "input.txt" print . length . filter isNice . map classify $ lines input
107
main = do input <- readFile "input.txt" print . length . filter isNice . map classify $ lines input
107
main = do input <- readFile "input.txt" print . length . filter isNice . map classify $ lines input
107
false
false
1
11
26
48
19
29
null
null
urbanslug/ghc
testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.hs
bsd-3-clause
fmap :: _ => _ fmap = P.fmap
28
fmap :: _ => _ fmap = P.fmap
28
fmap = P.fmap
13
false
true
0
7
7
25
10
15
null
null
Xandaros/MinecraftCLI
app/Main.hs
bsd-2-clause
serverInput _ = serverInput ["help"]
36
serverInput _ = serverInput ["help"]
36
serverInput _ = serverInput ["help"]
36
false
false
0
6
4
15
7
8
null
null
rahulmutt/ghcvm
compiler/Eta/SimplCore/SimplUtils.hs
bsd-3-clause
postInlineUnconditionally :: DynFlags -> SimplEnv -> TopLevelFlag -> OutId -- The binder (an InId would be fine too) -- (*not* a CoVar) -> OccInfo -- From the InId -> OutExpr -> Unfolding -> Bool -- Precondition: rhs satisfies the let/app invariant -- See Note [CoreSyn let/app invariant] in CoreSyn -- Reason: we don't want to inline single uses, or discard dead bindings, -- for unlifted, side-effect-full bindings postInlineUnconditionally dflags env top_lvl bndr occ_info rhs unfolding | not active = False | isWeakLoopBreaker occ_info = False -- If it's a loop-breaker of any kind, don't inline -- because it might be referred to "earlier" | isExportedId bndr = False | isStableUnfolding unfolding = False -- Note [Stable unfoldings and postInlineUnconditionally] | isTopLevel top_lvl = False -- Note [Top level and postInlineUnconditionally] | exprIsTrivial rhs = True | otherwise = case occ_info of -- The point of examining occ_info here is that for *non-values* -- that occur outside a lambda, the call-site inliner won't have -- a chance (because it doesn't know that the thing -- only occurs once). The pre-inliner won't have gotten -- it either, if the thing occurs in more than one branch -- So the main target is things like -- let x = f y in -- case v of -- True -> case x of ... -- False -> case x of ... -- This is very important in practice; e.g. wheel-seive1 doubles -- in allocation if you miss this out OneOcc in_lam _one_br int_cxt -- OneOcc => no code-duplication issue -> smallEnoughToInline dflags unfolding -- Small enough to dup -- ToDo: consider discount on smallEnoughToInline if int_cxt is true -- -- NB: Do NOT inline arbitrarily big things, even if one_br is True -- Reason: doing so risks exponential behaviour. We simplify a big -- expression, inline it, and simplify it again. But if the -- very same thing happens in the big expression, we get -- exponential cost! -- PRINCIPLE: when we've already simplified an expression once, -- make sure that we only inline it if it's reasonably small. && (not in_lam || -- Outside a lambda, we want to be reasonably aggressive -- about inlining into multiple branches of case -- e.g. let x = <non-value> -- in case y of { C1 -> ..x..; C2 -> ..x..; C3 -> ... } -- Inlining can be a big win if C3 is the hot-spot, even if -- the uses in C1, C2 are not 'interesting' -- An example that gets worse if you add int_cxt here is 'clausify' (isCheapUnfolding unfolding && int_cxt)) -- isCheap => acceptable work duplication; in_lam may be true -- int_cxt to prevent us inlining inside a lambda without some -- good reason. See the notes on int_cxt in preInlineUnconditionally IAmDead -> True -- This happens; for example, the case_bndr during case of -- known constructor: case (a,b) of x { (p,q) -> ... } -- Here x isn't mentioned in the RHS, so we don't want to -- create the (dead) let-binding let x = (a,b) in ... _ -> False -- Here's an example that we don't handle well: -- let f = if b then Left (\x.BIG) else Right (\y.BIG) -- in \y. ....case f of {...} .... -- Here f is used just once, and duplicating the case work is fine (exprIsCheap). -- But -- - We can't preInlineUnconditionally because that woud invalidate -- the occ info for b. -- - We can't postInlineUnconditionally because the RHS is big, and -- that risks exponential behaviour -- - We can't call-site inline, because the rhs is big -- Alas! where active = isActive (sm_phase (getMode env)) (idInlineActivation bndr) -- See Note [pre/postInlineUnconditionally in gentle mode] {- Note [Top level and postInlineUnconditionally] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We don't do postInlineUnconditionally for top-level things (even for ones that are trivial): * Doing so will inline top-level error expressions that have been carefully floated out by FloatOut. More generally, it might replace static allocation with dynamic. * Even for trivial expressions there's a problem. Consider {-# RULE "foo" forall (xs::[T]). reverse xs = ruggle xs #-} blah xs = reverse xs ruggle = sort In one simplifier pass we might fire the rule, getting blah xs = ruggle xs but in *that* simplifier pass we must not do postInlineUnconditionally on 'ruggle' because then we'll have an unbound occurrence of 'ruggle' If the rhs is trivial it'll be inlined by callSiteInline, and then the binding will be dead and discarded by the next use of OccurAnal * There is less point, because the main goal is to get rid of local bindings used in multiple case branches. * The inliner should inline trivial things at call sites anyway. Note [Stable unfoldings and postInlineUnconditionally] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Do not do postInlineUnconditionally if the Id has an stable unfolding, otherwise we lose the unfolding. Example -- f has stable unfolding with rhs (e |> co) -- where 'e' is big f = e |> co Then there's a danger we'll optimise to f' = e f = f' |> co and now postInlineUnconditionally, losing the stable unfolding on f. Now f' won't inline because 'e' is too big. c.f. Note [Stable unfoldings and preInlineUnconditionally] ************************************************************************ * * Rebuilding a lambda * * ************************************************************************ -}
6,499
postInlineUnconditionally :: DynFlags -> SimplEnv -> TopLevelFlag -> OutId -- The binder (an InId would be fine too) -- (*not* a CoVar) -> OccInfo -- From the InId -> OutExpr -> Unfolding -> Bool postInlineUnconditionally dflags env top_lvl bndr occ_info rhs unfolding | not active = False | isWeakLoopBreaker occ_info = False -- If it's a loop-breaker of any kind, don't inline -- because it might be referred to "earlier" | isExportedId bndr = False | isStableUnfolding unfolding = False -- Note [Stable unfoldings and postInlineUnconditionally] | isTopLevel top_lvl = False -- Note [Top level and postInlineUnconditionally] | exprIsTrivial rhs = True | otherwise = case occ_info of -- The point of examining occ_info here is that for *non-values* -- that occur outside a lambda, the call-site inliner won't have -- a chance (because it doesn't know that the thing -- only occurs once). The pre-inliner won't have gotten -- it either, if the thing occurs in more than one branch -- So the main target is things like -- let x = f y in -- case v of -- True -> case x of ... -- False -> case x of ... -- This is very important in practice; e.g. wheel-seive1 doubles -- in allocation if you miss this out OneOcc in_lam _one_br int_cxt -- OneOcc => no code-duplication issue -> smallEnoughToInline dflags unfolding -- Small enough to dup -- ToDo: consider discount on smallEnoughToInline if int_cxt is true -- -- NB: Do NOT inline arbitrarily big things, even if one_br is True -- Reason: doing so risks exponential behaviour. We simplify a big -- expression, inline it, and simplify it again. But if the -- very same thing happens in the big expression, we get -- exponential cost! -- PRINCIPLE: when we've already simplified an expression once, -- make sure that we only inline it if it's reasonably small. && (not in_lam || -- Outside a lambda, we want to be reasonably aggressive -- about inlining into multiple branches of case -- e.g. let x = <non-value> -- in case y of { C1 -> ..x..; C2 -> ..x..; C3 -> ... } -- Inlining can be a big win if C3 is the hot-spot, even if -- the uses in C1, C2 are not 'interesting' -- An example that gets worse if you add int_cxt here is 'clausify' (isCheapUnfolding unfolding && int_cxt)) -- isCheap => acceptable work duplication; in_lam may be true -- int_cxt to prevent us inlining inside a lambda without some -- good reason. See the notes on int_cxt in preInlineUnconditionally IAmDead -> True -- This happens; for example, the case_bndr during case of -- known constructor: case (a,b) of x { (p,q) -> ... } -- Here x isn't mentioned in the RHS, so we don't want to -- create the (dead) let-binding let x = (a,b) in ... _ -> False -- Here's an example that we don't handle well: -- let f = if b then Left (\x.BIG) else Right (\y.BIG) -- in \y. ....case f of {...} .... -- Here f is used just once, and duplicating the case work is fine (exprIsCheap). -- But -- - We can't preInlineUnconditionally because that woud invalidate -- the occ info for b. -- - We can't postInlineUnconditionally because the RHS is big, and -- that risks exponential behaviour -- - We can't call-site inline, because the rhs is big -- Alas! where active = isActive (sm_phase (getMode env)) (idInlineActivation bndr) -- See Note [pre/postInlineUnconditionally in gentle mode] {- Note [Top level and postInlineUnconditionally] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We don't do postInlineUnconditionally for top-level things (even for ones that are trivial): * Doing so will inline top-level error expressions that have been carefully floated out by FloatOut. More generally, it might replace static allocation with dynamic. * Even for trivial expressions there's a problem. Consider {-# RULE "foo" forall (xs::[T]). reverse xs = ruggle xs #-} blah xs = reverse xs ruggle = sort In one simplifier pass we might fire the rule, getting blah xs = ruggle xs but in *that* simplifier pass we must not do postInlineUnconditionally on 'ruggle' because then we'll have an unbound occurrence of 'ruggle' If the rhs is trivial it'll be inlined by callSiteInline, and then the binding will be dead and discarded by the next use of OccurAnal * There is less point, because the main goal is to get rid of local bindings used in multiple case branches. * The inliner should inline trivial things at call sites anyway. Note [Stable unfoldings and postInlineUnconditionally] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Do not do postInlineUnconditionally if the Id has an stable unfolding, otherwise we lose the unfolding. Example -- f has stable unfolding with rhs (e |> co) -- where 'e' is big f = e |> co Then there's a danger we'll optimise to f' = e f = f' |> co and now postInlineUnconditionally, losing the stable unfolding on f. Now f' won't inline because 'e' is too big. c.f. Note [Stable unfoldings and preInlineUnconditionally] ************************************************************************ * * Rebuilding a lambda * * ************************************************************************ -}
6,270
postInlineUnconditionally dflags env top_lvl bndr occ_info rhs unfolding | not active = False | isWeakLoopBreaker occ_info = False -- If it's a loop-breaker of any kind, don't inline -- because it might be referred to "earlier" | isExportedId bndr = False | isStableUnfolding unfolding = False -- Note [Stable unfoldings and postInlineUnconditionally] | isTopLevel top_lvl = False -- Note [Top level and postInlineUnconditionally] | exprIsTrivial rhs = True | otherwise = case occ_info of -- The point of examining occ_info here is that for *non-values* -- that occur outside a lambda, the call-site inliner won't have -- a chance (because it doesn't know that the thing -- only occurs once). The pre-inliner won't have gotten -- it either, if the thing occurs in more than one branch -- So the main target is things like -- let x = f y in -- case v of -- True -> case x of ... -- False -> case x of ... -- This is very important in practice; e.g. wheel-seive1 doubles -- in allocation if you miss this out OneOcc in_lam _one_br int_cxt -- OneOcc => no code-duplication issue -> smallEnoughToInline dflags unfolding -- Small enough to dup -- ToDo: consider discount on smallEnoughToInline if int_cxt is true -- -- NB: Do NOT inline arbitrarily big things, even if one_br is True -- Reason: doing so risks exponential behaviour. We simplify a big -- expression, inline it, and simplify it again. But if the -- very same thing happens in the big expression, we get -- exponential cost! -- PRINCIPLE: when we've already simplified an expression once, -- make sure that we only inline it if it's reasonably small. && (not in_lam || -- Outside a lambda, we want to be reasonably aggressive -- about inlining into multiple branches of case -- e.g. let x = <non-value> -- in case y of { C1 -> ..x..; C2 -> ..x..; C3 -> ... } -- Inlining can be a big win if C3 is the hot-spot, even if -- the uses in C1, C2 are not 'interesting' -- An example that gets worse if you add int_cxt here is 'clausify' (isCheapUnfolding unfolding && int_cxt)) -- isCheap => acceptable work duplication; in_lam may be true -- int_cxt to prevent us inlining inside a lambda without some -- good reason. See the notes on int_cxt in preInlineUnconditionally IAmDead -> True -- This happens; for example, the case_bndr during case of -- known constructor: case (a,b) of x { (p,q) -> ... } -- Here x isn't mentioned in the RHS, so we don't want to -- create the (dead) let-binding let x = (a,b) in ... _ -> False -- Here's an example that we don't handle well: -- let f = if b then Left (\x.BIG) else Right (\y.BIG) -- in \y. ....case f of {...} .... -- Here f is used just once, and duplicating the case work is fine (exprIsCheap). -- But -- - We can't preInlineUnconditionally because that woud invalidate -- the occ info for b. -- - We can't postInlineUnconditionally because the RHS is big, and -- that risks exponential behaviour -- - We can't call-site inline, because the rhs is big -- Alas! where active = isActive (sm_phase (getMode env)) (idInlineActivation bndr) -- See Note [pre/postInlineUnconditionally in gentle mode] {- Note [Top level and postInlineUnconditionally] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We don't do postInlineUnconditionally for top-level things (even for ones that are trivial): * Doing so will inline top-level error expressions that have been carefully floated out by FloatOut. More generally, it might replace static allocation with dynamic. * Even for trivial expressions there's a problem. Consider {-# RULE "foo" forall (xs::[T]). reverse xs = ruggle xs #-} blah xs = reverse xs ruggle = sort In one simplifier pass we might fire the rule, getting blah xs = ruggle xs but in *that* simplifier pass we must not do postInlineUnconditionally on 'ruggle' because then we'll have an unbound occurrence of 'ruggle' If the rhs is trivial it'll be inlined by callSiteInline, and then the binding will be dead and discarded by the next use of OccurAnal * There is less point, because the main goal is to get rid of local bindings used in multiple case branches. * The inliner should inline trivial things at call sites anyway. Note [Stable unfoldings and postInlineUnconditionally] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Do not do postInlineUnconditionally if the Id has an stable unfolding, otherwise we lose the unfolding. Example -- f has stable unfolding with rhs (e |> co) -- where 'e' is big f = e |> co Then there's a danger we'll optimise to f' = e f = f' |> co and now postInlineUnconditionally, losing the stable unfolding on f. Now f' won't inline because 'e' is too big. c.f. Note [Stable unfoldings and preInlineUnconditionally] ************************************************************************ * * Rebuilding a lambda * * ************************************************************************ -}
5,995
true
true
6
14
2,117
283
165
118
null
null
sixears/fluffy
src/Fluffy/Data/Time.hs
mit
-- timeFormatHHMM ---------------------- timeFormatHHMM :: FormatTime t => t -> String timeFormatHHMM = formatTime defaultTimeLocale "%l:%M%p"
144
timeFormatHHMM :: FormatTime t => t -> String timeFormatHHMM = formatTime defaultTimeLocale "%l:%M%p"
102
timeFormatHHMM = formatTime defaultTimeLocale "%l:%M%p"
56
true
true
0
8
17
34
15
19
null
null
Oliv95/Pyskellator
src/Language/Obfuscator.hs
mit
transformExpression a@(Set exprs annot) = do obfuExpr <- mapM transformExpression exprs return (Set obfuExpr annot)
180
transformExpression a@(Set exprs annot) = do obfuExpr <- mapM transformExpression exprs return (Set obfuExpr annot)
180
transformExpression a@(Set exprs annot) = do obfuExpr <- mapM transformExpression exprs return (Set obfuExpr annot)
180
false
false
1
10
79
51
21
30
null
null
ezyang/ghc
compiler/iface/ToIface.hs
bsd-3-clause
{- ************************************************************************ * * Conversion from Type to IfaceType * * ************************************************************************ -} toIfaceKind :: Type -> IfaceType toIfaceKind = toIfaceType
399
toIfaceKind :: Type -> IfaceType toIfaceKind = toIfaceType
58
toIfaceKind = toIfaceType
25
true
true
0
5
167
16
9
7
null
null
jeffreyrosenbluth/flourine
src/Fluorine/HTML/Attributes.hs
bsd-3-clause
type_ :: String -> Attr i type_ = attr $ attributeName "type"
61
type_ :: String -> Attr i type_ = attr $ attributeName "type"
61
type_ = attr $ attributeName "type"
35
false
true
2
7
11
32
13
19
null
null
vdweegen/UvA-Software_Testing
Lab3/Final/Exercises.hs
gpl-3.0
filterProps _ = False
21
filterProps _ = False
21
filterProps _ = False
21
false
false
0
4
3
10
4
6
null
null
qpliu/esolang
01_/hs/compiler2/CodeGen.hs
gpl-3.0
writeDefExpr :: Local -> [Local] -> Expr -> GenLLVM () writeDefExpr value bindings expr = w expr where w (ExprLiteral _ []) = do mapM_ (writeUnref . Left) bindings statusPtr <- writeValueFieldPtr value 1 writeStore (writeCode "i2") (Right "2") statusPtr retValue (Right "2") Nothing w (ExprLiteral _ bits) = do mapM_ (writeUnref . Left) bindings evalParamRawPtr <- writeNewLiteralValueEvalParam bits tailCallForceRetValue evalParamRawPtr (Right "@evalLiteral") w (ExprBound index) = do let rhs = bindings !! index mapM_ (writeUnref . Left) (take index bindings ++ drop (index+1) bindings) rhsStatusPtr <- writeValueFieldPtr rhs 1 rhsStatus <- writeLoad (writeCode "i2") rhsStatusPtr cmp <- writeNewLocal "icmp ne i2 3," writeLocal rhsStatus "" (evaluatedLabelRef,unevaluatedLabelRef) <- writeBranch cmp writeNewLabelBack [evaluatedLabelRef] valueStatusPtr <- writeValueFieldPtr value 1 writeStore (writeCode "i2") (Left rhsStatus) valueStatusPtr cmp <- writeNewLocal "icmp eq i2 2," writeLocal rhsStatus "" (nilLabelRef,nonnilLabelRef) <- writeBranch cmp writeNewLabelBack [nilLabelRef] writeUnref (Left rhs) retValue (Right "2") Nothing writeNewLabelBack [nonnilLabelRef] rhsNextPtrPtr <- writeValueFieldPtr rhs 2 rhsNextRawPtr <- writeLoad (writeCode "i8*") rhsNextPtrPtr valueNextPtrPtr <- writeValueFieldPtr value 2 writeStore (writeCode "i8*") (Left rhsNextRawPtr) valueNextPtrPtr valueNext <- writeNewLocal "bitcast i8* " writeLocal rhsNextRawPtr " to " writeValueType "*" writeAddRef valueNext writeUnref (Left rhs) retValue (Left rhsStatus) (Just rhsNextRawPtr) writeNewLabelBack [unevaluatedLabelRef] rhsEvalParamPtr <- writeValueFieldPtr rhs 2 rhsEvalParam <- writeLoad (writeCode "i8*") rhsEvalParamPtr rhsEvalFuncPtr <- writeValueFieldPtr rhs 3 rhsEvalFunc <- writeLoad (writeCode "{i2,i8*}(i8*,i8*)*") rhsEvalFuncPtr rhsRawPtr <- writeNewLocal "bitcast " writeValueType "* " writeLocal rhs " to i8*" refCountPtr <- writeValueFieldPtr rhs 0 refCount <- writeLoad (writeCode "i32") refCountPtr cmp <- writeNewLocal "icmp ule i32 " writeLocal refCount ",1" (noOtherRefsLabelRef,hasOtherRefsLabelRef) <- writeBranch cmp writeNewLabelBack [noOtherRefsLabelRef] writeFree (Left rhsRawPtr) tailCallForceRetValue rhsEvalParam (Left rhsEvalFunc) writeNewLabelBack [hasOtherRefsLabelRef] when debugIndirectCalls (do writeNewLocal ("call i32(i8*,...) @printf(i8* getelementptr " ++ "([7 x i8],[7 x i8]* @debugIndirectCallsFmt" ++ ",i32 0,i32 0),i8 69,{i2,i8*}(i8*,i8*)* ") writeLocal rhsEvalFunc ")" writeNewLocal "call i32 @fflush(i8* null)" return ()) forcedResult <- writeNewLocal "call fastcc {i2,i8*} " writeLocal rhsEvalFunc "(i8* " writeLocal rhsEvalParam ",i8* " writeLocal rhsRawPtr ")" forcedStatus <- writeNewLocal "extractvalue {i2,i8*} " writeLocal forcedResult ",0" forcedNext <- writeNewLocal "extractvalue {i2,i8*} " writeLocal forcedResult ",1" nextValue <- writeNewLocal "bitcast i8* " writeLocal forcedNext " to " writeValueType "*" writeAddRef nextValue writeUnref (Left rhs) valueStatusPtr <- writeValueFieldPtr value 1 writeStore (writeCode "i2") (Left forcedStatus) valueStatusPtr valueNextPtrPtr <- writeValueFieldPtr value 2 writeStore (writeCode "i8*") (Left forcedNext) valueNextPtrPtr writeCode " ret {i2,i8*} " writeLocal forcedResult "" w (ExprFuncall (Identifier _ name) exprs) = do rhs <- writeExpr bindings expr mapM_ (writeUnref . Left) bindings -- rhs.refcount must be 1, so copy rhs into value -- future optimization: rewrite function def to take a value to -- write into instead of allocating and returning a new value rhsEvalParamPtr <- writeValueFieldPtr rhs 2 rhsEvalParam <- writeLoad (writeCode "i8*") rhsEvalParamPtr rhsEvalFuncPtr <- writeValueFieldPtr rhs 3 rhsEvalFunc <- writeLoad (writeCode "{i2,i8*}(i8*,i8*)*") rhsEvalFuncPtr rhsRawPtr <- writeNewLocal "bitcast " writeValueType "* " writeLocal rhs " to i8*" writeFree (Left rhsRawPtr) tailCallForceRetValue rhsEvalParam (Left rhsEvalFunc) w (ExprConcat expr1 expr2) = do value1 <- writeExpr bindings expr1 value2 <- writeExpr bindings expr2 mapM_ (writeUnref . Left) bindings evalParamRawPtr <- writeNewConcatValueEvalParam value1 value2 tailCallForceRetValue evalParamRawPtr (Right "@evalConcat") retValue status nextValue = do retval1 <- writeNewLocal "insertvalue {i2,i8*} undef,i2 " either (flip writeLocal "") writeCode status writeCode ",0" retval <- maybe (return retval1) (\ nextValue -> do result <- writeNewLocal "insertvalue {i2,i8*} " writeLocal retval1 ",i8* " writeLocal nextValue ",1" return result) nextValue writeCode " ret {i2,i8*} " writeLocal retval "" tailCallForceRetValue evalParam evalFunc = do when debugIndirectCalls (do writeNewLocal ("call i32(i8*,...) @printf(i8* getelementptr " ++ "([7 x i8],[7 x i8]* @debugIndirectCallsFmt" ++ ",i32 0,i32 0),i8 101,{i2,i8*}(i8*,i8*)* ") either (flip writeLocal "") writeCode evalFunc writeCode ")" writeNewLocal "call i32 @fflush(i8* null)" return ()) retval <- writeNewLocal "musttail call fastcc {i2,i8*} " either (flip writeLocal "") writeCode evalFunc writeCode "(i8* " writeLocal evalParam ",i8* %value)" writeCode " ret {i2,i8*} " writeLocal retval ""
6,317
writeDefExpr :: Local -> [Local] -> Expr -> GenLLVM () writeDefExpr value bindings expr = w expr where w (ExprLiteral _ []) = do mapM_ (writeUnref . Left) bindings statusPtr <- writeValueFieldPtr value 1 writeStore (writeCode "i2") (Right "2") statusPtr retValue (Right "2") Nothing w (ExprLiteral _ bits) = do mapM_ (writeUnref . Left) bindings evalParamRawPtr <- writeNewLiteralValueEvalParam bits tailCallForceRetValue evalParamRawPtr (Right "@evalLiteral") w (ExprBound index) = do let rhs = bindings !! index mapM_ (writeUnref . Left) (take index bindings ++ drop (index+1) bindings) rhsStatusPtr <- writeValueFieldPtr rhs 1 rhsStatus <- writeLoad (writeCode "i2") rhsStatusPtr cmp <- writeNewLocal "icmp ne i2 3," writeLocal rhsStatus "" (evaluatedLabelRef,unevaluatedLabelRef) <- writeBranch cmp writeNewLabelBack [evaluatedLabelRef] valueStatusPtr <- writeValueFieldPtr value 1 writeStore (writeCode "i2") (Left rhsStatus) valueStatusPtr cmp <- writeNewLocal "icmp eq i2 2," writeLocal rhsStatus "" (nilLabelRef,nonnilLabelRef) <- writeBranch cmp writeNewLabelBack [nilLabelRef] writeUnref (Left rhs) retValue (Right "2") Nothing writeNewLabelBack [nonnilLabelRef] rhsNextPtrPtr <- writeValueFieldPtr rhs 2 rhsNextRawPtr <- writeLoad (writeCode "i8*") rhsNextPtrPtr valueNextPtrPtr <- writeValueFieldPtr value 2 writeStore (writeCode "i8*") (Left rhsNextRawPtr) valueNextPtrPtr valueNext <- writeNewLocal "bitcast i8* " writeLocal rhsNextRawPtr " to " writeValueType "*" writeAddRef valueNext writeUnref (Left rhs) retValue (Left rhsStatus) (Just rhsNextRawPtr) writeNewLabelBack [unevaluatedLabelRef] rhsEvalParamPtr <- writeValueFieldPtr rhs 2 rhsEvalParam <- writeLoad (writeCode "i8*") rhsEvalParamPtr rhsEvalFuncPtr <- writeValueFieldPtr rhs 3 rhsEvalFunc <- writeLoad (writeCode "{i2,i8*}(i8*,i8*)*") rhsEvalFuncPtr rhsRawPtr <- writeNewLocal "bitcast " writeValueType "* " writeLocal rhs " to i8*" refCountPtr <- writeValueFieldPtr rhs 0 refCount <- writeLoad (writeCode "i32") refCountPtr cmp <- writeNewLocal "icmp ule i32 " writeLocal refCount ",1" (noOtherRefsLabelRef,hasOtherRefsLabelRef) <- writeBranch cmp writeNewLabelBack [noOtherRefsLabelRef] writeFree (Left rhsRawPtr) tailCallForceRetValue rhsEvalParam (Left rhsEvalFunc) writeNewLabelBack [hasOtherRefsLabelRef] when debugIndirectCalls (do writeNewLocal ("call i32(i8*,...) @printf(i8* getelementptr " ++ "([7 x i8],[7 x i8]* @debugIndirectCallsFmt" ++ ",i32 0,i32 0),i8 69,{i2,i8*}(i8*,i8*)* ") writeLocal rhsEvalFunc ")" writeNewLocal "call i32 @fflush(i8* null)" return ()) forcedResult <- writeNewLocal "call fastcc {i2,i8*} " writeLocal rhsEvalFunc "(i8* " writeLocal rhsEvalParam ",i8* " writeLocal rhsRawPtr ")" forcedStatus <- writeNewLocal "extractvalue {i2,i8*} " writeLocal forcedResult ",0" forcedNext <- writeNewLocal "extractvalue {i2,i8*} " writeLocal forcedResult ",1" nextValue <- writeNewLocal "bitcast i8* " writeLocal forcedNext " to " writeValueType "*" writeAddRef nextValue writeUnref (Left rhs) valueStatusPtr <- writeValueFieldPtr value 1 writeStore (writeCode "i2") (Left forcedStatus) valueStatusPtr valueNextPtrPtr <- writeValueFieldPtr value 2 writeStore (writeCode "i8*") (Left forcedNext) valueNextPtrPtr writeCode " ret {i2,i8*} " writeLocal forcedResult "" w (ExprFuncall (Identifier _ name) exprs) = do rhs <- writeExpr bindings expr mapM_ (writeUnref . Left) bindings -- rhs.refcount must be 1, so copy rhs into value -- future optimization: rewrite function def to take a value to -- write into instead of allocating and returning a new value rhsEvalParamPtr <- writeValueFieldPtr rhs 2 rhsEvalParam <- writeLoad (writeCode "i8*") rhsEvalParamPtr rhsEvalFuncPtr <- writeValueFieldPtr rhs 3 rhsEvalFunc <- writeLoad (writeCode "{i2,i8*}(i8*,i8*)*") rhsEvalFuncPtr rhsRawPtr <- writeNewLocal "bitcast " writeValueType "* " writeLocal rhs " to i8*" writeFree (Left rhsRawPtr) tailCallForceRetValue rhsEvalParam (Left rhsEvalFunc) w (ExprConcat expr1 expr2) = do value1 <- writeExpr bindings expr1 value2 <- writeExpr bindings expr2 mapM_ (writeUnref . Left) bindings evalParamRawPtr <- writeNewConcatValueEvalParam value1 value2 tailCallForceRetValue evalParamRawPtr (Right "@evalConcat") retValue status nextValue = do retval1 <- writeNewLocal "insertvalue {i2,i8*} undef,i2 " either (flip writeLocal "") writeCode status writeCode ",0" retval <- maybe (return retval1) (\ nextValue -> do result <- writeNewLocal "insertvalue {i2,i8*} " writeLocal retval1 ",i8* " writeLocal nextValue ",1" return result) nextValue writeCode " ret {i2,i8*} " writeLocal retval "" tailCallForceRetValue evalParam evalFunc = do when debugIndirectCalls (do writeNewLocal ("call i32(i8*,...) @printf(i8* getelementptr " ++ "([7 x i8],[7 x i8]* @debugIndirectCallsFmt" ++ ",i32 0,i32 0),i8 101,{i2,i8*}(i8*,i8*)* ") either (flip writeLocal "") writeCode evalFunc writeCode ")" writeNewLocal "call i32 @fflush(i8* null)" return ()) retval <- writeNewLocal "musttail call fastcc {i2,i8*} " either (flip writeLocal "") writeCode evalFunc writeCode "(i8* " writeLocal evalParam ",i8* %value)" writeCode " ret {i2,i8*} " writeLocal retval ""
6,317
writeDefExpr value bindings expr = w expr where w (ExprLiteral _ []) = do mapM_ (writeUnref . Left) bindings statusPtr <- writeValueFieldPtr value 1 writeStore (writeCode "i2") (Right "2") statusPtr retValue (Right "2") Nothing w (ExprLiteral _ bits) = do mapM_ (writeUnref . Left) bindings evalParamRawPtr <- writeNewLiteralValueEvalParam bits tailCallForceRetValue evalParamRawPtr (Right "@evalLiteral") w (ExprBound index) = do let rhs = bindings !! index mapM_ (writeUnref . Left) (take index bindings ++ drop (index+1) bindings) rhsStatusPtr <- writeValueFieldPtr rhs 1 rhsStatus <- writeLoad (writeCode "i2") rhsStatusPtr cmp <- writeNewLocal "icmp ne i2 3," writeLocal rhsStatus "" (evaluatedLabelRef,unevaluatedLabelRef) <- writeBranch cmp writeNewLabelBack [evaluatedLabelRef] valueStatusPtr <- writeValueFieldPtr value 1 writeStore (writeCode "i2") (Left rhsStatus) valueStatusPtr cmp <- writeNewLocal "icmp eq i2 2," writeLocal rhsStatus "" (nilLabelRef,nonnilLabelRef) <- writeBranch cmp writeNewLabelBack [nilLabelRef] writeUnref (Left rhs) retValue (Right "2") Nothing writeNewLabelBack [nonnilLabelRef] rhsNextPtrPtr <- writeValueFieldPtr rhs 2 rhsNextRawPtr <- writeLoad (writeCode "i8*") rhsNextPtrPtr valueNextPtrPtr <- writeValueFieldPtr value 2 writeStore (writeCode "i8*") (Left rhsNextRawPtr) valueNextPtrPtr valueNext <- writeNewLocal "bitcast i8* " writeLocal rhsNextRawPtr " to " writeValueType "*" writeAddRef valueNext writeUnref (Left rhs) retValue (Left rhsStatus) (Just rhsNextRawPtr) writeNewLabelBack [unevaluatedLabelRef] rhsEvalParamPtr <- writeValueFieldPtr rhs 2 rhsEvalParam <- writeLoad (writeCode "i8*") rhsEvalParamPtr rhsEvalFuncPtr <- writeValueFieldPtr rhs 3 rhsEvalFunc <- writeLoad (writeCode "{i2,i8*}(i8*,i8*)*") rhsEvalFuncPtr rhsRawPtr <- writeNewLocal "bitcast " writeValueType "* " writeLocal rhs " to i8*" refCountPtr <- writeValueFieldPtr rhs 0 refCount <- writeLoad (writeCode "i32") refCountPtr cmp <- writeNewLocal "icmp ule i32 " writeLocal refCount ",1" (noOtherRefsLabelRef,hasOtherRefsLabelRef) <- writeBranch cmp writeNewLabelBack [noOtherRefsLabelRef] writeFree (Left rhsRawPtr) tailCallForceRetValue rhsEvalParam (Left rhsEvalFunc) writeNewLabelBack [hasOtherRefsLabelRef] when debugIndirectCalls (do writeNewLocal ("call i32(i8*,...) @printf(i8* getelementptr " ++ "([7 x i8],[7 x i8]* @debugIndirectCallsFmt" ++ ",i32 0,i32 0),i8 69,{i2,i8*}(i8*,i8*)* ") writeLocal rhsEvalFunc ")" writeNewLocal "call i32 @fflush(i8* null)" return ()) forcedResult <- writeNewLocal "call fastcc {i2,i8*} " writeLocal rhsEvalFunc "(i8* " writeLocal rhsEvalParam ",i8* " writeLocal rhsRawPtr ")" forcedStatus <- writeNewLocal "extractvalue {i2,i8*} " writeLocal forcedResult ",0" forcedNext <- writeNewLocal "extractvalue {i2,i8*} " writeLocal forcedResult ",1" nextValue <- writeNewLocal "bitcast i8* " writeLocal forcedNext " to " writeValueType "*" writeAddRef nextValue writeUnref (Left rhs) valueStatusPtr <- writeValueFieldPtr value 1 writeStore (writeCode "i2") (Left forcedStatus) valueStatusPtr valueNextPtrPtr <- writeValueFieldPtr value 2 writeStore (writeCode "i8*") (Left forcedNext) valueNextPtrPtr writeCode " ret {i2,i8*} " writeLocal forcedResult "" w (ExprFuncall (Identifier _ name) exprs) = do rhs <- writeExpr bindings expr mapM_ (writeUnref . Left) bindings -- rhs.refcount must be 1, so copy rhs into value -- future optimization: rewrite function def to take a value to -- write into instead of allocating and returning a new value rhsEvalParamPtr <- writeValueFieldPtr rhs 2 rhsEvalParam <- writeLoad (writeCode "i8*") rhsEvalParamPtr rhsEvalFuncPtr <- writeValueFieldPtr rhs 3 rhsEvalFunc <- writeLoad (writeCode "{i2,i8*}(i8*,i8*)*") rhsEvalFuncPtr rhsRawPtr <- writeNewLocal "bitcast " writeValueType "* " writeLocal rhs " to i8*" writeFree (Left rhsRawPtr) tailCallForceRetValue rhsEvalParam (Left rhsEvalFunc) w (ExprConcat expr1 expr2) = do value1 <- writeExpr bindings expr1 value2 <- writeExpr bindings expr2 mapM_ (writeUnref . Left) bindings evalParamRawPtr <- writeNewConcatValueEvalParam value1 value2 tailCallForceRetValue evalParamRawPtr (Right "@evalConcat") retValue status nextValue = do retval1 <- writeNewLocal "insertvalue {i2,i8*} undef,i2 " either (flip writeLocal "") writeCode status writeCode ",0" retval <- maybe (return retval1) (\ nextValue -> do result <- writeNewLocal "insertvalue {i2,i8*} " writeLocal retval1 ",i8* " writeLocal nextValue ",1" return result) nextValue writeCode " ret {i2,i8*} " writeLocal retval "" tailCallForceRetValue evalParam evalFunc = do when debugIndirectCalls (do writeNewLocal ("call i32(i8*,...) @printf(i8* getelementptr " ++ "([7 x i8],[7 x i8]* @debugIndirectCallsFmt" ++ ",i32 0,i32 0),i8 101,{i2,i8*}(i8*,i8*)* ") either (flip writeLocal "") writeCode evalFunc writeCode ")" writeNewLocal "call i32 @fflush(i8* null)" return ()) retval <- writeNewLocal "musttail call fastcc {i2,i8*} " either (flip writeLocal "") writeCode evalFunc writeCode "(i8* " writeLocal evalParam ",i8* %value)" writeCode " ret {i2,i8*} " writeLocal retval ""
6,262
false
true
0
14
1,817
1,497
648
849
null
null
ekmett/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
lgpl-2.1
wxSTC_GC_EVENT :: Int wxSTC_GC_EVENT = 4
40
wxSTC_GC_EVENT :: Int wxSTC_GC_EVENT = 4
40
wxSTC_GC_EVENT = 4
18
false
true
0
6
5
18
7
11
null
null
remyoudompheng/hs-language-go
Language/Go/Parser/Parser.hs
gpl-3.0
-- | Standard @ConstSpec@ goConstSpec :: GoParser GoCVSpec goConstSpec = do id <- goIdentifierList option (GoCVSpec id Nothing []) (try (goConstSpec' id) <|> goConstSpec'' id) where goConstSpec' :: [GoId] -> GoParser GoCVSpec goConstSpec' ids = do goTokEqual exs <- goExpressionList return $ GoCVSpec ids Nothing exs goConstSpec'' :: [GoId] -> GoParser GoCVSpec goConstSpec'' ids = do typ <- goType goTokEqual exs <- goExpressionList return $ GoCVSpec ids (Just typ) exs
534
goConstSpec :: GoParser GoCVSpec goConstSpec = do id <- goIdentifierList option (GoCVSpec id Nothing []) (try (goConstSpec' id) <|> goConstSpec'' id) where goConstSpec' :: [GoId] -> GoParser GoCVSpec goConstSpec' ids = do goTokEqual exs <- goExpressionList return $ GoCVSpec ids Nothing exs goConstSpec'' :: [GoId] -> GoParser GoCVSpec goConstSpec'' ids = do typ <- goType goTokEqual exs <- goExpressionList return $ GoCVSpec ids (Just typ) exs
508
goConstSpec = do id <- goIdentifierList option (GoCVSpec id Nothing []) (try (goConstSpec' id) <|> goConstSpec'' id) where goConstSpec' :: [GoId] -> GoParser GoCVSpec goConstSpec' ids = do goTokEqual exs <- goExpressionList return $ GoCVSpec ids Nothing exs goConstSpec'' :: [GoId] -> GoParser GoCVSpec goConstSpec'' ids = do typ <- goType goTokEqual exs <- goExpressionList return $ GoCVSpec ids (Just typ) exs
475
true
true
0
12
133
170
80
90
null
null
zenhack/haskell-capnp
cmd/capnpc-haskell/Trans/NewToHaskell.hs
mit
emitMarshalVariant name _ = Hs.EApp (egName ["GH"] "encodeVariant") [ Hs.ELabel name , euName "arg_" , unionStruct (euName "raw_") ]
168
emitMarshalVariant name _ = Hs.EApp (egName ["GH"] "encodeVariant") [ Hs.ELabel name , euName "arg_" , unionStruct (euName "raw_") ]
168
emitMarshalVariant name _ = Hs.EApp (egName ["GH"] "encodeVariant") [ Hs.ELabel name , euName "arg_" , unionStruct (euName "raw_") ]
168
false
false
0
9
54
55
27
28
null
null
binesiyu/ifl
examples/ch17/Regex-hsc-const-generated.hs
mit
dollar_endonly :: PCREOption dollar_endonly = PCREOption 32
59
dollar_endonly :: PCREOption dollar_endonly = PCREOption 32
59
dollar_endonly = PCREOption 32
30
false
true
0
5
6
14
7
7
null
null
rimmington/cabal
Cabal/Distribution/Simple/BuildPaths.hs
bsd-3-clause
haddockName :: PackageDescription -> FilePath haddockName pkg_descr = display (packageName pkg_descr) <.> "haddock"
115
haddockName :: PackageDescription -> FilePath haddockName pkg_descr = display (packageName pkg_descr) <.> "haddock"
115
haddockName pkg_descr = display (packageName pkg_descr) <.> "haddock"
69
false
true
0
8
12
31
15
16
null
null
seckcoder/lang-learn
haskell/lambda-calculus/src/Demo/StateT.hs
unlicense
fact n = get >>= \acc -> put (acc*n) >> (fact $ n - 1)
54
fact n = get >>= \acc -> put (acc*n) >> (fact $ n - 1)
54
fact n = get >>= \acc -> put (acc*n) >> (fact $ n - 1)
54
false
false
3
9
14
49
23
26
null
null
termite2/tsl
Abstract/BFormula.hs
bsd-3-clause
formToExpr (FNot f) = EUnOp Not $ formToExpr f
55
formToExpr (FNot f) = EUnOp Not $ formToExpr f
55
formToExpr (FNot f) = EUnOp Not $ formToExpr f
55
false
false
0
6
17
26
11
15
null
null
haskell-opengl/OpenGLRaw
src/Graphics/GL/Functions/F01.hs
bsd-3-clause
-- glBindFragDataLocationEXT --------------------------------------------------- -- | This command is an alias for 'glBindFragDataLocation'. glBindFragDataLocationEXT :: MonadIO m => GLuint -- ^ @program@. -> GLuint -- ^ @color@. -> Ptr GLchar -- ^ @name@ pointing to @COMPSIZE(name)@ elements of type @GLchar@. -> m () glBindFragDataLocationEXT v1 v2 v3 = liftIO $ dyn21 ptr_glBindFragDataLocationEXT v1 v2 v3
421
glBindFragDataLocationEXT :: MonadIO m => GLuint -- ^ @program@. -> GLuint -- ^ @color@. -> Ptr GLchar -- ^ @name@ pointing to @COMPSIZE(name)@ elements of type @GLchar@. -> m () glBindFragDataLocationEXT v1 v2 v3 = liftIO $ dyn21 ptr_glBindFragDataLocationEXT v1 v2 v3
279
glBindFragDataLocationEXT v1 v2 v3 = liftIO $ dyn21 ptr_glBindFragDataLocationEXT v1 v2 v3
90
true
true
0
11
64
67
33
34
null
null
gahag/FSQL
src/Query.hs
bsd-3-clause
fetch_source (Join rec joinType (p, p') s) = joiner joinType (eq_selector s) <$> fetch_path p rec <*> fetch_path p' rec where joiner :: JoinType -> (a -> a -> Bool) -> ([a] -> [a] -> [a]) -- Returns a function to make the join based on a equality comparer. joiner = \case Inner -> intersectBy Left -> deleteFirstsBy Right -> flip . deleteFirstsBy Outer -> \ f x x' -> joiner Left f x x' ++ joiner Right f x x' Full -> unionBy eq_selector :: Selection -> (FileInfo -> FileInfo -> Bool) eq_selector = \case Name -> (==) `on` name Date -> (==) `on` date Size -> (==) `on` size -- -------------------------------------------------------------------------------------
932
fetch_source (Join rec joinType (p, p') s) = joiner joinType (eq_selector s) <$> fetch_path p rec <*> fetch_path p' rec where joiner :: JoinType -> (a -> a -> Bool) -> ([a] -> [a] -> [a]) -- Returns a function to make the join based on a equality comparer. joiner = \case Inner -> intersectBy Left -> deleteFirstsBy Right -> flip . deleteFirstsBy Outer -> \ f x x' -> joiner Left f x x' ++ joiner Right f x x' Full -> unionBy eq_selector :: Selection -> (FileInfo -> FileInfo -> Bool) eq_selector = \case Name -> (==) `on` name Date -> (==) `on` date Size -> (==) `on` size -- -------------------------------------------------------------------------------------
932
fetch_source (Join rec joinType (p, p') s) = joiner joinType (eq_selector s) <$> fetch_path p rec <*> fetch_path p' rec where joiner :: JoinType -> (a -> a -> Bool) -> ([a] -> [a] -> [a]) -- Returns a function to make the join based on a equality comparer. joiner = \case Inner -> intersectBy Left -> deleteFirstsBy Right -> flip . deleteFirstsBy Outer -> \ f x x' -> joiner Left f x x' ++ joiner Right f x x' Full -> unionBy eq_selector :: Selection -> (FileInfo -> FileInfo -> Bool) eq_selector = \case Name -> (==) `on` name Date -> (==) `on` date Size -> (==) `on` size -- -------------------------------------------------------------------------------------
932
false
false
0
10
382
246
133
113
null
null
DavidAlphaFox/ghc
libraries/containers/Data/IntMap/Base.hs
bsd-3-clause
nequal (Tip kx x) (Tip ky y) = (kx /= ky) || (x/=y)
53
nequal (Tip kx x) (Tip ky y) = (kx /= ky) || (x/=y)
53
nequal (Tip kx x) (Tip ky y) = (kx /= ky) || (x/=y)
53
false
false
0
7
14
45
23
22
null
null
arnizamani/occam
Haskell.hs
mit
patVarBinding (HsPInfixApp p1 (Special HsCons) p2) (HsList (x:xs)) = patVarBinding p1 x ++ patVarBinding p2 (HsList xs)
127
patVarBinding (HsPInfixApp p1 (Special HsCons) p2) (HsList (x:xs)) = patVarBinding p1 x ++ patVarBinding p2 (HsList xs)
127
patVarBinding (HsPInfixApp p1 (Special HsCons) p2) (HsList (x:xs)) = patVarBinding p1 x ++ patVarBinding p2 (HsList xs)
127
false
false
3
9
24
66
29
37
null
null
lifengsun/haskell-exercise
scheme/03/evaluator3.hs
gpl-3.0
eval (List (Atom func : args)) = apply func . map eval $ args
61
eval (List (Atom func : args)) = apply func . map eval $ args
61
eval (List (Atom func : args)) = apply func . map eval $ args
61
false
false
0
10
13
39
18
21
null
null
meiersi/scyther-proof
src/Scyther/Facts.hs
gpl-3.0
-- | Add a newly quantified variable. addNewVar :: Either TID ArbMsgId -> ChainRuleM () addNewVar v = modify $ \crs -> crs { crsNewVars = crsNewVars crs ++ [v] }
161
addNewVar :: Either TID ArbMsgId -> ChainRuleM () addNewVar v = modify $ \crs -> crs { crsNewVars = crsNewVars crs ++ [v] }
123
addNewVar v = modify $ \crs -> crs { crsNewVars = crsNewVars crs ++ [v] }
73
true
true
2
10
30
62
30
32
null
null
siddhanathan/ghc
testsuite/tests/typecheck/should_compile/T7641.hs
bsd-3-clause
baz () = toFoo $ \_ -> ()
25
baz () = toFoo $ \_ -> ()
25
baz () = toFoo $ \_ -> ()
25
false
false
3
7
7
27
11
16
null
null
reiddraper/cauterize
src/Cauterize/Dynamic/Common.hs
bsd-3-clause
isNameOf :: T.Text -> BIDetails -> Bool isNameOf "u8" (BDu8 _) = True
69
isNameOf :: T.Text -> BIDetails -> Bool isNameOf "u8" (BDu8 _) = True
69
isNameOf "u8" (BDu8 _) = True
29
false
true
0
10
12
38
17
21
null
null
DiegoNolan/Asciify
Asciify.hs
mit
charToNovem 'x' = Novemant Bnk Bnk Bnk Drk Drk Drk Drk Drk Drk
64
charToNovem 'x' = Novemant Bnk Bnk Bnk Drk Drk Drk Drk Drk Drk
64
charToNovem 'x' = Novemant Bnk Bnk Bnk Drk Drk Drk Drk Drk Drk
64
false
false
0
5
14
29
13
16
null
null
fmapfmapfmap/amazonka
amazonka-ml/gen/Network/AWS/MachineLearning/GetBatchPrediction.hs
mpl-2.0
-- | The location of the data file or directory in Amazon Simple Storage -- Service (Amazon S3). gbprsInputDataLocationS3 :: Lens' GetBatchPredictionResponse (Maybe Text) gbprsInputDataLocationS3 = lens _gbprsInputDataLocationS3 (\ s a -> s{_gbprsInputDataLocationS3 = a})
272
gbprsInputDataLocationS3 :: Lens' GetBatchPredictionResponse (Maybe Text) gbprsInputDataLocationS3 = lens _gbprsInputDataLocationS3 (\ s a -> s{_gbprsInputDataLocationS3 = a})
175
gbprsInputDataLocationS3 = lens _gbprsInputDataLocationS3 (\ s a -> s{_gbprsInputDataLocationS3 = a})
101
true
true
0
9
34
47
26
21
null
null
shimanekb/H-99SetTwo
problem14/src/H99/Problem14.hs
gpl-3.0
dupli (x:xs) = x : x : dupli xs
31
dupli (x:xs) = x : x : dupli xs
31
dupli (x:xs) = x : x : dupli xs
31
false
false
0
7
8
27
13
14
null
null
kmels/xmonad-launcher
XMonad/Util/Font.hs
bsd-3-clause
-- $usage -- See "XMonad.Layout.Tabbed" or "XMonad.Prompt" for usage examples -- | Get the Pixel value for a named color: if an invalid name is -- given the black pixel will be returned. stringToPixel :: (Functor m, MonadIO m) => Display -> String -> m Pixel stringToPixel d s = fromMaybe fallBack <$> io getIt where getIt = initColor d s fallBack = blackPixel d (defaultScreen d)
398
stringToPixel :: (Functor m, MonadIO m) => Display -> String -> m Pixel stringToPixel d s = fromMaybe fallBack <$> io getIt where getIt = initColor d s fallBack = blackPixel d (defaultScreen d)
210
stringToPixel d s = fromMaybe fallBack <$> io getIt where getIt = initColor d s fallBack = blackPixel d (defaultScreen d)
138
true
true
1
8
84
85
43
42
null
null
kawu/named
Text/Named/TeiNCP.hs
bsd-2-clause
nameP :: P NE nameP = (tag "seg" *> getAttr "xml:id") `join` \neID -> do ne <- nameBodyP ptrs <- some namePtrP <|> failBad ("no targets specified for " ++ L.unpack neID) return $ ne { neID = neID, ptrs = ptrs }
230
nameP :: P NE nameP = (tag "seg" *> getAttr "xml:id") `join` \neID -> do ne <- nameBodyP ptrs <- some namePtrP <|> failBad ("no targets specified for " ++ L.unpack neID) return $ ne { neID = neID, ptrs = ptrs }
230
nameP = (tag "seg" *> getAttr "xml:id") `join` \neID -> do ne <- nameBodyP ptrs <- some namePtrP <|> failBad ("no targets specified for " ++ L.unpack neID) return $ ne { neID = neID, ptrs = ptrs }
216
false
true
0
15
62
95
48
47
null
null
anttisalonen/freekick2
src/Swos.hs
gpl-3.0
isGoalkeeper :: SWOSPosition -> Bool isGoalkeeper n = n == Goalkeeper
69
isGoalkeeper :: SWOSPosition -> Bool isGoalkeeper n = n == Goalkeeper
69
isGoalkeeper n = n == Goalkeeper
32
false
true
0
5
10
22
11
11
null
null
dmcclean/HaTeX
Text/LaTeX/Packages/AMSMath.hs
bsd-3-clause
-- | Superscript. (^:) :: LaTeXC l => l -> l -> l x ^: y = braces x <> raw "^" <> braces y
91
(^:) :: LaTeXC l => l -> l -> l x ^: y = braces x <> raw "^" <> braces y
73
x ^: y = braces x <> raw "^" <> braces y
41
true
true
4
10
25
58
26
32
null
null
dysinger/amazonka
amazonka-ec2/gen/Network/AWS/EC2/CopySnapshot.hs
mpl-2.0
-- | A description for the new Amazon EBS snapshot. csDescription :: Lens' CopySnapshot (Maybe Text) csDescription = lens _csDescription (\s a -> s { _csDescription = a })
171
csDescription :: Lens' CopySnapshot (Maybe Text) csDescription = lens _csDescription (\s a -> s { _csDescription = a })
119
csDescription = lens _csDescription (\s a -> s { _csDescription = a })
70
true
true
1
9
28
49
25
24
null
null
zaxtax/gametheory
GameTheory.hs
mit
grimTrigger me False False = conditioned $ bern 0.1
52
grimTrigger me False False = conditioned $ bern 0.1
52
grimTrigger me False False = conditioned $ bern 0.1
52
false
false
0
6
9
20
9
11
null
null
ItsLastDay/academic_university_2016-2018
subjects/Haskell/14/fp14Zippper.hs
gpl-3.0
delLZ :: ListZ a -> ListZ a delLZ (e,(xs,y:ys)) = (y,(xs,ys))
62
delLZ :: ListZ a -> ListZ a delLZ (e,(xs,y:ys)) = (y,(xs,ys))
61
delLZ (e,(xs,y:ys)) = (y,(xs,ys))
33
false
true
0
7
11
56
30
26
null
null
oldmanmike/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
getRegister' dflags _ (CmmLit lit) = do let format = cmmTypeFormat (cmmLitType dflags lit) imm = litToImm lit code dst = unitOL (MOV format (OpImm imm) (OpReg dst)) return (Any format code)
220
getRegister' dflags _ (CmmLit lit) = do let format = cmmTypeFormat (cmmLitType dflags lit) imm = litToImm lit code dst = unitOL (MOV format (OpImm imm) (OpReg dst)) return (Any format code)
220
getRegister' dflags _ (CmmLit lit) = do let format = cmmTypeFormat (cmmLitType dflags lit) imm = litToImm lit code dst = unitOL (MOV format (OpImm imm) (OpReg dst)) return (Any format code)
220
false
false
1
15
62
98
44
54
null
null
aburnett88/HSat
tests-src/Test/Problem/ProblemExpr.hs
mit
tests :: TestTree tests = testGroup name [ Class.tests ]
66
tests :: TestTree tests = testGroup name [ Class.tests ]
66
tests = testGroup name [ Class.tests ]
48
false
true
0
7
19
21
11
10
null
null
sinelaw/lamdu
Lamdu/Sugar/Convert.hs
gpl-3.0
toHole :: MonadA m => Stored m -> T m () toHole = void . DataOps.setToHole
74
toHole :: MonadA m => Stored m -> T m () toHole = void . DataOps.setToHole
74
toHole = void . DataOps.setToHole
33
false
true
0
9
15
44
19
25
null
null
shlevy/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
emitPrimOp dflags res WriteOffAddrOp_Word16 args = doWriteOffAddrOp (Just (mo_WordTo16 dflags)) b16 res args
118
emitPrimOp dflags res WriteOffAddrOp_Word16 args = doWriteOffAddrOp (Just (mo_WordTo16 dflags)) b16 res args
118
emitPrimOp dflags res WriteOffAddrOp_Word16 args = doWriteOffAddrOp (Just (mo_WordTo16 dflags)) b16 res args
118
false
false
0
9
22
40
17
23
null
null
lukemaurer/sequent-core
src/Language/SequentCore/Syntax.hs
bsd-3-clause
-- | True if the given alternative is a default alternative, @Alt DEFAULT _ _@. isDefaultAlt :: Alt b -> Bool isDefaultAlt (Alt DEFAULT _ _) = True
147
isDefaultAlt :: Alt b -> Bool isDefaultAlt (Alt DEFAULT _ _) = True
67
isDefaultAlt (Alt DEFAULT _ _) = True
37
true
true
0
7
27
32
16
16
null
null
ghcjs/ghcjs
src/Compiler/JMacro/Combinators.hs
mit
math_pow = math_ "pow"
23
math_pow = math_ "pow"
23
math_pow = math_ "pow"
23
false
false
0
5
4
9
4
5
null
null
spacekitteh/smcghc
compiler/nativeGen/SPARC/CodeGen.hs
bsd-3-clause
assignMem_IntCode :: Size -> CmmExpr -> CmmExpr -> NatM InstrBlock assignMem_IntCode pk addr src = do (srcReg, code) <- getSomeReg src Amode dstAddr addr_code <- getAmode addr return $ code `appOL` addr_code `snocOL` ST pk srcReg dstAddr
249
assignMem_IntCode :: Size -> CmmExpr -> CmmExpr -> NatM InstrBlock assignMem_IntCode pk addr src = do (srcReg, code) <- getSomeReg src Amode dstAddr addr_code <- getAmode addr return $ code `appOL` addr_code `snocOL` ST pk srcReg dstAddr
249
assignMem_IntCode pk addr src = do (srcReg, code) <- getSomeReg src Amode dstAddr addr_code <- getAmode addr return $ code `appOL` addr_code `snocOL` ST pk srcReg dstAddr
182
false
true
0
9
48
90
44
46
null
null
spacekitteh/smcghc
compiler/nativeGen/X86/Ppr.hs
bsd-3-clause
-- FETCHPC for PIC on Darwin/x86 -- get the instruction pointer into a register -- (Terminology note: the IP is called Program Counter on PPC, -- and it's a good thing to use the same name on both platforms) pprInstr (FETCHPC reg) = vcat [ ptext (sLit "\tcall 1f"), hcat [ ptext (sLit "1:\tpopl\t"), pprReg II32 reg ] ]
357
pprInstr (FETCHPC reg) = vcat [ ptext (sLit "\tcall 1f"), hcat [ ptext (sLit "1:\tpopl\t"), pprReg II32 reg ] ]
136
pprInstr (FETCHPC reg) = vcat [ ptext (sLit "\tcall 1f"), hcat [ ptext (sLit "1:\tpopl\t"), pprReg II32 reg ] ]
136
true
false
0
11
96
60
31
29
null
null
snoyberg/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
functorClassName = clsQual gHC_BASE (fsLit "Functor") functorClassKey
73
functorClassName = clsQual gHC_BASE (fsLit "Functor") functorClassKey
73
functorClassName = clsQual gHC_BASE (fsLit "Functor") functorClassKey
73
false
false
0
7
10
19
9
10
null
null
ghorn/nlopt-haskell
Nlopt/Enums.hs
bsd-3-clause
algorithmToCInt NLOPT_G_MLSL_LDS = 39
37
algorithmToCInt NLOPT_G_MLSL_LDS = 39
37
algorithmToCInt NLOPT_G_MLSL_LDS = 39
37
false
false
0
4
3
10
4
6
null
null
alex1818/usb
Setup.hs
bsd-3-clause
------------------------------------------------------------------------------- -- Cabal setup program which sets the CPP define '__HADDOCK __' when haddock is run. ------------------------------------------------------------------------------- main :: IO () main = defaultMainWithHooks hooks where hooks = simpleUserHooks { haddockHook = haddockHook' } -- Define __HADDOCK__ for CPP when running haddock.
413
main :: IO () main = defaultMainWithHooks hooks where hooks = simpleUserHooks { haddockHook = haddockHook' } -- Define __HADDOCK__ for CPP when running haddock.
167
main = defaultMainWithHooks hooks where hooks = simpleUserHooks { haddockHook = haddockHook' } -- Define __HADDOCK__ for CPP when running haddock.
153
true
true
0
6
49
39
22
17
null
null
SWP-Ubau-SoSe2014-Haskell/SWPSoSe14
src/RailEditor/TextAreaContent.hs
mit
_getCellsByPositions :: TextAreaContent -> [Position] -> [(Char,Bool)] -> IO [(Char,Bool)] _getCellsByPositions _ [] cells = return cells
137
_getCellsByPositions :: TextAreaContent -> [Position] -> [(Char,Bool)] -> IO [(Char,Bool)] _getCellsByPositions _ [] cells = return cells
137
_getCellsByPositions _ [] cells = return cells
46
false
true
0
10
16
59
32
27
null
null
bjornbm/dimensional-experimental
src/Numeric/Units/Dimensional/Formulae.hs
bsd-3-clause
wiensDisplacementLaw' :: Floating a => ThermodynamicTemperature a -> Frequency a wiensDisplacementLaw' t = t * b' where b' = 5.8789254e10 *~ (hertz / kelvin) -- Uncertainty: 53 -- Planck's law TODO
233
wiensDisplacementLaw' :: Floating a => ThermodynamicTemperature a -> Frequency a wiensDisplacementLaw' t = t * b' where b' = 5.8789254e10 *~ (hertz / kelvin) -- Uncertainty: 53 -- Planck's law TODO
233
wiensDisplacementLaw' t = t * b' where b' = 5.8789254e10 *~ (hertz / kelvin) -- Uncertainty: 53 -- Planck's law TODO
152
false
true
0
9
66
55
28
27
null
null
remyoudompheng/hs-language-go
tests/Tests/Types.hs
gpl-3.0
nF1 = NamedType "" "F1" uF []
29
nF1 = NamedType "" "F1" uF []
29
nF1 = NamedType "" "F1" uF []
29
false
false
1
6
6
24
8
16
null
null
plow-technologies/valentine
test/Valentine/ParserSpec.hs
mit
-------------------------------------------------- -- Text on a line, transformed into text line text -------------------------------------------------- quotedStringOneLine = [here| <div> <section id="hello-app"> <header id="header"> <div> Hello <div> pumpernell <div> Guffman |]
365
quotedStringOneLine = [here| <div> <section id="hello-app"> <header id="header"> <div> Hello <div> pumpernell <div> Guffman |]
212
quotedStringOneLine = [here| <div> <section id="hello-app"> <header id="header"> <div> Hello <div> pumpernell <div> Guffman |]
212
true
false
1
5
112
17
10
7
null
null
danieldk/digest-pure
test/TestSuiteDigestPure.hs
apache-2.0
succesful _ = False
33
succesful _ = False
33
succesful _ = False
33
false
false
0
4
17
10
4
6
null
null
fmapfmapfmap/amazonka
amazonka-rds/gen/Network/AWS/RDS/ListTagsForResource.hs
mpl-2.0
-- | The Amazon RDS resource with tags to be listed. This value is an Amazon -- Resource Name (ARN). For information about creating an ARN, see -- <http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html#USER_Tagging.ARN Constructing an RDS Amazon Resource Name (ARN)>. ltfrResourceName :: Lens' ListTagsForResource Text ltfrResourceName = lens _ltfrResourceName (\ s a -> s{_ltfrResourceName = a})
414
ltfrResourceName :: Lens' ListTagsForResource Text ltfrResourceName = lens _ltfrResourceName (\ s a -> s{_ltfrResourceName = a})
128
ltfrResourceName = lens _ltfrResourceName (\ s a -> s{_ltfrResourceName = a})
77
true
true
0
9
51
42
24
18
null
null
snoyberg/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
isRhoTy (ForAllTy {}) = False
29
isRhoTy (ForAllTy {}) = False
29
isRhoTy (ForAllTy {}) = False
29
false
false
0
6
4
17
8
9
null
null
onponomarev/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
luxiReqAll :: FrozenSet String luxiReqAll = ConstantUtils.mkSet [ luxiReqArchiveJob , luxiReqAutoArchiveJobs , luxiReqCancelJob , luxiReqChangeJobPriority , luxiReqQuery , luxiReqQueryClusterInfo , luxiReqQueryConfigValues , luxiReqQueryExports , luxiReqQueryFields , luxiReqQueryGroups , luxiReqQueryInstances , luxiReqQueryJobs , luxiReqQueryNodes , luxiReqQueryNetworks , luxiReqQueryTags , luxiReqSetDrainFlag , luxiReqSetWatcherPause , luxiReqSubmitJob , luxiReqSubmitJobToDrainedQueue , luxiReqSubmitManyJobs , luxiReqWaitForJobChange , luxiReqPickupJob , luxiReqQueryFilters , luxiReqReplaceFilter , luxiReqDeleteFilter ]
682
luxiReqAll :: FrozenSet String luxiReqAll = ConstantUtils.mkSet [ luxiReqArchiveJob , luxiReqAutoArchiveJobs , luxiReqCancelJob , luxiReqChangeJobPriority , luxiReqQuery , luxiReqQueryClusterInfo , luxiReqQueryConfigValues , luxiReqQueryExports , luxiReqQueryFields , luxiReqQueryGroups , luxiReqQueryInstances , luxiReqQueryJobs , luxiReqQueryNodes , luxiReqQueryNetworks , luxiReqQueryTags , luxiReqSetDrainFlag , luxiReqSetWatcherPause , luxiReqSubmitJob , luxiReqSubmitJobToDrainedQueue , luxiReqSubmitManyJobs , luxiReqWaitForJobChange , luxiReqPickupJob , luxiReqQueryFilters , luxiReqReplaceFilter , luxiReqDeleteFilter ]
682
luxiReqAll = ConstantUtils.mkSet [ luxiReqArchiveJob , luxiReqAutoArchiveJobs , luxiReqCancelJob , luxiReqChangeJobPriority , luxiReqQuery , luxiReqQueryClusterInfo , luxiReqQueryConfigValues , luxiReqQueryExports , luxiReqQueryFields , luxiReqQueryGroups , luxiReqQueryInstances , luxiReqQueryJobs , luxiReqQueryNodes , luxiReqQueryNetworks , luxiReqQueryTags , luxiReqSetDrainFlag , luxiReqSetWatcherPause , luxiReqSubmitJob , luxiReqSubmitJobToDrainedQueue , luxiReqSubmitManyJobs , luxiReqWaitForJobChange , luxiReqPickupJob , luxiReqQueryFilters , luxiReqReplaceFilter , luxiReqDeleteFilter ]
651
false
true
0
6
111
99
60
39
null
null
phischu/fragnix
tests/packages/scotty/Data.ByteString.Builder.Extra.hs
bsd-3-clause
word32Host :: Word32 -> Builder word32Host = P.primFixed P.word32Host
69
word32Host :: Word32 -> Builder word32Host = P.primFixed P.word32Host
69
word32Host = P.primFixed P.word32Host
37
false
true
0
6
8
22
11
11
null
null
DavidAlphaFox/ghc
libraries/Cabal/cabal-install/Distribution/Client/Freeze.hs
bsd-3-clause
pruneInstallPlan :: InstallPlan.InstallPlan -> [PackageSpecifier SourcePackage] -> Either [PlanPackage] [(PlanPackage, [PackageIdentifier])] pruneInstallPlan installPlan pkgSpecifiers = mapLeft (removeSelf pkgIds . PackageIndex.allPackages) $ PackageIndex.dependencyClosure pkgIdx pkgIds where pkgIdx = PackageIndex.fromList $ InstallPlan.toList installPlan pkgIds = [ packageId pkg | SpecificSourcePackage pkg <- pkgSpecifiers ] mapLeft f (Left v) = Left $ f v mapLeft _ (Right v) = Right v removeSelf [thisPkg] = filter (\pp -> packageId pp /= thisPkg) removeSelf _ = error $ "internal error: 'pruneInstallPlan' given " ++ "unexpected package specifiers!"
745
pruneInstallPlan :: InstallPlan.InstallPlan -> [PackageSpecifier SourcePackage] -> Either [PlanPackage] [(PlanPackage, [PackageIdentifier])] pruneInstallPlan installPlan pkgSpecifiers = mapLeft (removeSelf pkgIds . PackageIndex.allPackages) $ PackageIndex.dependencyClosure pkgIdx pkgIds where pkgIdx = PackageIndex.fromList $ InstallPlan.toList installPlan pkgIds = [ packageId pkg | SpecificSourcePackage pkg <- pkgSpecifiers ] mapLeft f (Left v) = Left $ f v mapLeft _ (Right v) = Right v removeSelf [thisPkg] = filter (\pp -> packageId pp /= thisPkg) removeSelf _ = error $ "internal error: 'pruneInstallPlan' given " ++ "unexpected package specifiers!"
745
pruneInstallPlan installPlan pkgSpecifiers = mapLeft (removeSelf pkgIds . PackageIndex.allPackages) $ PackageIndex.dependencyClosure pkgIdx pkgIds where pkgIdx = PackageIndex.fromList $ InstallPlan.toList installPlan pkgIds = [ packageId pkg | SpecificSourcePackage pkg <- pkgSpecifiers ] mapLeft f (Left v) = Left $ f v mapLeft _ (Right v) = Right v removeSelf [thisPkg] = filter (\pp -> packageId pp /= thisPkg) removeSelf _ = error $ "internal error: 'pruneInstallPlan' given " ++ "unexpected package specifiers!"
570
false
true
7
11
169
225
104
121
null
null
scrive/consumers
test/Test.hs
bsd-3-clause
consumersTable :: Table consumersTable = tblTable { tblName = "consumers_test_consumers" , tblVersion = 1 , tblColumns = [ tblColumn { colName = "id", colType = BigSerialT , colNullable = False } , tblColumn { colName = "name", colType = TextT , colNullable = False } , tblColumn { colName = "last_activity", colType = TimestampWithZoneT , colNullable = False } ] , tblPrimaryKey = pkOnColumn "id" }
495
consumersTable :: Table consumersTable = tblTable { tblName = "consumers_test_consumers" , tblVersion = 1 , tblColumns = [ tblColumn { colName = "id", colType = BigSerialT , colNullable = False } , tblColumn { colName = "name", colType = TextT , colNullable = False } , tblColumn { colName = "last_activity", colType = TimestampWithZoneT , colNullable = False } ] , tblPrimaryKey = pkOnColumn "id" }
495
consumersTable = tblTable { tblName = "consumers_test_consumers" , tblVersion = 1 , tblColumns = [ tblColumn { colName = "id", colType = BigSerialT , colNullable = False } , tblColumn { colName = "name", colType = TextT , colNullable = False } , tblColumn { colName = "last_activity", colType = TimestampWithZoneT , colNullable = False } ] , tblPrimaryKey = pkOnColumn "id" }
471
false
true
0
10
161
113
70
43
null
null
blanu/Dust-tools
Dust/Services/File/File.hs
gpl-2.0
splitData :: Int -> ByteString -> [ByteString] splitData size bs = if B.length bs < size then [bs] else (B.take size bs) : splitData size (B.drop size bs)
174
splitData :: Int -> ByteString -> [ByteString] splitData size bs = if B.length bs < size then [bs] else (B.take size bs) : splitData size (B.drop size bs)
174
splitData size bs = if B.length bs < size then [bs] else (B.take size bs) : splitData size (B.drop size bs)
127
false
true
0
10
47
81
40
41
null
null
josuf107/Adverb
Adverb/Common.hs
gpl-3.0
validly = id
12
validly = id
12
validly = id
12
false
false
0
4
2
6
3
3
null
null
josefs/autosar
oldARSim/ARSim.hs
bsd-3-clause
sequentialise k _ = []
30
sequentialise k _ = []
30
sequentialise k _ = []
30
false
false
0
5
12
15
6
9
null
null
Concomitant/LambdaHack
Game/LambdaHack/Common/ActorState.hs
bsd-3-clause
lidFromC (CActor aid _) s = blid $ getActorBody aid s
53
lidFromC (CActor aid _) s = blid $ getActorBody aid s
53
lidFromC (CActor aid _) s = blid $ getActorBody aid s
53
false
false
0
7
10
28
13
15
null
null
andorp/bead
test/Test/Property/Persistence.hs
bsd-3-clause
setGroupAdmins as gs n = do quick n $ do a <- pick $ elements as g <- pick $ elements gs runPersistCmd $ createGroupAdmin a g -- SubmissionInfoList is a list from username, assignment-key and the submission-key for them. -- Interpretation: The submission information about which user submitted which submission -- for the given assignment.
354
setGroupAdmins as gs n = do quick n $ do a <- pick $ elements as g <- pick $ elements gs runPersistCmd $ createGroupAdmin a g -- SubmissionInfoList is a list from username, assignment-key and the submission-key for them. -- Interpretation: The submission information about which user submitted which submission -- for the given assignment.
354
setGroupAdmins as gs n = do quick n $ do a <- pick $ elements as g <- pick $ elements gs runPersistCmd $ createGroupAdmin a g -- SubmissionInfoList is a list from username, assignment-key and the submission-key for them. -- Interpretation: The submission information about which user submitted which submission -- for the given assignment.
354
false
false
1
13
70
72
30
42
null
null
mettekou/ghc
compiler/typecheck/TcEvidence.hs
bsd-3-clause
isEmptyTcEvBinds (TcEvBinds {}) = panic "isEmptyTcEvBinds"
58
isEmptyTcEvBinds (TcEvBinds {}) = panic "isEmptyTcEvBinds"
58
isEmptyTcEvBinds (TcEvBinds {}) = panic "isEmptyTcEvBinds"
58
false
false
0
7
5
19
9
10
null
null
pacak/sqroll
src/Database/Sqroll/Sqlite3.hs
bsd-3-clause
showStatus 12 = "Unknown opcode in sqlite3_file_control()"
58
showStatus 12 = "Unknown opcode in sqlite3_file_control()"
58
showStatus 12 = "Unknown opcode in sqlite3_file_control()"
58
false
false
0
5
6
9
4
5
null
null
2ion/yst
Yst/Data.hs
gpl-2.0
-- | Case-insensitive string parser. pString :: String -> GenParser Char st String pString s = do s' <- count (length s) anyChar if map toLower s == map toLower s' then return s else mzero
202
pString :: String -> GenParser Char st String pString s = do s' <- count (length s) anyChar if map toLower s == map toLower s' then return s else mzero
165
pString s = do s' <- count (length s) anyChar if map toLower s == map toLower s' then return s else mzero
119
true
true
0
10
49
77
35
42
null
null
fmthoma/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
enumFromThenToClassOpKey = mkPreludeMiscIdUnique 166
57
enumFromThenToClassOpKey = mkPreludeMiscIdUnique 166
57
enumFromThenToClassOpKey = mkPreludeMiscIdUnique 166
57
false
false
0
5
8
9
4
5
null
null
wavewave/hxournal
lib/Application/HXournal/Coroutine/Default.hs
bsd-2-clause
defaultEventProcess (VScrollBarStart cid _v) = vscrollStart cid
63
defaultEventProcess (VScrollBarStart cid _v) = vscrollStart cid
63
defaultEventProcess (VScrollBarStart cid _v) = vscrollStart cid
63
false
false
0
7
6
20
9
11
null
null
spechub/Hets
SoftFOL/ProveMetis.hs
gpl-2.0
metisProveCMDLautomaticBatch :: Bool -- ^ True means include proved theorems -> Bool -- ^ True means save problem file -> Concurrent.MVar (Result.Result [ProofStatus ProofTree]) -- ^ used to store the result of the batch run -> String -- ^ theory name -> TacticScript -- ^ default tactic script -> Theory Sign Sentence ProofTree {- ^ theory consisting of a 'SoftFOL.Sign.Sign' and a list of Named 'SoftFOL.Sign.Sentence' -} -> [FreeDefMorphism SPTerm SoftFOLMorphism] -- ^ freeness constraints -> IO (Concurrent.ThreadId, Concurrent.MVar ()) {- ^ fst: identifier of the batch thread for killing it snd: MVar to wait for the end of the thread -} metisProveCMDLautomaticBatch inclProvedThs saveProblem_batch resultMVar thName defTS th freedefs = genericCMDLautomaticBatch (atpFun thName) inclProvedThs saveProblem_batch resultMVar (proverName metisProver) thName (parseTacticScript batchTimeLimit [] defTS) th freedefs emptyProofTree
1,086
metisProveCMDLautomaticBatch :: Bool -- ^ True means include proved theorems -> Bool -- ^ True means save problem file -> Concurrent.MVar (Result.Result [ProofStatus ProofTree]) -- ^ used to store the result of the batch run -> String -- ^ theory name -> TacticScript -- ^ default tactic script -> Theory Sign Sentence ProofTree {- ^ theory consisting of a 'SoftFOL.Sign.Sign' and a list of Named 'SoftFOL.Sign.Sentence' -} -> [FreeDefMorphism SPTerm SoftFOLMorphism] -- ^ freeness constraints -> IO (Concurrent.ThreadId, Concurrent.MVar ()) metisProveCMDLautomaticBatch inclProvedThs saveProblem_batch resultMVar thName defTS th freedefs = genericCMDLautomaticBatch (atpFun thName) inclProvedThs saveProblem_batch resultMVar (proverName metisProver) thName (parseTacticScript batchTimeLimit [] defTS) th freedefs emptyProofTree
961
metisProveCMDLautomaticBatch inclProvedThs saveProblem_batch resultMVar thName defTS th freedefs = genericCMDLautomaticBatch (atpFun thName) inclProvedThs saveProblem_batch resultMVar (proverName metisProver) thName (parseTacticScript batchTimeLimit [] defTS) th freedefs emptyProofTree
330
true
true
0
16
281
169
83
86
null
null
shlevy/ghc
compiler/prelude/TysWiredIn.hs
bsd-3-clause
-- See Note [Kind-changing of (~) and Coercible] -- in libraries/ghc-prim/GHC/Types.hs heqTyConName, heqDataConName, heqSCSelIdName :: Name heqTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "~~") heqTyConKey heqTyCon
239
heqTyConName, heqDataConName, heqSCSelIdName :: Name heqTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "~~") heqTyConKey heqTyCon
152
heqTyConName = mkWiredInTyConName UserSyntax gHC_TYPES (fsLit "~~") heqTyConKey heqTyCon
99
true
true
0
7
35
34
20
14
null
null
ryzhyk/cocoon
cocoon/Expr.hs
apache-2.0
exprRefersToPkt :: Expr -> Bool exprRefersToPkt (EVar _ _) = False
74
exprRefersToPkt :: Expr -> Bool exprRefersToPkt (EVar _ _) = False
74
exprRefersToPkt (EVar _ _) = False
42
false
true
0
6
18
30
14
16
null
null
brendanhay/gogol
gogol-blogger/gen/Network/Google/Blogger/Types/Product.hs
mpl-2.0
-- | True if the user has Author level access to the post. ppuiHasEditAccess :: Lens' PostPerUserInfo (Maybe Bool) ppuiHasEditAccess = lens _ppuiHasEditAccess (\ s a -> s{_ppuiHasEditAccess = a})
203
ppuiHasEditAccess :: Lens' PostPerUserInfo (Maybe Bool) ppuiHasEditAccess = lens _ppuiHasEditAccess (\ s a -> s{_ppuiHasEditAccess = a})
144
ppuiHasEditAccess = lens _ppuiHasEditAccess (\ s a -> s{_ppuiHasEditAccess = a})
88
true
true
1
9
37
52
25
27
null
null
kosmoskatten/hats
src/Network/Nats/Message/Writer.hs
mit
-- | Translate a ProtocolError to a Builder. writePE :: ProtocolError -> Builder writePE UnknownProtocolOperation = byteString "\'Unknown Protocol Operation\'"
159
writePE :: ProtocolError -> Builder writePE UnknownProtocolOperation = byteString "\'Unknown Protocol Operation\'"
114
writePE UnknownProtocolOperation = byteString "\'Unknown Protocol Operation\'"
78
true
true
0
5
19
22
11
11
null
null
tomahawkins/verilog
Language/Verilog/AST.hs
bsd-3-clause
indent :: String -> String indent a = '\t' : f a where f [] = [] f (a : rest) | a == '\n' = "\n\t" ++ f rest | otherwise = a : f rest
147
indent :: String -> String indent a = '\t' : f a where f [] = [] f (a : rest) | a == '\n' = "\n\t" ++ f rest | otherwise = a : f rest
147
indent a = '\t' : f a where f [] = [] f (a : rest) | a == '\n' = "\n\t" ++ f rest | otherwise = a : f rest
120
false
true
1
8
50
88
41
47
null
null
brendanhay/gogol
gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs
mpl-2.0
-- | Specifies the initial learning rate for the line search learn rate -- strategy. toInitialLearnRate :: Lens' TrainingOptions (Maybe Double) toInitialLearnRate = lens _toInitialLearnRate (\ s a -> s{_toInitialLearnRate = a}) . mapping _Coerce
259
toInitialLearnRate :: Lens' TrainingOptions (Maybe Double) toInitialLearnRate = lens _toInitialLearnRate (\ s a -> s{_toInitialLearnRate = a}) . mapping _Coerce
174
toInitialLearnRate = lens _toInitialLearnRate (\ s a -> s{_toInitialLearnRate = a}) . mapping _Coerce
115
true
true
0
10
48
56
29
27
null
null
mreluzeon/block-monad
src/STMSet.hs
lgpl-3.0
getElems :: (Ord a) => STMSet a -> STM (Elems a) getElems (STMSet set) = do readTVar set
90
getElems :: (Ord a) => STMSet a -> STM (Elems a) getElems (STMSet set) = do readTVar set
90
getElems (STMSet set) = do readTVar set
41
false
true
0
10
19
56
25
31
null
null
Brightgalrs/con-lang-gen
src/Constants.hs
mit
placeDistance RETROFLEX PALATAL = 3
35
placeDistance RETROFLEX PALATAL = 3
35
placeDistance RETROFLEX PALATAL = 3
35
false
false
0
5
4
11
5
6
null
null
shockkolate/arata
src/Arata/DB.hs
apache-2.0
updateDB u = do as <- gets acidState liftIO (update as u)
67
updateDB u = do as <- gets acidState liftIO (update as u)
67
updateDB u = do as <- gets acidState liftIO (update as u)
67
false
false
0
9
21
33
14
19
null
null
prt2121/haskell-practice
exercism/strain/Strain.hs
apache-2.0
keep :: (a -> Bool) -> [a] -> [a] keep p ls = foldr (\x acc -> if p x then x : acc else acc) [] ls
98
keep :: (a -> Bool) -> [a] -> [a] keep p ls = foldr (\x acc -> if p x then x : acc else acc) [] ls
98
keep p ls = foldr (\x acc -> if p x then x : acc else acc) [] ls
64
false
true
0
9
27
71
38
33
null
null
google/hrepl
bazel/Bazel/Query.hs
apache-2.0
-- | Unions of multiple expressions. union :: [Query] -> Query union [] = Empty
79
union :: [Query] -> Query union [] = Empty
42
union [] = Empty
16
true
true
0
6
14
24
13
11
null
null
brendanhay/gogol
gogol-civicinfo/gen/Network/Google/CivicInfo/Types/Product.hs
mpl-2.0
-- | Creates a value of 'RepresentativeInfoDataDivisions' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'riddAddtional' representativeInfoDataDivisions :: HashMap Text GeographicDivision -- ^ 'riddAddtional' -> RepresentativeInfoDataDivisions representativeInfoDataDivisions pRiddAddtional_ = RepresentativeInfoDataDivisions' {_riddAddtional = _Coerce # pRiddAddtional_}
467
representativeInfoDataDivisions :: HashMap Text GeographicDivision -- ^ 'riddAddtional' -> RepresentativeInfoDataDivisions representativeInfoDataDivisions pRiddAddtional_ = RepresentativeInfoDataDivisions' {_riddAddtional = _Coerce # pRiddAddtional_}
260
representativeInfoDataDivisions pRiddAddtional_ = RepresentativeInfoDataDivisions' {_riddAddtional = _Coerce # pRiddAddtional_}
129
true
true
0
8
62
50
26
24
null
null
gefei/learning_haskell
euler/euler.hs
mit
e002 n = sum (filter (even) (takeWhile (<= n) fib))
51
e002 n = sum (filter (even) (takeWhile (<= n) fib))
51
e002 n = sum (filter (even) (takeWhile (<= n) fib))
51
false
false
1
10
9
39
18
21
null
null
alexbiehl/hoop
hadoop-protos/src/Hadoop/Protos/DataTransferProtos/Status.hs
mit
toMaybe'Enum 5 = Prelude'.Just ERROR_ACCESS_TOKEN
49
toMaybe'Enum 5 = Prelude'.Just ERROR_ACCESS_TOKEN
49
toMaybe'Enum 5 = Prelude'.Just ERROR_ACCESS_TOKEN
49
false
false
0
6
4
14
6
8
null
null
beni55/fay
src/Fay/Convert.hs
bsd-3-clause
encodeGeneric :: GenericQ Value -> GenericQ Value encodeGeneric rec x = case constrName of '(':(dropWhile (==',') -> ")") -> Array $ Vector.fromList $ gmapQ rec x _ -> Object $ Map.fromList $ map (first Text.pack) fields where fields = ("instance", String $ Text.pack constrName) : zip labels (gmapQ rec x) constrName = showConstr constr constr = toConstr x -- Note: constrFields can throw errors for non-algebraic datatypes. These -- ought to be taken care of in the other cases of encodeFay. labels = case constrFields constr of [] -> map (("slot"++).show) [1::Int ..] ls -> ls -- | Convert a Fay json value to a Haskell value.
705
encodeGeneric :: GenericQ Value -> GenericQ Value encodeGeneric rec x = case constrName of '(':(dropWhile (==',') -> ")") -> Array $ Vector.fromList $ gmapQ rec x _ -> Object $ Map.fromList $ map (first Text.pack) fields where fields = ("instance", String $ Text.pack constrName) : zip labels (gmapQ rec x) constrName = showConstr constr constr = toConstr x -- Note: constrFields can throw errors for non-algebraic datatypes. These -- ought to be taken care of in the other cases of encodeFay. labels = case constrFields constr of [] -> map (("slot"++).show) [1::Int ..] ls -> ls -- | Convert a Fay json value to a Haskell value.
705
encodeGeneric rec x = case constrName of '(':(dropWhile (==',') -> ")") -> Array $ Vector.fromList $ gmapQ rec x _ -> Object $ Map.fromList $ map (first Text.pack) fields where fields = ("instance", String $ Text.pack constrName) : zip labels (gmapQ rec x) constrName = showConstr constr constr = toConstr x -- Note: constrFields can throw errors for non-algebraic datatypes. These -- ought to be taken care of in the other cases of encodeFay. labels = case constrFields constr of [] -> map (("slot"++).show) [1::Int ..] ls -> ls -- | Convert a Fay json value to a Haskell value.
655
false
true
0
12
182
204
105
99
null
null
omefire/lens
src/Control/Lens/Internal/Fold.hs
bsd-3-clause
getRightmost (RStep x) = getRightmost x
39
getRightmost (RStep x) = getRightmost x
39
getRightmost (RStep x) = getRightmost x
39
false
false
0
6
5
19
8
11
null
null
SuperStarPL/eqbeats
src/tools/hits.hs
bsd-3-clause
parse :: B.ByteString -> [Word32] parse s | B.length s >= 4 = let (n, r) = B.splitAt 4 s in build n : parse r
109
parse :: B.ByteString -> [Word32] parse s | B.length s >= 4 = let (n, r) = B.splitAt 4 s in build n : parse r
109
parse s | B.length s >= 4 = let (n, r) = B.splitAt 4 s in build n : parse r
75
false
true
0
11
25
73
34
39
null
null
diku-dk/futhark
src/Futhark/IR/Mem.hs
isc
checkMemInfo name (MemArray _ shape _ (ArrayIn v ixfun)) = do t <- lookupType v case t of Mem {} -> return () _ -> TC.bad $ TC.TypeError $ "Variable " ++ pretty v ++ " used as memory block, but is of type " ++ pretty t ++ "." TC.context ("in index function " ++ pretty ixfun) $ do traverse_ (TC.requirePrimExp int64 . untyped) ixfun let ixfun_rank = IxFun.rank ixfun ident_rank = shapeRank shape unless (ixfun_rank == ident_rank) $ TC.bad $ TC.TypeError $ "Arity of index function (" ++ pretty ixfun_rank ++ ") does not match rank of array " ++ pretty name ++ " (" ++ show ident_rank ++ ")"
775
checkMemInfo name (MemArray _ shape _ (ArrayIn v ixfun)) = do t <- lookupType v case t of Mem {} -> return () _ -> TC.bad $ TC.TypeError $ "Variable " ++ pretty v ++ " used as memory block, but is of type " ++ pretty t ++ "." TC.context ("in index function " ++ pretty ixfun) $ do traverse_ (TC.requirePrimExp int64 . untyped) ixfun let ixfun_rank = IxFun.rank ixfun ident_rank = shapeRank shape unless (ixfun_rank == ident_rank) $ TC.bad $ TC.TypeError $ "Arity of index function (" ++ pretty ixfun_rank ++ ") does not match rank of array " ++ pretty name ++ " (" ++ show ident_rank ++ ")"
775
checkMemInfo name (MemArray _ shape _ (ArrayIn v ixfun)) = do t <- lookupType v case t of Mem {} -> return () _ -> TC.bad $ TC.TypeError $ "Variable " ++ pretty v ++ " used as memory block, but is of type " ++ pretty t ++ "." TC.context ("in index function " ++ pretty ixfun) $ do traverse_ (TC.requirePrimExp int64 . untyped) ixfun let ixfun_rank = IxFun.rank ixfun ident_rank = shapeRank shape unless (ixfun_rank == ident_rank) $ TC.bad $ TC.TypeError $ "Arity of index function (" ++ pretty ixfun_rank ++ ") does not match rank of array " ++ pretty name ++ " (" ++ show ident_rank ++ ")"
775
false
false
0
21
296
231
106
125
null
null
facebookincubator/duckling
Duckling/Numeral/TR/Rules.hs
bsd-3-clause
ruleDozen :: Rule ruleDozen = Rule { name = "dozen" , pattern = [ regex "düzine" ] , prod = \_ -> integer 12 >>= withGrain 1 >>= withMultipliable }
163
ruleDozen :: Rule ruleDozen = Rule { name = "dozen" , pattern = [ regex "düzine" ] , prod = \_ -> integer 12 >>= withGrain 1 >>= withMultipliable }
163
ruleDozen = Rule { name = "dozen" , pattern = [ regex "düzine" ] , prod = \_ -> integer 12 >>= withGrain 1 >>= withMultipliable }
145
false
true
0
11
45
60
32
28
null
null
enolan/Idris-dev
src/Idris/Core/TT.hs
bsd-3-clause
showCG (SymRef i) = error "can't do codegen for a symbol reference"
67
showCG (SymRef i) = error "can't do codegen for a symbol reference"
67
showCG (SymRef i) = error "can't do codegen for a symbol reference"
67
false
false
0
7
11
18
8
10
null
null
StevenWInfo/haskell-soda
src/Datatypes.hs
mit
-- |Utility function linesUPart :: [[Point]] -> UrlParam linesUPart lines = "(" ++ (intercalate ", " $ map pointsUPart lines) ++ ")"
132
linesUPart :: [[Point]] -> UrlParam linesUPart lines = "(" ++ (intercalate ", " $ map pointsUPart lines) ++ ")"
111
linesUPart lines = "(" ++ (intercalate ", " $ map pointsUPart lines) ++ ")"
75
true
true
0
9
21
54
26
28
null
null
zoomhub/zoomhub
src/ZoomHub/API.hs
mit
-- API api :: Proxy API api = Proxy
35
api :: Proxy API api = Proxy
28
api = Proxy
11
true
true
0
6
8
21
9
12
null
null
facebookincubator/duckling
Duckling/Time/PL/Rules.hs
bsd-3-clause
ruleAfterDuration :: Rule ruleAfterDuration = Rule { name = "after <duration>" , pattern = [ regex "po" , dimension Duration ] , prod = \tokens -> case tokens of (_:Token Duration dd:_) -> tt . notLatent . withDirection TTime.After $ inDuration dd _ -> Nothing }
302
ruleAfterDuration :: Rule ruleAfterDuration = Rule { name = "after <duration>" , pattern = [ regex "po" , dimension Duration ] , prod = \tokens -> case tokens of (_:Token Duration dd:_) -> tt . notLatent . withDirection TTime.After $ inDuration dd _ -> Nothing }
302
ruleAfterDuration = Rule { name = "after <duration>" , pattern = [ regex "po" , dimension Duration ] , prod = \tokens -> case tokens of (_:Token Duration dd:_) -> tt . notLatent . withDirection TTime.After $ inDuration dd _ -> Nothing }
276
false
true
0
15
85
104
54
50
null
null
binesiyu/ifl
Core/CoreParse.hs
mit
pSat _ [] = []
22
pSat _ [] = []
22
pSat _ [] = []
22
false
false
0
6
12
19
8
11
null
null
sonyandy/fd
src/Data/Int/Dom/IntSet.hs
bsd-3-clause
insertGE :: Int -> Dom -> Dom insertGE x | x == maxBound = insert x | otherwise = \ (Dom t) -> Dom $ case t of Signed l r | x < 0 -> Signed (unwrap $ unsafeInsertGE x l) maxTree | otherwise -> case unsafeInsertGE x r of Semigroupoid r' -> Signed l (unsafeInsertMax maxBound r') Id -> Signed l maxTree Unsigned p m l r | x < 0 -> if p < 0 then Signed (unwrap $ unsafeInsertGE x (Unsigned p m l r)) maxTree else Signed (Min x) maxTree | otherwise -> if p < 0 then Signed (Unsigned p m l r) (unsafeSingletonGE x) else unsafeAppend (unwrap $ unsafeInsertGE x (Unsigned p m l r)) maxTree Elem x' | x < 0 -> if x' < 0 then unsafeAppend (unwrap $ unsafeInsertGE x (Elem x')) maxTree else Signed (Min x) maxTree | otherwise -> if x' < 0 then Signed (Elem x') (unsafeSingletonGE x) else unsafeInsertMax maxBound . unwrap $ unsafeInsertGE x (Elem x') Empty -> enumFrom' x
1,029
insertGE :: Int -> Dom -> Dom insertGE x | x == maxBound = insert x | otherwise = \ (Dom t) -> Dom $ case t of Signed l r | x < 0 -> Signed (unwrap $ unsafeInsertGE x l) maxTree | otherwise -> case unsafeInsertGE x r of Semigroupoid r' -> Signed l (unsafeInsertMax maxBound r') Id -> Signed l maxTree Unsigned p m l r | x < 0 -> if p < 0 then Signed (unwrap $ unsafeInsertGE x (Unsigned p m l r)) maxTree else Signed (Min x) maxTree | otherwise -> if p < 0 then Signed (Unsigned p m l r) (unsafeSingletonGE x) else unsafeAppend (unwrap $ unsafeInsertGE x (Unsigned p m l r)) maxTree Elem x' | x < 0 -> if x' < 0 then unsafeAppend (unwrap $ unsafeInsertGE x (Elem x')) maxTree else Signed (Min x) maxTree | otherwise -> if x' < 0 then Signed (Elem x') (unsafeSingletonGE x) else unsafeInsertMax maxBound . unwrap $ unsafeInsertGE x (Elem x') Empty -> enumFrom' x
1,029
insertGE x | x == maxBound = insert x | otherwise = \ (Dom t) -> Dom $ case t of Signed l r | x < 0 -> Signed (unwrap $ unsafeInsertGE x l) maxTree | otherwise -> case unsafeInsertGE x r of Semigroupoid r' -> Signed l (unsafeInsertMax maxBound r') Id -> Signed l maxTree Unsigned p m l r | x < 0 -> if p < 0 then Signed (unwrap $ unsafeInsertGE x (Unsigned p m l r)) maxTree else Signed (Min x) maxTree | otherwise -> if p < 0 then Signed (Unsigned p m l r) (unsafeSingletonGE x) else unsafeAppend (unwrap $ unsafeInsertGE x (Unsigned p m l r)) maxTree Elem x' | x < 0 -> if x' < 0 then unsafeAppend (unwrap $ unsafeInsertGE x (Elem x')) maxTree else Signed (Min x) maxTree | otherwise -> if x' < 0 then Signed (Elem x') (unsafeSingletonGE x) else unsafeInsertMax maxBound . unwrap $ unsafeInsertGE x (Elem x') Empty -> enumFrom' x
999
false
true
11
13
342
431
207
224
null
null
michaelbeaumont/pandoc
src/Text/Pandoc/Writers/Markdown.hs
gpl-2.0
blockToMarkdown opts (CodeBlock attribs str) = return $ case attribs == nullAttr of False | isEnabled Ext_backtick_code_blocks opts -> backticks <> attrs <> cr <> text str <> cr <> backticks <> blankline | isEnabled Ext_fenced_code_blocks opts -> tildes <> attrs <> cr <> text str <> cr <> tildes <> blankline _ -> nest (writerTabStop opts) (text str) <> blankline where tildes = text $ case [ln | ln <- lines str, all (=='~') ln] of [] -> "~~~~" xs -> case maximum $ map length xs of n | n < 3 -> "~~~~" | otherwise -> replicate (n+1) '~' backticks = text $ case [ln | ln <- lines str, all (=='`') ln] of [] -> "```" xs -> case maximum $ map length xs of n | n < 3 -> "```" | otherwise -> replicate (n+1) '`' attrs = if isEnabled Ext_fenced_code_attributes opts then nowrap $ " " <> attrsToMarkdown attribs else case attribs of (_,(cls:_),_) -> " " <> text cls _ -> empty
1,354
blockToMarkdown opts (CodeBlock attribs str) = return $ case attribs == nullAttr of False | isEnabled Ext_backtick_code_blocks opts -> backticks <> attrs <> cr <> text str <> cr <> backticks <> blankline | isEnabled Ext_fenced_code_blocks opts -> tildes <> attrs <> cr <> text str <> cr <> tildes <> blankline _ -> nest (writerTabStop opts) (text str) <> blankline where tildes = text $ case [ln | ln <- lines str, all (=='~') ln] of [] -> "~~~~" xs -> case maximum $ map length xs of n | n < 3 -> "~~~~" | otherwise -> replicate (n+1) '~' backticks = text $ case [ln | ln <- lines str, all (=='`') ln] of [] -> "```" xs -> case maximum $ map length xs of n | n < 3 -> "```" | otherwise -> replicate (n+1) '`' attrs = if isEnabled Ext_fenced_code_attributes opts then nowrap $ " " <> attrsToMarkdown attribs else case attribs of (_,(cls:_),_) -> " " <> text cls _ -> empty
1,354
blockToMarkdown opts (CodeBlock attribs str) = return $ case attribs == nullAttr of False | isEnabled Ext_backtick_code_blocks opts -> backticks <> attrs <> cr <> text str <> cr <> backticks <> blankline | isEnabled Ext_fenced_code_blocks opts -> tildes <> attrs <> cr <> text str <> cr <> tildes <> blankline _ -> nest (writerTabStop opts) (text str) <> blankline where tildes = text $ case [ln | ln <- lines str, all (=='~') ln] of [] -> "~~~~" xs -> case maximum $ map length xs of n | n < 3 -> "~~~~" | otherwise -> replicate (n+1) '~' backticks = text $ case [ln | ln <- lines str, all (=='`') ln] of [] -> "```" xs -> case maximum $ map length xs of n | n < 3 -> "```" | otherwise -> replicate (n+1) '`' attrs = if isEnabled Ext_fenced_code_attributes opts then nowrap $ " " <> attrsToMarkdown attribs else case attribs of (_,(cls:_),_) -> " " <> text cls _ -> empty
1,354
false
false
5
16
651
419
204
215
null
null
haslab/SecreC
src/Language/SecreC/Modules.hs
gpl-3.0
readModuleSCIHeader :: MonadIO m => FilePath -> SecrecM m (Maybe (SCIHeader,ByteString)) readModuleSCIHeader fn = do let scifn = replaceExtension fn "sci" e <- trySCI ("SecreC interface file " ++ show scifn ++ " not found") $ liftM BL.fromStrict $ BS.readFile scifn case e of Just input -> case runGetOrFail get input of Left err -> sciError ("Error loading SecreC interface file header " ++ show scifn) >> returnS Nothing Right (leftover,consumed,header) -> do returnS $ Just (header,BL.append (BL.drop consumed input) leftover) Nothing -> returnS Nothing
624
readModuleSCIHeader :: MonadIO m => FilePath -> SecrecM m (Maybe (SCIHeader,ByteString)) readModuleSCIHeader fn = do let scifn = replaceExtension fn "sci" e <- trySCI ("SecreC interface file " ++ show scifn ++ " not found") $ liftM BL.fromStrict $ BS.readFile scifn case e of Just input -> case runGetOrFail get input of Left err -> sciError ("Error loading SecreC interface file header " ++ show scifn) >> returnS Nothing Right (leftover,consumed,header) -> do returnS $ Just (header,BL.append (BL.drop consumed input) leftover) Nothing -> returnS Nothing
624
readModuleSCIHeader fn = do let scifn = replaceExtension fn "sci" e <- trySCI ("SecreC interface file " ++ show scifn ++ " not found") $ liftM BL.fromStrict $ BS.readFile scifn case e of Just input -> case runGetOrFail get input of Left err -> sciError ("Error loading SecreC interface file header " ++ show scifn) >> returnS Nothing Right (leftover,consumed,header) -> do returnS $ Just (header,BL.append (BL.drop consumed input) leftover) Nothing -> returnS Nothing
535
false
true
0
22
152
213
100
113
null
null
GaloisInc/halvm-ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
mkAppTyName = varQual tYPEABLE_INTERNAL (fsLit "mkAppTy") mkAppTyKey
85
mkAppTyName = varQual tYPEABLE_INTERNAL (fsLit "mkAppTy") mkAppTyKey
85
mkAppTyName = varQual tYPEABLE_INTERNAL (fsLit "mkAppTy") mkAppTyKey
85
false
false
1
7
23
22
9
13
null
null
mhwombat/interactive-wains
src/ALife/Creatur/Wain/Interaction/Experiment.hs
bsd-3-clause
adjustPopControlDeltaE :: [Stats.Statistic] -> StateT (U.Universe ImageWain) IO () adjustPopControlDeltaE xs = unless (null xs) $ do let (Just average) = Stats.lookup "avg. energy" xs let (Just total) = Stats.lookup "total energy" xs budget <- use U.uEnergyBudget pop <- U.popSize let c = idealPopControlDeltaE average total budget pop U.writeToLog $ "Current avg. energy = " ++ show average U.writeToLog $ "Current total energy = " ++ show total U.writeToLog $ "energy budget = " ++ show budget U.writeToLog $ "Adjusted pop. control Δe = " ++ show c zoom U.uPopControlDeltaE $ putPS c -- TODO: Make the numbers configurable
669
adjustPopControlDeltaE :: [Stats.Statistic] -> StateT (U.Universe ImageWain) IO () adjustPopControlDeltaE xs = unless (null xs) $ do let (Just average) = Stats.lookup "avg. energy" xs let (Just total) = Stats.lookup "total energy" xs budget <- use U.uEnergyBudget pop <- U.popSize let c = idealPopControlDeltaE average total budget pop U.writeToLog $ "Current avg. energy = " ++ show average U.writeToLog $ "Current total energy = " ++ show total U.writeToLog $ "energy budget = " ++ show budget U.writeToLog $ "Adjusted pop. control Δe = " ++ show c zoom U.uPopControlDeltaE $ putPS c -- TODO: Make the numbers configurable
669
adjustPopControlDeltaE xs = unless (null xs) $ do let (Just average) = Stats.lookup "avg. energy" xs let (Just total) = Stats.lookup "total energy" xs budget <- use U.uEnergyBudget pop <- U.popSize let c = idealPopControlDeltaE average total budget pop U.writeToLog $ "Current avg. energy = " ++ show average U.writeToLog $ "Current total energy = " ++ show total U.writeToLog $ "energy budget = " ++ show budget U.writeToLog $ "Adjusted pop. control Δe = " ++ show c zoom U.uPopControlDeltaE $ putPS c -- TODO: Make the numbers configurable
584
false
true
0
13
143
222
99
123
null
null