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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lykos/Sara | src/lib/Sara/Parser/Parser.hs | gpl-3.0 | doubleType :: Parser Type
doubleType = L.symbol "Double" >> return T.Double | 75 | doubleType :: Parser Type
doubleType = L.symbol "Double" >> return T.Double | 75 | doubleType = L.symbol "Double" >> return T.Double | 49 | false | true | 0 | 7 | 10 | 28 | 13 | 15 | null | null |
nevrenato/Hets_Fork | Maude/PreComorphism.hs | gpl-2.0 | -- | translates an operator declaration set into a tern as described above
translateOpDeclSet :: IdMap -> MSign.OpDeclSet -> OpTransTuple -> OpTransTuple
translateOpDeclSet im ods tpl = Set.fold (translateOpDecl im) tpl ods | 223 | translateOpDeclSet :: IdMap -> MSign.OpDeclSet -> OpTransTuple -> OpTransTuple
translateOpDeclSet im ods tpl = Set.fold (translateOpDecl im) tpl ods | 148 | translateOpDeclSet im ods tpl = Set.fold (translateOpDecl im) tpl ods | 69 | true | true | 0 | 7 | 31 | 53 | 25 | 28 | null | null |
AlephAlpha/Samau | OldSamau/Types.hs | gpl-2.0 | toList :: SmExpression -> [SmExpression]
toList (SmString xs) = map SmChar xs | 77 | toList :: SmExpression -> [SmExpression]
toList (SmString xs) = map SmChar xs | 77 | toList (SmString xs) = map SmChar xs | 36 | false | true | 0 | 6 | 11 | 36 | 17 | 19 | null | null |
creichert/wai | wai-extra/Network/Wai/Test.hs | mit | -- |
--
-- Since 3.0.6
setClientCookie :: Cookie.SetCookie -> Session ()
setClientCookie c =
modifyClientCookies
(Map.insert (Cookie.setCookieName c) c) | 158 | setClientCookie :: Cookie.SetCookie -> Session ()
setClientCookie c =
modifyClientCookies
(Map.insert (Cookie.setCookieName c) c) | 135 | setClientCookie c =
modifyClientCookies
(Map.insert (Cookie.setCookieName c) c) | 85 | true | true | 0 | 10 | 25 | 49 | 25 | 24 | null | null |
snapframework/heist | src/Heist/Internal/Types.hs | bsd-3-clause | ------------------------------------------------------------------------------
-- | My lens creation function to avoid a dependency on lens.
lens :: Functor f => (t1 -> t) -> (t1 -> a -> b) -> (t -> f a) -> t1 -> f b
lens sa sbt afb s = sbt s <$> afb (sa s) | 257 | lens :: Functor f => (t1 -> t) -> (t1 -> a -> b) -> (t -> f a) -> t1 -> f b
lens sa sbt afb s = sbt s <$> afb (sa s) | 116 | lens sa sbt afb s = sbt s <$> afb (sa s) | 40 | true | true | 2 | 12 | 48 | 97 | 47 | 50 | null | null |
bjornbm/network | Network.hs | bsd-3-clause | accept (MkSocket _ family _ _ _) =
error $ "Sorry, address family " ++ (show family) ++ " is not supported!" | 110 | accept (MkSocket _ family _ _ _) =
error $ "Sorry, address family " ++ (show family) ++ " is not supported!" | 110 | accept (MkSocket _ family _ _ _) =
error $ "Sorry, address family " ++ (show family) ++ " is not supported!" | 110 | false | false | 0 | 8 | 23 | 41 | 20 | 21 | null | null |
sjpet/quark | src/Quark/Colors.hs | mit | treeActivePair' = (black, selectionColor') | 43 | treeActivePair' = (black, selectionColor') | 43 | treeActivePair' = (black, selectionColor') | 43 | false | false | 1 | 5 | 4 | 15 | 7 | 8 | null | null |
olsner/ghc | compiler/deSugar/DsUtils.hs | bsd-3-clause | mkErrorAppDs :: Id -- The error function
-> Type -- Type to which it should be applied
-> SDoc -- The error message string to pass
-> DsM CoreExpr
mkErrorAppDs err_id ty msg = do
src_loc <- getSrcSpanDs
dflags <- getDynFlags
let
full_msg = showSDoc dflags (hcat [ppr src_loc, vbar, msg])
core_msg = Lit (mkMachString full_msg)
-- mkMachString returns a result of type String#
return (mkApps (Var err_id) [Type (getRuntimeRep "mkErrorAppDs" ty), Type ty, core_msg])
{-
'mkCoreAppDs' and 'mkCoreAppsDs' hand the special-case desugaring of 'seq'.
Note [Desugaring seq (1)] cf Trac #1031
~~~~~~~~~~~~~~~~~~~~~~~~~
f x y = x `seq` (y `seq` (# x,y #))
The [CoreSyn let/app invariant] means that, other things being equal, because
the argument to the outer 'seq' has an unlifted type, we'll use call-by-value thus:
f x y = case (y `seq` (# x,y #)) of v -> x `seq` v
But that is bad for two reasons:
(a) we now evaluate y before x, and
(b) we can't bind v to an unboxed pair
Seq is very, very special! So we recognise it right here, and desugar to
case x of _ -> case y of _ -> (# x,y #)
Note [Desugaring seq (2)] cf Trac #2273
~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
let chp = case b of { True -> fst x; False -> 0 }
in chp `seq` ...chp...
Here the seq is designed to plug the space leak of retaining (snd x)
for too long.
If we rely on the ordinary inlining of seq, we'll get
let chp = case b of { True -> fst x; False -> 0 }
case chp of _ { I# -> ...chp... }
But since chp is cheap, and the case is an alluring contet, we'll
inline chp into the case scrutinee. Now there is only one use of chp,
so we'll inline a second copy. Alas, we've now ruined the purpose of
the seq, by re-introducing the space leak:
case (case b of {True -> fst x; False -> 0}) of
I# _ -> ...case b of {True -> fst x; False -> 0}...
We can try to avoid doing this by ensuring that the binder-swap in the
case happens, so we get his at an early stage:
case chp of chp2 { I# -> ...chp2... }
But this is fragile. The real culprit is the source program. Perhaps we
should have said explicitly
let !chp2 = chp in ...chp2...
But that's painful. So the code here does a little hack to make seq
more robust: a saturated application of 'seq' is turned *directly* into
the case expression, thus:
x `seq` e2 ==> case x of x -> e2 -- Note shadowing!
e1 `seq` e2 ==> case x of _ -> e2
So we desugar our example to:
let chp = case b of { True -> fst x; False -> 0 }
case chp of chp { I# -> ...chp... }
And now all is well.
The reason it's a hack is because if you define mySeq=seq, the hack
won't work on mySeq.
Note [Desugaring seq (3)] cf Trac #2409
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The isLocalId ensures that we don't turn
True `seq` e
into
case True of True { ... }
which stupidly tries to bind the datacon 'True'.
-} | 2,993 | mkErrorAppDs :: Id -- The error function
-> Type -- Type to which it should be applied
-> SDoc -- The error message string to pass
-> DsM CoreExpr
mkErrorAppDs err_id ty msg = do
src_loc <- getSrcSpanDs
dflags <- getDynFlags
let
full_msg = showSDoc dflags (hcat [ppr src_loc, vbar, msg])
core_msg = Lit (mkMachString full_msg)
-- mkMachString returns a result of type String#
return (mkApps (Var err_id) [Type (getRuntimeRep "mkErrorAppDs" ty), Type ty, core_msg])
{-
'mkCoreAppDs' and 'mkCoreAppsDs' hand the special-case desugaring of 'seq'.
Note [Desugaring seq (1)] cf Trac #1031
~~~~~~~~~~~~~~~~~~~~~~~~~
f x y = x `seq` (y `seq` (# x,y #))
The [CoreSyn let/app invariant] means that, other things being equal, because
the argument to the outer 'seq' has an unlifted type, we'll use call-by-value thus:
f x y = case (y `seq` (# x,y #)) of v -> x `seq` v
But that is bad for two reasons:
(a) we now evaluate y before x, and
(b) we can't bind v to an unboxed pair
Seq is very, very special! So we recognise it right here, and desugar to
case x of _ -> case y of _ -> (# x,y #)
Note [Desugaring seq (2)] cf Trac #2273
~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
let chp = case b of { True -> fst x; False -> 0 }
in chp `seq` ...chp...
Here the seq is designed to plug the space leak of retaining (snd x)
for too long.
If we rely on the ordinary inlining of seq, we'll get
let chp = case b of { True -> fst x; False -> 0 }
case chp of _ { I# -> ...chp... }
But since chp is cheap, and the case is an alluring contet, we'll
inline chp into the case scrutinee. Now there is only one use of chp,
so we'll inline a second copy. Alas, we've now ruined the purpose of
the seq, by re-introducing the space leak:
case (case b of {True -> fst x; False -> 0}) of
I# _ -> ...case b of {True -> fst x; False -> 0}...
We can try to avoid doing this by ensuring that the binder-swap in the
case happens, so we get his at an early stage:
case chp of chp2 { I# -> ...chp2... }
But this is fragile. The real culprit is the source program. Perhaps we
should have said explicitly
let !chp2 = chp in ...chp2...
But that's painful. So the code here does a little hack to make seq
more robust: a saturated application of 'seq' is turned *directly* into
the case expression, thus:
x `seq` e2 ==> case x of x -> e2 -- Note shadowing!
e1 `seq` e2 ==> case x of _ -> e2
So we desugar our example to:
let chp = case b of { True -> fst x; False -> 0 }
case chp of chp { I# -> ...chp... }
And now all is well.
The reason it's a hack is because if you define mySeq=seq, the hack
won't work on mySeq.
Note [Desugaring seq (3)] cf Trac #2409
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The isLocalId ensures that we don't turn
True `seq` e
into
case True of True { ... }
which stupidly tries to bind the datacon 'True'.
-} | 2,992 | mkErrorAppDs err_id ty msg = do
src_loc <- getSrcSpanDs
dflags <- getDynFlags
let
full_msg = showSDoc dflags (hcat [ppr src_loc, vbar, msg])
core_msg = Lit (mkMachString full_msg)
-- mkMachString returns a result of type String#
return (mkApps (Var err_id) [Type (getRuntimeRep "mkErrorAppDs" ty), Type ty, core_msg])
{-
'mkCoreAppDs' and 'mkCoreAppsDs' hand the special-case desugaring of 'seq'.
Note [Desugaring seq (1)] cf Trac #1031
~~~~~~~~~~~~~~~~~~~~~~~~~
f x y = x `seq` (y `seq` (# x,y #))
The [CoreSyn let/app invariant] means that, other things being equal, because
the argument to the outer 'seq' has an unlifted type, we'll use call-by-value thus:
f x y = case (y `seq` (# x,y #)) of v -> x `seq` v
But that is bad for two reasons:
(a) we now evaluate y before x, and
(b) we can't bind v to an unboxed pair
Seq is very, very special! So we recognise it right here, and desugar to
case x of _ -> case y of _ -> (# x,y #)
Note [Desugaring seq (2)] cf Trac #2273
~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
let chp = case b of { True -> fst x; False -> 0 }
in chp `seq` ...chp...
Here the seq is designed to plug the space leak of retaining (snd x)
for too long.
If we rely on the ordinary inlining of seq, we'll get
let chp = case b of { True -> fst x; False -> 0 }
case chp of _ { I# -> ...chp... }
But since chp is cheap, and the case is an alluring contet, we'll
inline chp into the case scrutinee. Now there is only one use of chp,
so we'll inline a second copy. Alas, we've now ruined the purpose of
the seq, by re-introducing the space leak:
case (case b of {True -> fst x; False -> 0}) of
I# _ -> ...case b of {True -> fst x; False -> 0}...
We can try to avoid doing this by ensuring that the binder-swap in the
case happens, so we get his at an early stage:
case chp of chp2 { I# -> ...chp2... }
But this is fragile. The real culprit is the source program. Perhaps we
should have said explicitly
let !chp2 = chp in ...chp2...
But that's painful. So the code here does a little hack to make seq
more robust: a saturated application of 'seq' is turned *directly* into
the case expression, thus:
x `seq` e2 ==> case x of x -> e2 -- Note shadowing!
e1 `seq` e2 ==> case x of _ -> e2
So we desugar our example to:
let chp = case b of { True -> fst x; False -> 0 }
case chp of chp { I# -> ...chp... }
And now all is well.
The reason it's a hack is because if you define mySeq=seq, the hack
won't work on mySeq.
Note [Desugaring seq (3)] cf Trac #2409
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The isLocalId ensures that we don't turn
True `seq` e
into
case True of True { ... }
which stupidly tries to bind the datacon 'True'.
-} | 2,771 | false | true | 0 | 14 | 757 | 141 | 71 | 70 | null | null |
JoeyEremondi/elm-summer-opt | src/Generate/JavaScript.hs | bsd-3-clause | definition :: Canonical.Def -> State Int [Statement ()]
definition (Canonical.Definition annPattern expr@(A.A region _) _) =
do expr' <- expression expr
let assign x = varDecl x expr'
let (A.A patternRegion pattern) = annPattern
case pattern of
P.Var x
| Help.isOp x ->
let op = LBracket () (ref "_op") (string x) in
return [ ExprStmt () $ AssignExpr () OpAssign op expr' ]
| otherwise ->
return [ VarDeclStmt () [ assign (Var.varName x) ] ]
P.Record fields ->
let setField f = varDecl f (obj ["$",f]) in
return [ VarDeclStmt () (assign "$" : map setField fields) ]
P.Data (Var.Canonical _ name) patterns | vars /= Nothing ->
return [ VarDeclStmt () (setup (zipWith decl (maybe [] id vars) [0..])) ]
where
vars = getVars patterns
getVars patterns =
case patterns of
A.A _ (P.Var x) : rest ->
(Var.varName x :) `fmap` getVars rest
[] ->
Just []
_ ->
Nothing
decl x n = varDecl x (obj ["$","_" ++ show n])
setup vars
| Help.isTuple name = assign "$" : vars
| otherwise = assign "_raw" : safeAssign : vars
safeAssign = varDecl "$" (CondExpr () if' (ref "_raw") exception)
if' = InfixExpr () OpStrictEq (obj ["_raw","ctor"]) (string name)
exception = Help.throw "badCase" region
_ ->
do defs' <- concat <$> mapM toDef vars
return (VarDeclStmt () [assign "_"] : defs')
where
vars = P.boundVarList annPattern
mkVar = A.A region . localVar
toDef y =
let expr = A.A region $ Case (mkVar "_") [(annPattern, mkVar y)]
pat = A.A patternRegion (P.Var y)
in
definition (Canonical.Definition pat expr Nothing) | 2,079 | definition :: Canonical.Def -> State Int [Statement ()]
definition (Canonical.Definition annPattern expr@(A.A region _) _) =
do expr' <- expression expr
let assign x = varDecl x expr'
let (A.A patternRegion pattern) = annPattern
case pattern of
P.Var x
| Help.isOp x ->
let op = LBracket () (ref "_op") (string x) in
return [ ExprStmt () $ AssignExpr () OpAssign op expr' ]
| otherwise ->
return [ VarDeclStmt () [ assign (Var.varName x) ] ]
P.Record fields ->
let setField f = varDecl f (obj ["$",f]) in
return [ VarDeclStmt () (assign "$" : map setField fields) ]
P.Data (Var.Canonical _ name) patterns | vars /= Nothing ->
return [ VarDeclStmt () (setup (zipWith decl (maybe [] id vars) [0..])) ]
where
vars = getVars patterns
getVars patterns =
case patterns of
A.A _ (P.Var x) : rest ->
(Var.varName x :) `fmap` getVars rest
[] ->
Just []
_ ->
Nothing
decl x n = varDecl x (obj ["$","_" ++ show n])
setup vars
| Help.isTuple name = assign "$" : vars
| otherwise = assign "_raw" : safeAssign : vars
safeAssign = varDecl "$" (CondExpr () if' (ref "_raw") exception)
if' = InfixExpr () OpStrictEq (obj ["_raw","ctor"]) (string name)
exception = Help.throw "badCase" region
_ ->
do defs' <- concat <$> mapM toDef vars
return (VarDeclStmt () [assign "_"] : defs')
where
vars = P.boundVarList annPattern
mkVar = A.A region . localVar
toDef y =
let expr = A.A region $ Case (mkVar "_") [(annPattern, mkVar y)]
pat = A.A patternRegion (P.Var y)
in
definition (Canonical.Definition pat expr Nothing) | 2,079 | definition (Canonical.Definition annPattern expr@(A.A region _) _) =
do expr' <- expression expr
let assign x = varDecl x expr'
let (A.A patternRegion pattern) = annPattern
case pattern of
P.Var x
| Help.isOp x ->
let op = LBracket () (ref "_op") (string x) in
return [ ExprStmt () $ AssignExpr () OpAssign op expr' ]
| otherwise ->
return [ VarDeclStmt () [ assign (Var.varName x) ] ]
P.Record fields ->
let setField f = varDecl f (obj ["$",f]) in
return [ VarDeclStmt () (assign "$" : map setField fields) ]
P.Data (Var.Canonical _ name) patterns | vars /= Nothing ->
return [ VarDeclStmt () (setup (zipWith decl (maybe [] id vars) [0..])) ]
where
vars = getVars patterns
getVars patterns =
case patterns of
A.A _ (P.Var x) : rest ->
(Var.varName x :) `fmap` getVars rest
[] ->
Just []
_ ->
Nothing
decl x n = varDecl x (obj ["$","_" ++ show n])
setup vars
| Help.isTuple name = assign "$" : vars
| otherwise = assign "_raw" : safeAssign : vars
safeAssign = varDecl "$" (CondExpr () if' (ref "_raw") exception)
if' = InfixExpr () OpStrictEq (obj ["_raw","ctor"]) (string name)
exception = Help.throw "badCase" region
_ ->
do defs' <- concat <$> mapM toDef vars
return (VarDeclStmt () [assign "_"] : defs')
where
vars = P.boundVarList annPattern
mkVar = A.A region . localVar
toDef y =
let expr = A.A region $ Case (mkVar "_") [(annPattern, mkVar y)]
pat = A.A patternRegion (P.Var y)
in
definition (Canonical.Definition pat expr Nothing) | 2,023 | false | true | 0 | 20 | 846 | 775 | 370 | 405 | null | null |
soenkehahn/wai | warp/Network/Wai/Handler/Warp/HTTP2/Types.hs | mit | ----------------------------------------------------------------
newContext :: IO Context
newContext = Context <$> newIORef defaultSettings
<*> initialize 10 -- fixme: hard coding: 10
<*> newIORef 0
<*> newIORef 0
<*> newIORef Nothing
<*> newIORef 0
<*> newIORef 2 -- first server push stream; 0 is reserved
<*> newTQueueIO
<*> newPriorityTree
<*> (newDynamicTableForEncoding defaultDynamicTableSize >>= newIORef)
<*> (newDynamicTableForDecoding defaultDynamicTableSize >>= newIORef)
<*> newTVarIO defaultInitialWindowSize | 754 | newContext :: IO Context
newContext = Context <$> newIORef defaultSettings
<*> initialize 10 -- fixme: hard coding: 10
<*> newIORef 0
<*> newIORef 0
<*> newIORef Nothing
<*> newIORef 0
<*> newIORef 2 -- first server push stream; 0 is reserved
<*> newTQueueIO
<*> newPriorityTree
<*> (newDynamicTableForEncoding defaultDynamicTableSize >>= newIORef)
<*> (newDynamicTableForDecoding defaultDynamicTableSize >>= newIORef)
<*> newTVarIO defaultInitialWindowSize | 688 | newContext = Context <$> newIORef defaultSettings
<*> initialize 10 -- fixme: hard coding: 10
<*> newIORef 0
<*> newIORef 0
<*> newIORef Nothing
<*> newIORef 0
<*> newIORef 2 -- first server push stream; 0 is reserved
<*> newTQueueIO
<*> newPriorityTree
<*> (newDynamicTableForEncoding defaultDynamicTableSize >>= newIORef)
<*> (newDynamicTableForDecoding defaultDynamicTableSize >>= newIORef)
<*> newTVarIO defaultInitialWindowSize | 663 | true | true | 35 | 7 | 290 | 148 | 75 | 73 | null | null |
mstksg/auto | src/Control/Auto/Collection.hs | mit | -- | Takes a bunch of 'Auto's that take streams streams, and turns them
-- into one 'Auto' that takes a bunch of blip streams and feeds them into
-- each of the original 'Auto's, in order.
--
-- It's basically like 'zipAuto', except instead of taking in normal
-- streams of values, it takes in blip streams of values.
--
-- If the input streams ever number less than the number of 'Auto's zipped,
-- the other 'Auto's are stepped assuming no emitted value.
zipAutoB :: Monad m
=> [Auto m (Blip a) b] -- ^ 'Auto's to zip up
-> Auto m [Blip a] [b]
zipAutoB = zipAuto NoBlip | 592 | zipAutoB :: Monad m
=> [Auto m (Blip a) b] -- ^ 'Auto's to zip up
-> Auto m [Blip a] [b]
zipAutoB = zipAuto NoBlip | 134 | zipAutoB = zipAuto NoBlip | 25 | true | true | 0 | 10 | 130 | 67 | 38 | 29 | null | null |
remysucre/ProbMonad | dist/build/autogen/Paths_ProbMonad.hs | bsd-3-clause | getDataDir = catchIO (getEnv "ProbMonad_datadir") (\_ -> return datadir) | 72 | getDataDir = catchIO (getEnv "ProbMonad_datadir") (\_ -> return datadir) | 72 | getDataDir = catchIO (getEnv "ProbMonad_datadir") (\_ -> return datadir) | 72 | false | false | 0 | 8 | 8 | 28 | 14 | 14 | null | null |
piccolo-lang/piccolo | src/Core/Environments.hs | gpl-3.0 | envExpr e@EPrim {} = do
args <- mapM envExpr $ exprArgs e
return $ e { exprArgs = args } | 93 | envExpr e@EPrim {} = do
args <- mapM envExpr $ exprArgs e
return $ e { exprArgs = args } | 93 | envExpr e@EPrim {} = do
args <- mapM envExpr $ exprArgs e
return $ e { exprArgs = args } | 93 | false | false | 0 | 9 | 24 | 48 | 23 | 25 | null | null |
meiersi/scyther-proof | src/Scyther/Facts.hs | gpl-3.0 | -- | Check if a set of facts is trivially contradictory.
--
-- NOTE: This is not the same as trying to prove the atom AFalse under these
-- premises. The checks are separated due to efficiency reasons.
proveFalse :: Facts -> Bool
proveFalse prems =
not (S.null (failedEqs prems)) ||
not (S.null (compromised prems `S.intersection` uncompromised prems)) ||
any noAgent (S.toList (compromised prems)) ||
cyclic (eventOrd prems) ||
any falseIneq (S.toList (inequalities prems))
where
noAgent (MMVar _) = False
noAgent (MAVar _) = False
noAgent (MArbMsg _) = False
noAgent _ = True
-- | True iff the facts imply the validity of the given atom. Note that this check
-- is incomplete; i.e. there may be atoms that would be true under these facts,
-- but are not detected as such.
--
-- PRE: Trivial learn events must be split. You may achieve this using
-- 'removeTrivialFacts'. | 922 | proveFalse :: Facts -> Bool
proveFalse prems =
not (S.null (failedEqs prems)) ||
not (S.null (compromised prems `S.intersection` uncompromised prems)) ||
any noAgent (S.toList (compromised prems)) ||
cyclic (eventOrd prems) ||
any falseIneq (S.toList (inequalities prems))
where
noAgent (MMVar _) = False
noAgent (MAVar _) = False
noAgent (MArbMsg _) = False
noAgent _ = True
-- | True iff the facts imply the validity of the given atom. Note that this check
-- is incomplete; i.e. there may be atoms that would be true under these facts,
-- but are not detected as such.
--
-- PRE: Trivial learn events must be split. You may achieve this using
-- 'removeTrivialFacts'. | 720 | proveFalse prems =
not (S.null (failedEqs prems)) ||
not (S.null (compromised prems `S.intersection` uncompromised prems)) ||
any noAgent (S.toList (compromised prems)) ||
cyclic (eventOrd prems) ||
any falseIneq (S.toList (inequalities prems))
where
noAgent (MMVar _) = False
noAgent (MAVar _) = False
noAgent (MArbMsg _) = False
noAgent _ = True
-- | True iff the facts imply the validity of the given atom. Note that this check
-- is incomplete; i.e. there may be atoms that would be true under these facts,
-- but are not detected as such.
--
-- PRE: Trivial learn events must be split. You may achieve this using
-- 'removeTrivialFacts'. | 692 | true | true | 7 | 10 | 198 | 192 | 98 | 94 | null | null |
hesiod/OpenGL | src/Graphics/Rendering/OpenGL/GL/VertexArrays.hs | bsd-3-clause | getEdgeFlagPointer :: IO (VertexArrayDescriptor a)
getEdgeFlagPointer = do
s <- getInteger1 fromIntegral GetEdgeFlagArrayStride
p <- getPointer EdgeFlagArrayPointer
return $ VertexArrayDescriptor 1 UnsignedByte s p | 223 | getEdgeFlagPointer :: IO (VertexArrayDescriptor a)
getEdgeFlagPointer = do
s <- getInteger1 fromIntegral GetEdgeFlagArrayStride
p <- getPointer EdgeFlagArrayPointer
return $ VertexArrayDescriptor 1 UnsignedByte s p | 223 | getEdgeFlagPointer = do
s <- getInteger1 fromIntegral GetEdgeFlagArrayStride
p <- getPointer EdgeFlagArrayPointer
return $ VertexArrayDescriptor 1 UnsignedByte s p | 172 | false | true | 0 | 9 | 32 | 64 | 27 | 37 | null | null |
ksaveljev/vindinium-bot | Faorien/Utils.hs | mit | tileAt :: Board -> Pos -> Maybe Tile
tileAt b p@(Pos x y) =
if inBoard b p
then Just $ (b^.boardTiles) !! idx
else Nothing
where
idx = x * b^.boardSize + y
{-
isMineTileAt :: Board -> Pos -> Bool
isMineTileAt board pos =
case tileAt board pos of
Just (MineTile _) -> True
_ -> False
-} | 334 | tileAt :: Board -> Pos -> Maybe Tile
tileAt b p@(Pos x y) =
if inBoard b p
then Just $ (b^.boardTiles) !! idx
else Nothing
where
idx = x * b^.boardSize + y
{-
isMineTileAt :: Board -> Pos -> Bool
isMineTileAt board pos =
case tileAt board pos of
Just (MineTile _) -> True
_ -> False
-} | 334 | tileAt b p@(Pos x y) =
if inBoard b p
then Just $ (b^.boardTiles) !! idx
else Nothing
where
idx = x * b^.boardSize + y
{-
isMineTileAt :: Board -> Pos -> Bool
isMineTileAt board pos =
case tileAt board pos of
Just (MineTile _) -> True
_ -> False
-} | 297 | false | true | 0 | 9 | 108 | 87 | 45 | 42 | null | null |
urbanslug/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | divIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divInteger") divIntegerIdKey | 92 | divIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divInteger") divIntegerIdKey | 92 | divIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divInteger") divIntegerIdKey | 92 | false | false | 0 | 7 | 20 | 19 | 9 | 10 | null | null |
randen/cabal | cabal-install/Distribution/Client/Sandbox/PackageEnvironment.hs | bsd-3-clause | -- | These are the absolute basic defaults, the fields that must be
-- initialised. When we load the package environment from the file we layer the
-- loaded values over these ones.
basePackageEnvironment :: PackageEnvironment
basePackageEnvironment =
mempty {
pkgEnvSavedConfig = mempty {
savedConfigureFlags = mempty {
configHcFlavor = toFlag defaultCompiler,
configVerbosity = toFlag normal
}
}
} | 474 | basePackageEnvironment :: PackageEnvironment
basePackageEnvironment =
mempty {
pkgEnvSavedConfig = mempty {
savedConfigureFlags = mempty {
configHcFlavor = toFlag defaultCompiler,
configVerbosity = toFlag normal
}
}
} | 292 | basePackageEnvironment =
mempty {
pkgEnvSavedConfig = mempty {
savedConfigureFlags = mempty {
configHcFlavor = toFlag defaultCompiler,
configVerbosity = toFlag normal
}
}
} | 247 | true | true | 0 | 11 | 133 | 50 | 30 | 20 | null | null |
mbakke/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | exportConfFile :: String
exportConfFile = "config.ini" | 54 | exportConfFile :: String
exportConfFile = "config.ini" | 54 | exportConfFile = "config.ini" | 29 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
tdox/elevators | Elevators/Logic.hs | gpl-3.0 | elDir (MkElevator _ cf gs) = direction cf $ goalFloor $ head gs | 63 | elDir (MkElevator _ cf gs) = direction cf $ goalFloor $ head gs | 63 | elDir (MkElevator _ cf gs) = direction cf $ goalFloor $ head gs | 63 | false | false | 0 | 7 | 12 | 33 | 15 | 18 | null | null |
linotsuki/bisu | dist/build/autogen/Paths_bisu.hs | lgpl-3.0 | prefix, bindirrel :: FilePath
prefix = "C:\\Users\\Lino\\AppData\\Roaming\\cabal" | 88 | prefix, bindirrel :: FilePath
prefix = "C:\\Users\\Lino\\AppData\\Roaming\\cabal" | 88 | prefix = "C:\\Users\\Lino\\AppData\\Roaming\\cabal" | 58 | false | true | 0 | 4 | 13 | 13 | 8 | 5 | null | null |
oldmanmike/ghc | compiler/cmm/PprC.hs | bsd-3-clause | te_Expr (CmmMachOp _ es) = mapM_ te_Expr es | 50 | te_Expr (CmmMachOp _ es) = mapM_ te_Expr es | 50 | te_Expr (CmmMachOp _ es) = mapM_ te_Expr es | 50 | false | false | 0 | 7 | 14 | 22 | 10 | 12 | null | null |
pasberth/paradocs | test/ReadInstructionSpec.hs | mit | main :: IO ()
main = hspec $ do
describe "%read" $ do
let storage = HashMap.fromList [
("a.pd", "content")
]
let rendered = runHashMapStorage (renderString "%read a.pd") storage
it "reads the content of a.pd" $ do
renderedToString rendered `shouldBe` "content" | 324 | main :: IO ()
main = hspec $ do
describe "%read" $ do
let storage = HashMap.fromList [
("a.pd", "content")
]
let rendered = runHashMapStorage (renderString "%read a.pd") storage
it "reads the content of a.pd" $ do
renderedToString rendered `shouldBe` "content" | 324 | main = hspec $ do
describe "%read" $ do
let storage = HashMap.fromList [
("a.pd", "content")
]
let rendered = runHashMapStorage (renderString "%read a.pd") storage
it "reads the content of a.pd" $ do
renderedToString rendered `shouldBe` "content" | 310 | false | true | 2 | 15 | 104 | 102 | 46 | 56 | null | null |
seereason/HJScript | src/HJScript/DOM/Window.hs | bsd-3-clause | -- Window properties
closed :: Exp Window -> JBool
closed = deref "closed" | 75 | closed :: Exp Window -> JBool
closed = deref "closed" | 53 | closed = deref "closed" | 23 | true | true | 0 | 6 | 13 | 22 | 11 | 11 | null | null |
mstksg/hledger | bin/hledger-check.hs | gpl-3.0 | valuep :: Monad m => H.JournalParser m Value
-- Account name parser has to come last because they eat everything.
valuep = valueamountp <|> valueaccountnestedp <|> valueaccountp where
valueamountp = Amount <$> H.amountp
valueaccountp = Account <$> lift H.accountnamep
valueaccountnestedp = AccountNested <$> (P.char '*' *> spaces *> lift H.accountnamep)
spaces = void . many $ P.char ' ' | 405 | valuep :: Monad m => H.JournalParser m Value
valuep = valueamountp <|> valueaccountnestedp <|> valueaccountp where
valueamountp = Amount <$> H.amountp
valueaccountp = Account <$> lift H.accountnamep
valueaccountnestedp = AccountNested <$> (P.char '*' *> spaces *> lift H.accountnamep)
spaces = void . many $ P.char ' ' | 336 | valuep = valueamountp <|> valueaccountnestedp <|> valueaccountp where
valueamountp = Amount <$> H.amountp
valueaccountp = Account <$> lift H.accountnamep
valueaccountnestedp = AccountNested <$> (P.char '*' *> spaces *> lift H.accountnamep)
spaces = void . many $ P.char ' ' | 291 | true | true | 0 | 10 | 76 | 108 | 55 | 53 | null | null |
begriffs/hasql-postgres | library/Hasql/Postgres/ErrorCode.hs | mit | duplicate_schema :: ErrorCode = "42P06" | 75 | duplicate_schema :: ErrorCode = "42P06" | 75 | duplicate_schema :: ErrorCode = "42P06" | 75 | false | false | 0 | 5 | 40 | 11 | 5 | 6 | null | null |
qmuli/qmuli | library/Qi/Config/Render/S3.hs | mit | toResources
:: Config
-> Resources
toResources config = Resources $ toResource <$> buckets
where
buckets = filter (\s3b -> s3b ^. s3bProfile . s3bpExistence /= AlreadyExists) $ getAll config
toResource bucket@S3Bucket{_s3bEventConfigs} = (
S.resource (unLogicalName lname) $
S3BucketProperties $ S.s3Bucket
& S.sbBucketName ?~ Literal (unPhysicalName bucketName)
& S.sbAccessControl ?~ Literal PublicReadWrite
& S.sbNotificationConfiguration ?~ lbdConfigs
)
& S.resourceDependsOn ?~ reqs
where
lname = getLogicalName config bucket
bucketName = getPhysicalName config bucket
eventConfigs = bucket ^. s3bEventConfigs
reqs = concat $
(\lec ->
let
lbd = getById config (lec ^. lbdId)
in
[ unLogicalName $ L.getPermissionLogicalName config lbd
, unLogicalName $ getLogicalName config lbd
]
) <$> eventConfigs
lbdConfigs = S.s3BucketNotificationConfiguration
& S.sbncLambdaConfigurations ?~ map lbdConfig eventConfigs
lbdConfig s3EventConfig =
S.s3BucketLambdaConfiguration
(Literal . show $ s3EventConfig ^. event)
(GetAtt (unLogicalName . getLogicalNameFromId config $ s3EventConfig ^. lbdId) "Arn") | 1,366 | toResources
:: Config
-> Resources
toResources config = Resources $ toResource <$> buckets
where
buckets = filter (\s3b -> s3b ^. s3bProfile . s3bpExistence /= AlreadyExists) $ getAll config
toResource bucket@S3Bucket{_s3bEventConfigs} = (
S.resource (unLogicalName lname) $
S3BucketProperties $ S.s3Bucket
& S.sbBucketName ?~ Literal (unPhysicalName bucketName)
& S.sbAccessControl ?~ Literal PublicReadWrite
& S.sbNotificationConfiguration ?~ lbdConfigs
)
& S.resourceDependsOn ?~ reqs
where
lname = getLogicalName config bucket
bucketName = getPhysicalName config bucket
eventConfigs = bucket ^. s3bEventConfigs
reqs = concat $
(\lec ->
let
lbd = getById config (lec ^. lbdId)
in
[ unLogicalName $ L.getPermissionLogicalName config lbd
, unLogicalName $ getLogicalName config lbd
]
) <$> eventConfigs
lbdConfigs = S.s3BucketNotificationConfiguration
& S.sbncLambdaConfigurations ?~ map lbdConfig eventConfigs
lbdConfig s3EventConfig =
S.s3BucketLambdaConfiguration
(Literal . show $ s3EventConfig ^. event)
(GetAtt (unLogicalName . getLogicalNameFromId config $ s3EventConfig ^. lbdId) "Arn") | 1,366 | toResources config = Resources $ toResource <$> buckets
where
buckets = filter (\s3b -> s3b ^. s3bProfile . s3bpExistence /= AlreadyExists) $ getAll config
toResource bucket@S3Bucket{_s3bEventConfigs} = (
S.resource (unLogicalName lname) $
S3BucketProperties $ S.s3Bucket
& S.sbBucketName ?~ Literal (unPhysicalName bucketName)
& S.sbAccessControl ?~ Literal PublicReadWrite
& S.sbNotificationConfiguration ?~ lbdConfigs
)
& S.resourceDependsOn ?~ reqs
where
lname = getLogicalName config bucket
bucketName = getPhysicalName config bucket
eventConfigs = bucket ^. s3bEventConfigs
reqs = concat $
(\lec ->
let
lbd = getById config (lec ^. lbdId)
in
[ unLogicalName $ L.getPermissionLogicalName config lbd
, unLogicalName $ getLogicalName config lbd
]
) <$> eventConfigs
lbdConfigs = S.s3BucketNotificationConfiguration
& S.sbncLambdaConfigurations ?~ map lbdConfig eventConfigs
lbdConfig s3EventConfig =
S.s3BucketLambdaConfiguration
(Literal . show $ s3EventConfig ^. event)
(GetAtt (unLogicalName . getLogicalNameFromId config $ s3EventConfig ^. lbdId) "Arn") | 1,327 | false | true | 1 | 20 | 407 | 341 | 170 | 171 | null | null |
anton-dessiatov/stack | subs/rio/src/RIO/Logger.hs | bsd-3-clause | logError
:: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack)
=> LogStr
-> m ()
logError = logGeneric "" LevelError | 132 | logError
:: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack)
=> LogStr
-> m ()
logError = logGeneric "" LevelError | 132 | logError = logGeneric "" LevelError | 35 | false | true | 0 | 9 | 25 | 57 | 27 | 30 | null | null |
frantisekfarka/ghc-dsi | compiler/main/GhcMake.hs | bsd-3-clause | reportImportErrors :: MonadIO m => [Either ErrMsg b] -> m [b]
reportImportErrors xs | null errs = return oks
| otherwise = throwManyErrors errs
where (errs, oks) = partitionEithers xs | 207 | reportImportErrors :: MonadIO m => [Either ErrMsg b] -> m [b]
reportImportErrors xs | null errs = return oks
| otherwise = throwManyErrors errs
where (errs, oks) = partitionEithers xs | 207 | reportImportErrors xs | null errs = return oks
| otherwise = throwManyErrors errs
where (errs, oks) = partitionEithers xs | 145 | false | true | 0 | 8 | 53 | 80 | 37 | 43 | null | null |
brendanhay/gogol | gogol-android-enterprise/gen/Network/Google/Resource/AndroidEnterprise/Storelayoutpages/Get.hs | mpl-2.0 | -- | V1 error format.
sgXgafv :: Lens' StorelayoutpagesGet (Maybe Xgafv)
sgXgafv = lens _sgXgafv (\ s a -> s{_sgXgafv = a}) | 123 | sgXgafv :: Lens' StorelayoutpagesGet (Maybe Xgafv)
sgXgafv = lens _sgXgafv (\ s a -> s{_sgXgafv = a}) | 101 | sgXgafv = lens _sgXgafv (\ s a -> s{_sgXgafv = a}) | 50 | true | true | 1 | 9 | 21 | 52 | 25 | 27 | null | null |
duplode/stack | src/Stack/Docker.hs | bsd-3-clause | -- | Command-line option for @--internal-re-exec@.
reExecArgName :: String
reExecArgName = "internal-re-exec" | 109 | reExecArgName :: String
reExecArgName = "internal-re-exec" | 58 | reExecArgName = "internal-re-exec" | 34 | true | true | 0 | 4 | 11 | 12 | 7 | 5 | null | null |
shlevy/ghc | compiler/coreSyn/CoreFVs.hs | bsd-3-clause | orphNamesOfType (ForAllTy bndr res) = orphNamesOfType (binderKind bndr)
`unionNameSet` orphNamesOfType res | 146 | orphNamesOfType (ForAllTy bndr res) = orphNamesOfType (binderKind bndr)
`unionNameSet` orphNamesOfType res | 146 | orphNamesOfType (ForAllTy bndr res) = orphNamesOfType (binderKind bndr)
`unionNameSet` orphNamesOfType res | 146 | false | false | 0 | 8 | 50 | 35 | 17 | 18 | null | null |
GaloisInc/ivory | ivory-model-check/src/Ivory/ModelCheck/CVC4.hs | bsd-3-clause | int32 = "int32" | 16 | int32 = "int32" | 16 | int32 = "int32" | 16 | false | false | 1 | 5 | 3 | 10 | 3 | 7 | null | null |
ryantm/ghc | compiler/main/DynFlags.hs | bsd-3-clause | trustPackage p = exposePackage p >> -- both trust and distrust also expose a package
upd (\s -> s{ packageFlags = TrustPackage p : packageFlags s }) | 150 | trustPackage p = exposePackage p >> -- both trust and distrust also expose a package
upd (\s -> s{ packageFlags = TrustPackage p : packageFlags s }) | 150 | trustPackage p = exposePackage p >> -- both trust and distrust also expose a package
upd (\s -> s{ packageFlags = TrustPackage p : packageFlags s }) | 150 | false | false | 1 | 11 | 28 | 50 | 23 | 27 | null | null |
brianshourd/adventOfCode2016 | test/Day18Spec.hs | mit | spec :: Spec
spec = do
describe "countSafeTiles" $ do
it "finds 6 safe tiles in the sample 5x3 input" $ do
countSafeTiles sampleInput1 `shouldBe` 6
it "finds 38 safe tiles in the sample 10x10 input" $ do
countSafeTiles sampleInput2 `shouldBe` 38
describe "day18" $ do
it "finds 1982 safe tiles in actual input" $ do
actualInput <- readFile "inputs/day18.txt"
day18 actualInput `shouldBe` 1982
describe "day18'" $ do
it "finds 20005203 safe tiles in actual input" $ do
actualInput <- readFile "inputs/day18.txt"
--day18' actualInput `shouldBe` 20005203
pendingWith "too slow" | 702 | spec :: Spec
spec = do
describe "countSafeTiles" $ do
it "finds 6 safe tiles in the sample 5x3 input" $ do
countSafeTiles sampleInput1 `shouldBe` 6
it "finds 38 safe tiles in the sample 10x10 input" $ do
countSafeTiles sampleInput2 `shouldBe` 38
describe "day18" $ do
it "finds 1982 safe tiles in actual input" $ do
actualInput <- readFile "inputs/day18.txt"
day18 actualInput `shouldBe` 1982
describe "day18'" $ do
it "finds 20005203 safe tiles in actual input" $ do
actualInput <- readFile "inputs/day18.txt"
--day18' actualInput `shouldBe` 20005203
pendingWith "too slow" | 702 | spec = do
describe "countSafeTiles" $ do
it "finds 6 safe tiles in the sample 5x3 input" $ do
countSafeTiles sampleInput1 `shouldBe` 6
it "finds 38 safe tiles in the sample 10x10 input" $ do
countSafeTiles sampleInput2 `shouldBe` 38
describe "day18" $ do
it "finds 1982 safe tiles in actual input" $ do
actualInput <- readFile "inputs/day18.txt"
day18 actualInput `shouldBe` 1982
describe "day18'" $ do
it "finds 20005203 safe tiles in actual input" $ do
actualInput <- readFile "inputs/day18.txt"
--day18' actualInput `shouldBe` 20005203
pendingWith "too slow" | 689 | false | true | 0 | 31 | 216 | 155 | 64 | 91 | null | null |
woodsjc/hackerrank-challenges | contest_11_29/best_divisor.hs | gpl-3.0 | get_divs :: Int -> [Int]
get_divs d = [1] ++ get_divs' 2 d ++ [d] | 66 | get_divs :: Int -> [Int]
get_divs d = [1] ++ get_divs' 2 d ++ [d] | 65 | get_divs d = [1] ++ get_divs' 2 d ++ [d] | 40 | false | true | 2 | 8 | 15 | 47 | 22 | 25 | null | null |
bitemyapp/hst | src/HST/Test/Parse.hs | apache-2.0 | checkStatementParser ast =
case (parse Parse.statements "" (render $ PPrint.statements ast)) of
Left _ -> False
Right a -> ast == a | 141 | checkStatementParser ast =
case (parse Parse.statements "" (render $ PPrint.statements ast)) of
Left _ -> False
Right a -> ast == a | 141 | checkStatementParser ast =
case (parse Parse.statements "" (render $ PPrint.statements ast)) of
Left _ -> False
Right a -> ast == a | 141 | false | false | 0 | 11 | 31 | 59 | 28 | 31 | null | null |
graninas/The-Amoeba-World | src/Amoeba/GameLogic/Language/Translation/Triggers.hs | gpl-3.0 | onProp name (CellsProperty n _) = n == name | 50 | onProp name (CellsProperty n _) = n == name | 50 | onProp name (CellsProperty n _) = n == name | 50 | false | false | 0 | 7 | 15 | 23 | 11 | 12 | null | null |
beni55/cryptol | src/Cryptol/Prims/Eval.hs | bsd-3-clause | divModPoly :: Integer -> Int -> Integer -> Int -> (Integer, Integer)
divModPoly xs xsLen ys ysLen
| ys == 0 = divideByZero
| otherwise = go 0 initR (xsLen - degree) todoBits
where
downIxes n = [ n - 1, n - 2 .. 0 ]
degree = head [ n | n <- downIxes ysLen, testBit ys n ]
initR = xs `shiftR` (xsLen - degree)
nextR r b = (r `shiftL` 1) .|. (if b then 1 else 0)
go !res !r !bitN todo =
let x = xor r ys
(res',r') | testBit x degree = (res, r)
| otherwise = (setBit res bitN, x)
in case todo of
b : bs -> go res' (nextR r' b) (bitN-1) bs
[] -> (res',r')
todoBits = map (testBit xs) (downIxes (xsLen - degree))
-- | Create a packed word | 756 | divModPoly :: Integer -> Int -> Integer -> Int -> (Integer, Integer)
divModPoly xs xsLen ys ysLen
| ys == 0 = divideByZero
| otherwise = go 0 initR (xsLen - degree) todoBits
where
downIxes n = [ n - 1, n - 2 .. 0 ]
degree = head [ n | n <- downIxes ysLen, testBit ys n ]
initR = xs `shiftR` (xsLen - degree)
nextR r b = (r `shiftL` 1) .|. (if b then 1 else 0)
go !res !r !bitN todo =
let x = xor r ys
(res',r') | testBit x degree = (res, r)
| otherwise = (setBit res bitN, x)
in case todo of
b : bs -> go res' (nextR r' b) (bitN-1) bs
[] -> (res',r')
todoBits = map (testBit xs) (downIxes (xsLen - degree))
-- | Create a packed word | 756 | divModPoly xs xsLen ys ysLen
| ys == 0 = divideByZero
| otherwise = go 0 initR (xsLen - degree) todoBits
where
downIxes n = [ n - 1, n - 2 .. 0 ]
degree = head [ n | n <- downIxes ysLen, testBit ys n ]
initR = xs `shiftR` (xsLen - degree)
nextR r b = (r `shiftL` 1) .|. (if b then 1 else 0)
go !res !r !bitN todo =
let x = xor r ys
(res',r') | testBit x degree = (res, r)
| otherwise = (setBit res bitN, x)
in case todo of
b : bs -> go res' (nextR r' b) (bitN-1) bs
[] -> (res',r')
todoBits = map (testBit xs) (downIxes (xsLen - degree))
-- | Create a packed word | 687 | false | true | 1 | 12 | 265 | 350 | 181 | 169 | null | null |
orome/crypto-enigma | cli/enigma.hs | bsd-3-clause | formatOptHelp = unlines [
"The format used to display machine configuration(s)" ,
"(see below)"] | 114 | formatOptHelp = unlines [
"The format used to display machine configuration(s)" ,
"(see below)"] | 114 | formatOptHelp = unlines [
"The format used to display machine configuration(s)" ,
"(see below)"] | 114 | false | false | 0 | 6 | 31 | 15 | 8 | 7 | null | null |
deadfoxygrandpa/Elm | compiler/Build/Utils.hs | bsd-3-clause | elmi :: Flag.Flags -> FilePath -> FilePath
elmi flags filePath =
cachePath flags filePath "elmi" | 100 | elmi :: Flag.Flags -> FilePath -> FilePath
elmi flags filePath =
cachePath flags filePath "elmi" | 100 | elmi flags filePath =
cachePath flags filePath "elmi" | 57 | false | true | 0 | 6 | 18 | 33 | 16 | 17 | null | null |
snapframework/heist | src/Heist.hs | bsd-3-clause | allErrors :: [Either String (TPath, v)]
-> Either [String] (HashMap TPath v)
allErrors tlist =
case errs of
[] -> Right $ Map.fromList $ rights tlist
_ -> Left errs
where
errs = lefts tlist
------------------------------------------------------------------------------
-- | Loads templates from disk. This function returns just a template map so
-- you can load multiple directories and combine the maps before initializing
-- your HeistState. | 483 | allErrors :: [Either String (TPath, v)]
-> Either [String] (HashMap TPath v)
allErrors tlist =
case errs of
[] -> Right $ Map.fromList $ rights tlist
_ -> Left errs
where
errs = lefts tlist
------------------------------------------------------------------------------
-- | Loads templates from disk. This function returns just a template map so
-- you can load multiple directories and combine the maps before initializing
-- your HeistState. | 483 | allErrors tlist =
case errs of
[] -> Right $ Map.fromList $ rights tlist
_ -> Left errs
where
errs = lefts tlist
------------------------------------------------------------------------------
-- | Loads templates from disk. This function returns just a template map so
-- you can load multiple directories and combine the maps before initializing
-- your HeistState. | 396 | false | true | 1 | 10 | 104 | 105 | 51 | 54 | null | null |
ml9951/ghc | compiler/nativeGen/SPARC/CodeGen.hs | bsd-3-clause | assignMem_FltCode :: Format -> CmmExpr -> CmmExpr -> NatM InstrBlock
assignMem_FltCode pk addr src = do
dflags <- getDynFlags
Amode dst__2 code1 <- getAmode addr
(src__2, code2) <- getSomeReg src
tmp1 <- getNewRegNat pk
let
pk__2 = cmmExprType dflags src
code__2 = code1 `appOL` code2 `appOL`
if formatToWidth pk == typeWidth pk__2
then unitOL (ST pk src__2 dst__2)
else toOL [ FxTOy (cmmTypeFormat pk__2) pk src__2 tmp1
, ST pk tmp1 dst__2]
return code__2
-- Floating point assignment to a register/temporary | 619 | assignMem_FltCode :: Format -> CmmExpr -> CmmExpr -> NatM InstrBlock
assignMem_FltCode pk addr src = do
dflags <- getDynFlags
Amode dst__2 code1 <- getAmode addr
(src__2, code2) <- getSomeReg src
tmp1 <- getNewRegNat pk
let
pk__2 = cmmExprType dflags src
code__2 = code1 `appOL` code2 `appOL`
if formatToWidth pk == typeWidth pk__2
then unitOL (ST pk src__2 dst__2)
else toOL [ FxTOy (cmmTypeFormat pk__2) pk src__2 tmp1
, ST pk tmp1 dst__2]
return code__2
-- Floating point assignment to a register/temporary | 619 | assignMem_FltCode pk addr src = do
dflags <- getDynFlags
Amode dst__2 code1 <- getAmode addr
(src__2, code2) <- getSomeReg src
tmp1 <- getNewRegNat pk
let
pk__2 = cmmExprType dflags src
code__2 = code1 `appOL` code2 `appOL`
if formatToWidth pk == typeWidth pk__2
then unitOL (ST pk src__2 dst__2)
else toOL [ FxTOy (cmmTypeFormat pk__2) pk src__2 tmp1
, ST pk tmp1 dst__2]
return code__2
-- Floating point assignment to a register/temporary | 550 | false | true | 0 | 16 | 190 | 181 | 87 | 94 | null | null |
noughtmare/yi | yi-keymap-vim/src/Yi/Keymap/Vim/Digraph.hs | gpl-2.0 | -- BOX DRAWINGS LIGHT UP AND RIGHT
switch 'u' 'R' = '\x2515' | 60 | switch 'u' 'R' = '\x2515' | 25 | switch 'u' 'R' = '\x2515' | 25 | true | false | 0 | 5 | 11 | 12 | 6 | 6 | null | null |
olive/antiqua-prime | src/Antiqua/Graphics/Window.hs | mit | createWindow :: WindowSettings => IO Window
createWindow = do
True <- GLFW.init
GLFW.defaultWindowHints
Just win <- GLFW.createWindow width height title Nothing Nothing
GLFW.makeContextCurrent (Just win)
GLFW.setScrollCallback win (Just scroll)
initGL win
GLFW.setWindowCloseCallback win (Just windowClosed)
GLFW.setFramebufferSizeCallback win (Just resizeScene)
GLFW.setKeyCallback win (Just keyPressed)
return $ Window win | 464 | createWindow :: WindowSettings => IO Window
createWindow = do
True <- GLFW.init
GLFW.defaultWindowHints
Just win <- GLFW.createWindow width height title Nothing Nothing
GLFW.makeContextCurrent (Just win)
GLFW.setScrollCallback win (Just scroll)
initGL win
GLFW.setWindowCloseCallback win (Just windowClosed)
GLFW.setFramebufferSizeCallback win (Just resizeScene)
GLFW.setKeyCallback win (Just keyPressed)
return $ Window win | 464 | createWindow = do
True <- GLFW.init
GLFW.defaultWindowHints
Just win <- GLFW.createWindow width height title Nothing Nothing
GLFW.makeContextCurrent (Just win)
GLFW.setScrollCallback win (Just scroll)
initGL win
GLFW.setWindowCloseCallback win (Just windowClosed)
GLFW.setFramebufferSizeCallback win (Just resizeScene)
GLFW.setKeyCallback win (Just keyPressed)
return $ Window win | 420 | false | true | 0 | 10 | 86 | 156 | 66 | 90 | null | null |
ChrisLane/leksah | src/IDE/Pane/PackageEditor.hs | gpl-2.0 | stringxEditor :: (String -> Bool) -> Editor String
stringxEditor val para noti = do
(wid,inj,ext) <- stringEditor val True para noti
let
xinj ("") = inj ""
xinj ('x':'-':rest) = inj rest
xinj _ = throwIDE "PackageEditor>>stringxEditor: field without leading x-"
xext = do
res <- ext
case res of
Nothing -> return Nothing
Just str -> return (Just ("x-" ++ str))
return (wid,xinj,xext) | 483 | stringxEditor :: (String -> Bool) -> Editor String
stringxEditor val para noti = do
(wid,inj,ext) <- stringEditor val True para noti
let
xinj ("") = inj ""
xinj ('x':'-':rest) = inj rest
xinj _ = throwIDE "PackageEditor>>stringxEditor: field without leading x-"
xext = do
res <- ext
case res of
Nothing -> return Nothing
Just str -> return (Just ("x-" ++ str))
return (wid,xinj,xext) | 483 | stringxEditor val para noti = do
(wid,inj,ext) <- stringEditor val True para noti
let
xinj ("") = inj ""
xinj ('x':'-':rest) = inj rest
xinj _ = throwIDE "PackageEditor>>stringxEditor: field without leading x-"
xext = do
res <- ext
case res of
Nothing -> return Nothing
Just str -> return (Just ("x-" ++ str))
return (wid,xinj,xext) | 432 | false | true | 0 | 19 | 163 | 176 | 86 | 90 | null | null |
Tener/HaNS | src/Hans/Message/Ip4.hs | bsd-3-clause | -- IP4 Pseudo Header -----------------------------------------------------------
-- 0 7 8 15 16 23 24 31
-- +--------+--------+--------+--------+
-- | source address |
-- +--------+--------+--------+--------+
-- | destination address |
-- +--------+--------+--------+--------+
-- | zero |protocol| length |
-- +--------+--------+--------+--------+
mkIP4PseudoHeader :: IP4 -> IP4 -> IP4Protocol -> MkPseudoHeader
mkIP4PseudoHeader src dst prot len = runPut $ do
put src
put dst
putWord8 0 >> put prot >> putWord16be (fromIntegral len)
-- IP4 Packets ----------------------------------------------------------------- | 684 | mkIP4PseudoHeader :: IP4 -> IP4 -> IP4Protocol -> MkPseudoHeader
mkIP4PseudoHeader src dst prot len = runPut $ do
put src
put dst
putWord8 0 >> put prot >> putWord16be (fromIntegral len)
-- IP4 Packets ----------------------------------------------------------------- | 275 | mkIP4PseudoHeader src dst prot len = runPut $ do
put src
put dst
putWord8 0 >> put prot >> putWord16be (fromIntegral len)
-- IP4 Packets ----------------------------------------------------------------- | 210 | true | true | 0 | 11 | 141 | 84 | 43 | 41 | null | null |
Tr1p0d/VYPe15 | src/VYPe15/Types/SymbolTable.hs | bsd-3-clause | builtInFunctions :: FunctionTable
builtInFunctions = M.fromList
[ ("print",
Function
FuncDefined
Nothing
[]
)
, ("read_char",
Function
FuncDefined
(Just DChar)
[]
)
, ("read_int",
Function
FuncDefined
(Just DInt)
[]
)
, ("read_string",
Function
FuncDefined
(Just DString)
[]
)
, ("get_at",
Function
FuncDefined
(Just DChar)
[ AnonymousParam DString
, AnonymousParam DInt
]
)
, ("set_at",
Function
FuncDefined
(Just DString)
[ AnonymousParam DString
, AnonymousParam DInt
, AnonymousParam DChar
]
)
, ("strcat",
Function
FuncDefined
(Just DString)
[ AnonymousParam DString
, AnonymousParam DString
]
)
] | 1,012 | builtInFunctions :: FunctionTable
builtInFunctions = M.fromList
[ ("print",
Function
FuncDefined
Nothing
[]
)
, ("read_char",
Function
FuncDefined
(Just DChar)
[]
)
, ("read_int",
Function
FuncDefined
(Just DInt)
[]
)
, ("read_string",
Function
FuncDefined
(Just DString)
[]
)
, ("get_at",
Function
FuncDefined
(Just DChar)
[ AnonymousParam DString
, AnonymousParam DInt
]
)
, ("set_at",
Function
FuncDefined
(Just DString)
[ AnonymousParam DString
, AnonymousParam DInt
, AnonymousParam DChar
]
)
, ("strcat",
Function
FuncDefined
(Just DString)
[ AnonymousParam DString
, AnonymousParam DString
]
)
] | 1,012 | builtInFunctions = M.fromList
[ ("print",
Function
FuncDefined
Nothing
[]
)
, ("read_char",
Function
FuncDefined
(Just DChar)
[]
)
, ("read_int",
Function
FuncDefined
(Just DInt)
[]
)
, ("read_string",
Function
FuncDefined
(Just DString)
[]
)
, ("get_at",
Function
FuncDefined
(Just DChar)
[ AnonymousParam DString
, AnonymousParam DInt
]
)
, ("set_at",
Function
FuncDefined
(Just DString)
[ AnonymousParam DString
, AnonymousParam DInt
, AnonymousParam DChar
]
)
, ("strcat",
Function
FuncDefined
(Just DString)
[ AnonymousParam DString
, AnonymousParam DString
]
)
] | 978 | false | true | 0 | 9 | 492 | 214 | 114 | 100 | null | null |
rueshyna/gogol | gogol-storage/gen/Network/Google/Storage/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ComposeRequestSourceObjectsItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'crsoiName'
--
-- * 'crsoiObjectPreconditions'
--
-- * 'crsoiGeneration'
composeRequestSourceObjectsItem
:: ComposeRequestSourceObjectsItem
composeRequestSourceObjectsItem =
ComposeRequestSourceObjectsItem'
{ _crsoiName = Nothing
, _crsoiObjectPreconditions = Nothing
, _crsoiGeneration = Nothing
} | 513 | composeRequestSourceObjectsItem
:: ComposeRequestSourceObjectsItem
composeRequestSourceObjectsItem =
ComposeRequestSourceObjectsItem'
{ _crsoiName = Nothing
, _crsoiObjectPreconditions = Nothing
, _crsoiGeneration = Nothing
} | 249 | composeRequestSourceObjectsItem =
ComposeRequestSourceObjectsItem'
{ _crsoiName = Nothing
, _crsoiObjectPreconditions = Nothing
, _crsoiGeneration = Nothing
} | 178 | true | true | 1 | 7 | 84 | 47 | 29 | 18 | null | null |
pjones/thetvdb | Network/API/TheTVDB/Zipper.hs | mit | findEpisode (x:_, _) n = breakAt (episodeList x) n | 50 | findEpisode (x:_, _) n = breakAt (episodeList x) n | 50 | findEpisode (x:_, _) n = breakAt (episodeList x) n | 50 | false | false | 1 | 7 | 8 | 34 | 16 | 18 | null | null |
mcschroeder/ghc | libraries/template-haskell/Language/Haskell/TH/Lib.hs | bsd-3-clause | forallC :: [TyVarBndr] -> CxtQ -> ConQ -> ConQ
forallC ns ctxt con = liftM2 (ForallC ns) ctxt con | 97 | forallC :: [TyVarBndr] -> CxtQ -> ConQ -> ConQ
forallC ns ctxt con = liftM2 (ForallC ns) ctxt con | 97 | forallC ns ctxt con = liftM2 (ForallC ns) ctxt con | 50 | false | true | 0 | 7 | 18 | 46 | 23 | 23 | null | null |
Frefreak/Gideon | src/SDEDrill.hs | bsd-3-clause | getAllItemsMap :: IO ItemMapping
getAllItemsMap = do
exist <- allItemsJson >>= doesFileExist
if not exist then error "Run genAllItemsMap first!" else do
Just hm <- decode <$> (LBS.readFile =<< allItemsJson)
:: IO (Maybe ItemMapping)
return hm | 278 | getAllItemsMap :: IO ItemMapping
getAllItemsMap = do
exist <- allItemsJson >>= doesFileExist
if not exist then error "Run genAllItemsMap first!" else do
Just hm <- decode <$> (LBS.readFile =<< allItemsJson)
:: IO (Maybe ItemMapping)
return hm | 278 | getAllItemsMap = do
exist <- allItemsJson >>= doesFileExist
if not exist then error "Run genAllItemsMap first!" else do
Just hm <- decode <$> (LBS.readFile =<< allItemsJson)
:: IO (Maybe ItemMapping)
return hm | 245 | false | true | 0 | 14 | 71 | 83 | 39 | 44 | null | null |
wat-aro/scheme | app/Main.hs | bsd-3-clause | parseOct :: Parser LispVal
parseOct = do try $ string "#o"
x <- many1 octDigit
return $ Number (oct2dig x) | 134 | parseOct :: Parser LispVal
parseOct = do try $ string "#o"
x <- many1 octDigit
return $ Number (oct2dig x) | 134 | parseOct = do try $ string "#o"
x <- many1 octDigit
return $ Number (oct2dig x) | 107 | false | true | 1 | 11 | 47 | 54 | 22 | 32 | null | null |
dysinger/amazonka | amazonka-ecs/gen/Network/AWS/ECS/Types.hs | mpl-2.0 | -- | The name of the container.
cName :: Lens' Container (Maybe Text)
cName = lens _cName (\s a -> s { _cName = a }) | 116 | cName :: Lens' Container (Maybe Text)
cName = lens _cName (\s a -> s { _cName = a }) | 84 | cName = lens _cName (\s a -> s { _cName = a }) | 46 | true | true | 0 | 9 | 25 | 46 | 25 | 21 | null | null |
ndmitchell/hogle-dead | src/Input/Hoogle.hs | bsd-3-clause | parseLine line x | Just x <- readItem x = case x of
IDecl (TypeSig a bs c) -> Right [IDecl (TypeSig a [b] c) | b <- bs]
x -> Right [x] | 142 | parseLine line x | Just x <- readItem x = case x of
IDecl (TypeSig a bs c) -> Right [IDecl (TypeSig a [b] c) | b <- bs]
x -> Right [x] | 142 | parseLine line x | Just x <- readItem x = case x of
IDecl (TypeSig a bs c) -> Right [IDecl (TypeSig a [b] c) | b <- bs]
x -> Right [x] | 142 | false | false | 3 | 10 | 40 | 83 | 42 | 41 | null | null |
brendanhay/gogol | gogol-cloudsearch/gen/Network/Google/CloudSearch/Types/Product.hs | mpl-2.0 | -- | Name of connector making this call. Format:
-- datasources\/{source_id}\/connectors\/{ID}
pirConnectorName :: Lens' PushItemRequest (Maybe Text)
pirConnectorName
= lens _pirConnectorName
(\ s a -> s{_pirConnectorName = a}) | 235 | pirConnectorName :: Lens' PushItemRequest (Maybe Text)
pirConnectorName
= lens _pirConnectorName
(\ s a -> s{_pirConnectorName = a}) | 140 | pirConnectorName
= lens _pirConnectorName
(\ s a -> s{_pirConnectorName = a}) | 85 | true | true | 1 | 9 | 35 | 53 | 26 | 27 | null | null |
chadbrewbaker/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | prop_checkFindExecWithSingleArgument2 = verify checkFindExecWithSingleArgument "find . -execdir 'cat {} | wc -l' +" | 115 | prop_checkFindExecWithSingleArgument2 = verify checkFindExecWithSingleArgument "find . -execdir 'cat {} | wc -l' +" | 115 | prop_checkFindExecWithSingleArgument2 = verify checkFindExecWithSingleArgument "find . -execdir 'cat {} | wc -l' +" | 115 | false | false | 0 | 5 | 12 | 11 | 5 | 6 | null | null |
CDSoft/pp | src/Preprocessor.hs | gpl-3.0 | -- !raw(text) emits text unpreprocessed
raw :: Macro
raw = Macro "raw" []
"`!raw(TEXT)` returns `TEXT` without any preprocessing."
(\env args -> case args of
[src] -> return (env, fromVal src)
_ -> arityError "raw"
) | 244 | raw :: Macro
raw = Macro "raw" []
"`!raw(TEXT)` returns `TEXT` without any preprocessing."
(\env args -> case args of
[src] -> return (env, fromVal src)
_ -> arityError "raw"
) | 204 | raw = Macro "raw" []
"`!raw(TEXT)` returns `TEXT` without any preprocessing."
(\env args -> case args of
[src] -> return (env, fromVal src)
_ -> arityError "raw"
) | 191 | true | true | 0 | 13 | 63 | 77 | 36 | 41 | null | null |
brendanhay/gogol | gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/FloodlightActivities/List.hs | mpl-2.0 | -- | Select only floodlight activities with the specified IDs. Must specify
-- either ids, advertiserId, or floodlightConfigurationId for a non-empty
-- result.
falIds :: Lens' FloodlightActivitiesList [Int64]
falIds
= lens _falIds (\ s a -> s{_falIds = a}) . _Default .
_Coerce | 286 | falIds :: Lens' FloodlightActivitiesList [Int64]
falIds
= lens _falIds (\ s a -> s{_falIds = a}) . _Default .
_Coerce | 125 | falIds
= lens _falIds (\ s a -> s{_falIds = a}) . _Default .
_Coerce | 76 | true | true | 0 | 11 | 50 | 55 | 30 | 25 | null | null |
peterson/lets-tree | src/Lets/BinomialHeap.hs | bsd-3-clause | --
-- operations
--
--
-- | Takes two trees of rank /n/ and combines them into a single tree of rank /n+1/.
combine :: Ord a => BinTree a -> BinTree a -> BinTree a
combine t1@(Node r v1 c1) t2@(Node _ v2 c2)
| v1 < v2 = Node (r+1) v1 (t2 : c1)
| otherwise = Node (r+1) v2 (t1 : c2) | 289 | combine :: Ord a => BinTree a -> BinTree a -> BinTree a
combine t1@(Node r v1 c1) t2@(Node _ v2 c2)
| v1 < v2 = Node (r+1) v1 (t2 : c1)
| otherwise = Node (r+1) v2 (t1 : c2) | 179 | combine t1@(Node r v1 c1) t2@(Node _ v2 c2)
| v1 < v2 = Node (r+1) v1 (t2 : c1)
| otherwise = Node (r+1) v2 (t1 : c2) | 123 | true | true | 9 | 7 | 72 | 130 | 68 | 62 | null | null |
iron-codegen/iron | library/Iron/Analyze/Halting.hs | bsd-3-clause | _All :: Iso' Halts All
_All = iso All (\(All a) -> a) | 53 | _All :: Iso' Halts All
_All = iso All (\(All a) -> a) | 53 | _All = iso All (\(All a) -> a) | 30 | false | true | 1 | 9 | 12 | 38 | 18 | 20 | null | null |
monte-language/masque | Test.hs | gpl-3.0 | main = do
quickCheck propSameEverIdentical | 46 | main = do
quickCheck propSameEverIdentical | 46 | main = do
quickCheck propSameEverIdentical | 46 | false | false | 0 | 7 | 8 | 12 | 5 | 7 | null | null |
ekmett/arcade | src/Arcade/Game.hs | bsd-3-clause | (<?>) :: Game a -> String -> Game a
Game m <?> l = Game $ \ e s -> m e s `Exception.catch`
\(GameException ls msg) -> Exception.throwIO $ GameException (l:ls) msg | 164 | (<?>) :: Game a -> String -> Game a
Game m <?> l = Game $ \ e s -> m e s `Exception.catch`
\(GameException ls msg) -> Exception.throwIO $ GameException (l:ls) msg | 164 | Game m <?> l = Game $ \ e s -> m e s `Exception.catch`
\(GameException ls msg) -> Exception.throwIO $ GameException (l:ls) msg | 128 | false | true | 0 | 12 | 34 | 91 | 46 | 45 | null | null |
jtojnar/haste-compiler | libraries/ghc-7.10/base/GHC/List.hs | bsd-3-clause | all p = and . map p | 38 | all p = and . map p | 38 | all p = and . map p | 38 | false | false | 1 | 6 | 25 | 19 | 7 | 12 | null | null |
keera-studios/hsQt | Qtc/Enums/Gui/QKeySequence.hs | bsd-2-clause | eSelectNextChar :: StandardKey
eSelectNextChar
= ieStandardKey $ 44 | 69 | eSelectNextChar :: StandardKey
eSelectNextChar
= ieStandardKey $ 44 | 69 | eSelectNextChar
= ieStandardKey $ 44 | 38 | false | true | 0 | 6 | 9 | 18 | 8 | 10 | null | null |
psibi/persistent | persistent-postgresql/Database/Persist/Postgresql.hs | mit | showSqlType SqlDayTime = "TIMESTAMP WITH TIME ZONE" | 51 | showSqlType SqlDayTime = "TIMESTAMP WITH TIME ZONE" | 51 | showSqlType SqlDayTime = "TIMESTAMP WITH TIME ZONE" | 51 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
piyush-kurur/shakespeare | shakespeare-css/test/ShakespeareCssTest.hs | bsd-2-clause | encodeUrlChar :: Char -> String
encodeUrlChar c
-- List of unreserved characters per RFC 3986
-- Gleaned from http://en.wikipedia.org/wiki/Percent-encoding
| 'A' <= c && c <= 'Z' = [c]
| 'a' <= c && c <= 'z' = [c]
| '0' <= c && c <= '9' = [c] | 268 | encodeUrlChar :: Char -> String
encodeUrlChar c
-- List of unreserved characters per RFC 3986
-- Gleaned from http://en.wikipedia.org/wiki/Percent-encoding
| 'A' <= c && c <= 'Z' = [c]
| 'a' <= c && c <= 'z' = [c]
| '0' <= c && c <= '9' = [c] | 267 | encodeUrlChar c
-- List of unreserved characters per RFC 3986
-- Gleaned from http://en.wikipedia.org/wiki/Percent-encoding
| 'A' <= c && c <= 'Z' = [c]
| 'a' <= c && c <= 'z' = [c]
| '0' <= c && c <= '9' = [c] | 235 | false | true | 0 | 10 | 74 | 99 | 48 | 51 | null | null |
zeekay/lambdabot | Plugin/Free/Theorem.hs | mit | applySimplifierTheorem s (ThImplies p1 p2)
= ThImplies (s p1) (s p2) | 73 | applySimplifierTheorem s (ThImplies p1 p2)
= ThImplies (s p1) (s p2) | 73 | applySimplifierTheorem s (ThImplies p1 p2)
= ThImplies (s p1) (s p2) | 73 | false | false | 0 | 7 | 15 | 36 | 17 | 19 | null | null |
mdsteele/fallback | src/Fallback/Test/Queue.hs | gpl-3.0 | -------------------------------------------------------------------------------
queueTests :: Test
queueTests = "queue" ~: TestList [
insist $ Queue.null Queue.empty,
insist $ Queue.size Queue.empty == 0,
qcTest $ \v -> not (Queue.null (Queue.singleton v :: QI)),
qcTest $ \v -> Queue.size (Queue.singleton v :: QI) == 1,
qcTest $ \v -> Queue.pop (Queue.singleton v :: QI) == Just (v, Queue.empty),
qcTest $ \v -> Queue.insert v Queue.empty == (Queue.singleton v :: QI),
qcTest $ \v1 v2 -> Queue.size (Queue.insert v2 $ Queue.insert v1 $
Queue.empty :: QI) == 2,
qcTest $ \list -> Queue.size (Queue.fromList list :: QI) == length list,
qcTest $ \list -> Queue.toList (Queue.fromList list :: QI) == list,
qcTest $ \list -> (Queue.fromList list :: QI) ==
foldl (flip Queue.insert) Queue.empty list,
qcTest $ \list -> let queue = Queue.fromList list :: QI
in Queue.toList queue == unfoldr Queue.pop queue] | 998 | queueTests :: Test
queueTests = "queue" ~: TestList [
insist $ Queue.null Queue.empty,
insist $ Queue.size Queue.empty == 0,
qcTest $ \v -> not (Queue.null (Queue.singleton v :: QI)),
qcTest $ \v -> Queue.size (Queue.singleton v :: QI) == 1,
qcTest $ \v -> Queue.pop (Queue.singleton v :: QI) == Just (v, Queue.empty),
qcTest $ \v -> Queue.insert v Queue.empty == (Queue.singleton v :: QI),
qcTest $ \v1 v2 -> Queue.size (Queue.insert v2 $ Queue.insert v1 $
Queue.empty :: QI) == 2,
qcTest $ \list -> Queue.size (Queue.fromList list :: QI) == length list,
qcTest $ \list -> Queue.toList (Queue.fromList list :: QI) == list,
qcTest $ \list -> (Queue.fromList list :: QI) ==
foldl (flip Queue.insert) Queue.empty list,
qcTest $ \list -> let queue = Queue.fromList list :: QI
in Queue.toList queue == unfoldr Queue.pop queue] | 917 | queueTests = "queue" ~: TestList [
insist $ Queue.null Queue.empty,
insist $ Queue.size Queue.empty == 0,
qcTest $ \v -> not (Queue.null (Queue.singleton v :: QI)),
qcTest $ \v -> Queue.size (Queue.singleton v :: QI) == 1,
qcTest $ \v -> Queue.pop (Queue.singleton v :: QI) == Just (v, Queue.empty),
qcTest $ \v -> Queue.insert v Queue.empty == (Queue.singleton v :: QI),
qcTest $ \v1 v2 -> Queue.size (Queue.insert v2 $ Queue.insert v1 $
Queue.empty :: QI) == 2,
qcTest $ \list -> Queue.size (Queue.fromList list :: QI) == length list,
qcTest $ \list -> Queue.toList (Queue.fromList list :: QI) == list,
qcTest $ \list -> (Queue.fromList list :: QI) ==
foldl (flip Queue.insert) Queue.empty list,
qcTest $ \list -> let queue = Queue.fromList list :: QI
in Queue.toList queue == unfoldr Queue.pop queue] | 898 | true | true | 0 | 16 | 233 | 403 | 209 | 194 | null | null |
expipiplus1/vulkan | generate-new/src/Haskell.hs | bsd-3-clause | neverBootTypes :: [Name]
neverBootTypes =
[ typeName (TyConName ":::")
, typeName (TyConName "SomeStruct")
, typeName (TyConName "SomeChild")
] | 151 | neverBootTypes :: [Name]
neverBootTypes =
[ typeName (TyConName ":::")
, typeName (TyConName "SomeStruct")
, typeName (TyConName "SomeChild")
] | 151 | neverBootTypes =
[ typeName (TyConName ":::")
, typeName (TyConName "SomeStruct")
, typeName (TyConName "SomeChild")
] | 126 | false | true | 0 | 8 | 25 | 50 | 26 | 24 | null | null |
robertclancy/tapl | inference/lib/Language/Inference/Pretty.hs | gpl-2.0 | prettyType TyNat = text "Nat" | 30 | prettyType TyNat = text "Nat" | 30 | prettyType TyNat = text "Nat" | 30 | false | false | 0 | 5 | 5 | 12 | 5 | 7 | null | null |
haskell-infra/hackage-server | Distribution/Server/Features/UserSignup.hs | bsd-3-clause | deleteSignupResetInfo :: Nonce -> Update SignupResetTable ()
deleteSignupResetInfo nonce = do
SignupResetTable tbl <- get
put $! SignupResetTable (Map.delete nonce tbl) | 176 | deleteSignupResetInfo :: Nonce -> Update SignupResetTable ()
deleteSignupResetInfo nonce = do
SignupResetTable tbl <- get
put $! SignupResetTable (Map.delete nonce tbl) | 176 | deleteSignupResetInfo nonce = do
SignupResetTable tbl <- get
put $! SignupResetTable (Map.delete nonce tbl) | 115 | false | true | 0 | 11 | 28 | 55 | 25 | 30 | null | null |
brendanhay/gogol | gogol-serviceconsumermanagement/gen/Network/Google/Resource/ServiceConsumerManagement/Services/TenancyUnits/ApplyProjectConfig.hs | mpl-2.0 | -- | Multipart request metadata.
stuapcPayload :: Lens' ServicesTenancyUnitsApplyProjectConfig ApplyTenantProjectConfigRequest
stuapcPayload
= lens _stuapcPayload
(\ s a -> s{_stuapcPayload = a}) | 203 | stuapcPayload :: Lens' ServicesTenancyUnitsApplyProjectConfig ApplyTenantProjectConfigRequest
stuapcPayload
= lens _stuapcPayload
(\ s a -> s{_stuapcPayload = a}) | 170 | stuapcPayload
= lens _stuapcPayload
(\ s a -> s{_stuapcPayload = a}) | 76 | true | true | 1 | 9 | 28 | 46 | 22 | 24 | null | null |
hanshoglund/fluent | src/Sound/Fluent.hs | bsd-3-clause | -- Span in which generator is alive
genSpan :: Gen -> Span
genSpan (Gen _ (Clip _ _ s) t) = startAt t s | 103 | genSpan :: Gen -> Span
genSpan (Gen _ (Clip _ _ s) t) = startAt t s | 67 | genSpan (Gen _ (Clip _ _ s) t) = startAt t s | 44 | true | true | 0 | 11 | 23 | 49 | 23 | 26 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpInfo ReadByteArrayOp_Word = mkGenPrimOp (fsLit "readWordArray#") [deltaTyVar] [mkMutableByteArrayPrimTy deltaTy, intPrimTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, wordPrimTy])) | 216 | primOpInfo ReadByteArrayOp_Word = mkGenPrimOp (fsLit "readWordArray#") [deltaTyVar] [mkMutableByteArrayPrimTy deltaTy, intPrimTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, wordPrimTy])) | 216 | primOpInfo ReadByteArrayOp_Word = mkGenPrimOp (fsLit "readWordArray#") [deltaTyVar] [mkMutableByteArrayPrimTy deltaTy, intPrimTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, wordPrimTy])) | 216 | false | false | 0 | 10 | 17 | 62 | 32 | 30 | null | null |
hectoregm/racket | shriram/shriram-chapter7.hs | mit | extend :: Env -> Identifier -> Value -> Env
extend env i v = (i,v):env | 70 | extend :: Env -> Identifier -> Value -> Env
extend env i v = (i,v):env | 70 | extend env i v = (i,v):env | 26 | false | true | 2 | 9 | 14 | 48 | 22 | 26 | null | null |
jaccokrijnen/leksah | src/IDE/Package.hs | gpl-2.0 | packageTest' :: Bool -> Bool -> IDEPackage -> Bool -> (Bool -> IDEAction) -> IDEAction
packageTest' backgroundBuild jumpToWarnings package shallConfigure continuation = do
let dir = ipdPackageDir package
useStack <- liftIO . doesFileExist $ dir </> "stack.yaml"
if not useStack && "--enable-tests" `elem` ipdConfigFlags package
then do
logLaunch <- getDefaultLogLaunch
showDefaultLogLaunch'
catchIDE (do
prefs <- readIDE prefs
removeTestLogRefs dir
runExternalTool' (__ "Testing") (cabalCommand prefs) (["test", "--with-ghc=leksahtrue"]
++ ipdBuildFlags package ++ ipdTestFlags package) dir $ do
(mbLastOutput, isConfigErr, _) <- C.getZipSink $ (,,)
<$> C.ZipSink sinkLast
<*> C.ZipSink isConfigError
<*> (C.ZipSink $ logOutputForBuild package backgroundBuild jumpToWarnings)
lift $ do
errs <- readIDE errorRefs
if shallConfigure && isConfigErr
then
packageConfig' package (\ b ->
when b $ packageTest' backgroundBuild jumpToWarnings package shallConfigure continuation)
else do
continuation (mbLastOutput == Just (ToolExit ExitSuccess))
return ())
(\(e :: SomeException) -> print e)
else continuation True | 1,576 | packageTest' :: Bool -> Bool -> IDEPackage -> Bool -> (Bool -> IDEAction) -> IDEAction
packageTest' backgroundBuild jumpToWarnings package shallConfigure continuation = do
let dir = ipdPackageDir package
useStack <- liftIO . doesFileExist $ dir </> "stack.yaml"
if not useStack && "--enable-tests" `elem` ipdConfigFlags package
then do
logLaunch <- getDefaultLogLaunch
showDefaultLogLaunch'
catchIDE (do
prefs <- readIDE prefs
removeTestLogRefs dir
runExternalTool' (__ "Testing") (cabalCommand prefs) (["test", "--with-ghc=leksahtrue"]
++ ipdBuildFlags package ++ ipdTestFlags package) dir $ do
(mbLastOutput, isConfigErr, _) <- C.getZipSink $ (,,)
<$> C.ZipSink sinkLast
<*> C.ZipSink isConfigError
<*> (C.ZipSink $ logOutputForBuild package backgroundBuild jumpToWarnings)
lift $ do
errs <- readIDE errorRefs
if shallConfigure && isConfigErr
then
packageConfig' package (\ b ->
when b $ packageTest' backgroundBuild jumpToWarnings package shallConfigure continuation)
else do
continuation (mbLastOutput == Just (ToolExit ExitSuccess))
return ())
(\(e :: SomeException) -> print e)
else continuation True | 1,576 | packageTest' backgroundBuild jumpToWarnings package shallConfigure continuation = do
let dir = ipdPackageDir package
useStack <- liftIO . doesFileExist $ dir </> "stack.yaml"
if not useStack && "--enable-tests" `elem` ipdConfigFlags package
then do
logLaunch <- getDefaultLogLaunch
showDefaultLogLaunch'
catchIDE (do
prefs <- readIDE prefs
removeTestLogRefs dir
runExternalTool' (__ "Testing") (cabalCommand prefs) (["test", "--with-ghc=leksahtrue"]
++ ipdBuildFlags package ++ ipdTestFlags package) dir $ do
(mbLastOutput, isConfigErr, _) <- C.getZipSink $ (,,)
<$> C.ZipSink sinkLast
<*> C.ZipSink isConfigError
<*> (C.ZipSink $ logOutputForBuild package backgroundBuild jumpToWarnings)
lift $ do
errs <- readIDE errorRefs
if shallConfigure && isConfigErr
then
packageConfig' package (\ b ->
when b $ packageTest' backgroundBuild jumpToWarnings package shallConfigure continuation)
else do
continuation (mbLastOutput == Just (ToolExit ExitSuccess))
return ())
(\(e :: SomeException) -> print e)
else continuation True | 1,489 | false | true | 0 | 28 | 609 | 373 | 180 | 193 | null | null |
ambiata/mismi | mismi-cli/main/s3.hs | bsd-3-clause | outputAddress' :: Parser Address
outputAddress' = option (pOption s3Parser) $
long "output"
<> metavar "S3URI"
<> help "An s3 uri, i.e. s3://bucket/prefix/key"
<> XOA.completer addressCompleter | 204 | outputAddress' :: Parser Address
outputAddress' = option (pOption s3Parser) $
long "output"
<> metavar "S3URI"
<> help "An s3 uri, i.e. s3://bucket/prefix/key"
<> XOA.completer addressCompleter | 204 | outputAddress' = option (pOption s3Parser) $
long "output"
<> metavar "S3URI"
<> help "An s3 uri, i.e. s3://bucket/prefix/key"
<> XOA.completer addressCompleter | 171 | false | true | 6 | 8 | 35 | 56 | 24 | 32 | null | null |
fmapfmapfmap/amazonka | amazonka-autoscaling/gen/Network/AWS/AutoScaling/CompleteLifecycleAction.hs | mpl-2.0 | -- | Creates a value of 'CompleteLifecycleActionResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'clarsResponseStatus'
completeLifecycleActionResponse
:: Int -- ^ 'clarsResponseStatus'
-> CompleteLifecycleActionResponse
completeLifecycleActionResponse pResponseStatus_ =
CompleteLifecycleActionResponse'
{ _clarsResponseStatus = pResponseStatus_
} | 461 | completeLifecycleActionResponse
:: Int -- ^ 'clarsResponseStatus'
-> CompleteLifecycleActionResponse
completeLifecycleActionResponse pResponseStatus_ =
CompleteLifecycleActionResponse'
{ _clarsResponseStatus = pResponseStatus_
} | 248 | completeLifecycleActionResponse pResponseStatus_ =
CompleteLifecycleActionResponse'
{ _clarsResponseStatus = pResponseStatus_
} | 139 | true | true | 0 | 7 | 70 | 41 | 22 | 19 | null | null |
Melvar/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | isTypeConst WorldType = True | 28 | isTypeConst WorldType = True | 28 | isTypeConst WorldType = True | 28 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
GaloisInc/sk-dev-platform | libs/SCD/src/SCD/M4/ModuleFiles.hs | bsd-3-clause | classPermissionFiles :: [FilePath]
classPermissionFiles = [ "obj_perm_sets" ] | 77 | classPermissionFiles :: [FilePath]
classPermissionFiles = [ "obj_perm_sets" ] | 77 | classPermissionFiles = [ "obj_perm_sets" ] | 42 | false | true | 0 | 7 | 7 | 24 | 11 | 13 | null | null |
nevrenato/HetsAlloy | Propositional/Parse_AS_Basic.hs | gpl-2.0 | -- | Parser for negation
negKey :: AnnoState.AParser st Id.Token
negKey = AnnoState.asKey Keywords.negS | 103 | negKey :: AnnoState.AParser st Id.Token
negKey = AnnoState.asKey Keywords.negS | 78 | negKey = AnnoState.asKey Keywords.negS | 38 | true | true | 0 | 6 | 13 | 28 | 14 | 14 | null | null |
fmthoma/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | gHC_ENUM = mkBaseModule (fsLit "GHC.Enum") | 49 | gHC_ENUM = mkBaseModule (fsLit "GHC.Enum") | 49 | gHC_ENUM = mkBaseModule (fsLit "GHC.Enum") | 49 | false | false | 0 | 7 | 11 | 15 | 7 | 8 | null | null |
diku-dk/futhark | src/Language/Futhark/Prop.hs | isc | diet (Scalar (TypeVar _ Nonunique _ _)) = Observe | 49 | diet (Scalar (TypeVar _ Nonunique _ _)) = Observe | 49 | diet (Scalar (TypeVar _ Nonunique _ _)) = Observe | 49 | false | false | 0 | 9 | 8 | 27 | 13 | 14 | null | null |
shlevy/ghc | compiler/specialise/Rules.hs | bsd-3-clause | roughTopName (Coercion _) = Nothing | 35 | roughTopName (Coercion _) = Nothing | 35 | roughTopName (Coercion _) = Nothing | 35 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
dorchard/gram_lang | frontend/src/Language/Granule/Checker/Flatten.hs | bsd-3-clause | -- Unifying with an interval
mguCoeffectTypes' s coeffTy1 coeffTy2@(isInterval -> Just t') | coeffTy1 == t' =
return $ Just (coeffTy2, (\x -> CInterval x x, id)) | 163 | mguCoeffectTypes' s coeffTy1 coeffTy2@(isInterval -> Just t') | coeffTy1 == t' =
return $ Just (coeffTy2, (\x -> CInterval x x, id)) | 134 | mguCoeffectTypes' s coeffTy1 coeffTy2@(isInterval -> Just t') | coeffTy1 == t' =
return $ Just (coeffTy2, (\x -> CInterval x x, id)) | 134 | true | false | 2 | 9 | 28 | 71 | 34 | 37 | null | null |
jhance/gba-hs | src/Game/GBA/RegisterSet.hs | mit | register' _ 9 = register9 | 25 | register' _ 9 = register9 | 25 | register' _ 9 = register9 | 25 | false | false | 1 | 5 | 4 | 12 | 5 | 7 | null | null |
romanb/amazonka | amazonka-ec2/gen/Network/AWS/EC2/ImportImage.hs | mpl-2.0 | -- | The client-specific data.
ii1ClientData :: Lens' ImportImage (Maybe ClientData)
ii1ClientData = lens _ii1ClientData (\s a -> s { _ii1ClientData = a }) | 155 | ii1ClientData :: Lens' ImportImage (Maybe ClientData)
ii1ClientData = lens _ii1ClientData (\s a -> s { _ii1ClientData = a }) | 124 | ii1ClientData = lens _ii1ClientData (\s a -> s { _ii1ClientData = a }) | 70 | true | true | 0 | 9 | 23 | 46 | 25 | 21 | null | null |
Peaker/lamdu | src/Lamdu/GUI/CodeEdit/GotoDefinition.hs | gpl-3.0 | makeOptions ::
( MonadReader env m, Has (Texts.Navigation Text) env, Has (Texts.Name Text) env
, M.HasCursor env, M.HasAnimIdPrefix env, Has Theme env, Has TextView.Style env
, Has Dir.Layout env
, Applicative o
) =>
Sugar.Globals Name m o -> SearchMenu.ResultsContext -> m (Menu.OptionList (Menu.Option m o))
makeOptions globals (SearchMenu.ResultsContext searchTerm prefix)
| Text.null searchTerm =
pure Menu.OptionList { Menu._olIsTruncated = False, Menu._olOptions = [] }
| otherwise =
do
env <- Lens.view id
let toRenderedOption nameRef widget =
Menu.RenderedOption
{ Menu._rWidget = widget
, Menu._rPick =
Widget.PreEvent
{ Widget._pDesc = env ^. has . Texts.goto
, Widget._pAction =
nameRef ^. Sugar.nrGotoDefinition
<&> WidgetIds.fromEntityId <&> toPickResult
, Widget._pTextRemainder = ""
}
}
let makeOption global =
Menu.Option
{ Menu._oId = optId
, Menu._oRender =
((TextView.make ?? global ^. globalPrefix)
<*> (Element.subAnimId ?? ["."]))
/|/
GetVarEdit.makeSimpleView (global ^. globalColor) name optId
<&> toRenderedOption (global ^. globalNameRef)
& local (M.animIdPrefix .~ Widget.toAnimId optId)
, Menu._oSubmenuWidgets = Menu.SubmenuEmpty
}
where
name = global ^. globalNameRef . Sugar.nrName
idx = global ^. globalIdx
optId = prefix `Widget.joinId` [BS8.pack (show idx)]
globs <-
case mTagPrefix of
Just tagPrefix ->
globals ^. Sugar.globalTags <&> map ((,,) (Text.singleton tagPrefix) TextColors.baseColor)
Nothing ->
(<>)
<$> (globals ^. Sugar.globalDefs <&> map ((,,) "" TextColors.definitionColor))
<*> (globals ^. Sugar.globalNominals <&> map ((,,) "" TextColors.nomColor))
Lens.imap toGlobal globs
& traverse withText
<&> (Fuzzy.memoableMake fuzzyMaker ?? searchTerm)
<&> map (makeOption . snd)
<&> Menu.OptionList isTruncated
where
mTagPrefix = getTagPrefix searchTerm
isTruncated = False
withText global =
nameToText (global ^. globalNameRef . Sugar.nrName) <&>
\text -> (maybe id Text.cons mTagPrefix text, global)
toPickResult x = Menu.PickResult x (Just x) | 2,944 | makeOptions ::
( MonadReader env m, Has (Texts.Navigation Text) env, Has (Texts.Name Text) env
, M.HasCursor env, M.HasAnimIdPrefix env, Has Theme env, Has TextView.Style env
, Has Dir.Layout env
, Applicative o
) =>
Sugar.Globals Name m o -> SearchMenu.ResultsContext -> m (Menu.OptionList (Menu.Option m o))
makeOptions globals (SearchMenu.ResultsContext searchTerm prefix)
| Text.null searchTerm =
pure Menu.OptionList { Menu._olIsTruncated = False, Menu._olOptions = [] }
| otherwise =
do
env <- Lens.view id
let toRenderedOption nameRef widget =
Menu.RenderedOption
{ Menu._rWidget = widget
, Menu._rPick =
Widget.PreEvent
{ Widget._pDesc = env ^. has . Texts.goto
, Widget._pAction =
nameRef ^. Sugar.nrGotoDefinition
<&> WidgetIds.fromEntityId <&> toPickResult
, Widget._pTextRemainder = ""
}
}
let makeOption global =
Menu.Option
{ Menu._oId = optId
, Menu._oRender =
((TextView.make ?? global ^. globalPrefix)
<*> (Element.subAnimId ?? ["."]))
/|/
GetVarEdit.makeSimpleView (global ^. globalColor) name optId
<&> toRenderedOption (global ^. globalNameRef)
& local (M.animIdPrefix .~ Widget.toAnimId optId)
, Menu._oSubmenuWidgets = Menu.SubmenuEmpty
}
where
name = global ^. globalNameRef . Sugar.nrName
idx = global ^. globalIdx
optId = prefix `Widget.joinId` [BS8.pack (show idx)]
globs <-
case mTagPrefix of
Just tagPrefix ->
globals ^. Sugar.globalTags <&> map ((,,) (Text.singleton tagPrefix) TextColors.baseColor)
Nothing ->
(<>)
<$> (globals ^. Sugar.globalDefs <&> map ((,,) "" TextColors.definitionColor))
<*> (globals ^. Sugar.globalNominals <&> map ((,,) "" TextColors.nomColor))
Lens.imap toGlobal globs
& traverse withText
<&> (Fuzzy.memoableMake fuzzyMaker ?? searchTerm)
<&> map (makeOption . snd)
<&> Menu.OptionList isTruncated
where
mTagPrefix = getTagPrefix searchTerm
isTruncated = False
withText global =
nameToText (global ^. globalNameRef . Sugar.nrName) <&>
\text -> (maybe id Text.cons mTagPrefix text, global)
toPickResult x = Menu.PickResult x (Just x) | 2,944 | makeOptions globals (SearchMenu.ResultsContext searchTerm prefix)
| Text.null searchTerm =
pure Menu.OptionList { Menu._olIsTruncated = False, Menu._olOptions = [] }
| otherwise =
do
env <- Lens.view id
let toRenderedOption nameRef widget =
Menu.RenderedOption
{ Menu._rWidget = widget
, Menu._rPick =
Widget.PreEvent
{ Widget._pDesc = env ^. has . Texts.goto
, Widget._pAction =
nameRef ^. Sugar.nrGotoDefinition
<&> WidgetIds.fromEntityId <&> toPickResult
, Widget._pTextRemainder = ""
}
}
let makeOption global =
Menu.Option
{ Menu._oId = optId
, Menu._oRender =
((TextView.make ?? global ^. globalPrefix)
<*> (Element.subAnimId ?? ["."]))
/|/
GetVarEdit.makeSimpleView (global ^. globalColor) name optId
<&> toRenderedOption (global ^. globalNameRef)
& local (M.animIdPrefix .~ Widget.toAnimId optId)
, Menu._oSubmenuWidgets = Menu.SubmenuEmpty
}
where
name = global ^. globalNameRef . Sugar.nrName
idx = global ^. globalIdx
optId = prefix `Widget.joinId` [BS8.pack (show idx)]
globs <-
case mTagPrefix of
Just tagPrefix ->
globals ^. Sugar.globalTags <&> map ((,,) (Text.singleton tagPrefix) TextColors.baseColor)
Nothing ->
(<>)
<$> (globals ^. Sugar.globalDefs <&> map ((,,) "" TextColors.definitionColor))
<*> (globals ^. Sugar.globalNominals <&> map ((,,) "" TextColors.nomColor))
Lens.imap toGlobal globs
& traverse withText
<&> (Fuzzy.memoableMake fuzzyMaker ?? searchTerm)
<&> map (makeOption . snd)
<&> Menu.OptionList isTruncated
where
mTagPrefix = getTagPrefix searchTerm
isTruncated = False
withText global =
nameToText (global ^. globalNameRef . Sugar.nrName) <&>
\text -> (maybe id Text.cons mTagPrefix text, global)
toPickResult x = Menu.PickResult x (Just x) | 2,610 | false | true | 0 | 21 | 1,220 | 759 | 389 | 370 | null | null |
deminvalentin/sudoku | app/Main.hs | bsd-3-clause | readMbD '3' = Just D3 | 21 | readMbD '3' = Just D3 | 21 | readMbD '3' = Just D3 | 21 | false | false | 1 | 5 | 4 | 15 | 5 | 10 | null | null |
xenog/haskoin | src/Network/Haskoin/Transaction/Builder.hs | unlicense | buildTx :: [OutPoint] -> [(ScriptOutput, Word64)] -> Either String Tx
buildTx xs ys =
mapM fo ys >>= \os -> return $ Tx 1 (map fi xs) os [] 0
where
fi outPoint = TxIn outPoint BS.empty maxBound
fo (o, v)
| v <= 2100000000000000 = return $ TxOut v $ encodeOutputBS o
| otherwise =
Left $ "buildTx: Invalid amount " ++ show v
-- | Data type used to specify the signing parameters of a transaction input.
-- To sign an input, the previous output script, outpoint and sighash are
-- required. When signing a pay to script hash output, an additional redeem
-- script is required. | 617 | buildTx :: [OutPoint] -> [(ScriptOutput, Word64)] -> Either String Tx
buildTx xs ys =
mapM fo ys >>= \os -> return $ Tx 1 (map fi xs) os [] 0
where
fi outPoint = TxIn outPoint BS.empty maxBound
fo (o, v)
| v <= 2100000000000000 = return $ TxOut v $ encodeOutputBS o
| otherwise =
Left $ "buildTx: Invalid amount " ++ show v
-- | Data type used to specify the signing parameters of a transaction input.
-- To sign an input, the previous output script, outpoint and sighash are
-- required. When signing a pay to script hash output, an additional redeem
-- script is required. | 617 | buildTx xs ys =
mapM fo ys >>= \os -> return $ Tx 1 (map fi xs) os [] 0
where
fi outPoint = TxIn outPoint BS.empty maxBound
fo (o, v)
| v <= 2100000000000000 = return $ TxOut v $ encodeOutputBS o
| otherwise =
Left $ "buildTx: Invalid amount " ++ show v
-- | Data type used to specify the signing parameters of a transaction input.
-- To sign an input, the previous output script, outpoint and sighash are
-- required. When signing a pay to script hash output, an additional redeem
-- script is required. | 547 | false | true | 0 | 10 | 151 | 162 | 81 | 81 | null | null |
UCSD-PL/RefScript | src/Language/Rsc/Liquid/Checker.hs | bsd-3-clause | consExpr g (NewExpr l e es) s
= mseq (consExpr g e Nothing) $ \(x,g1) -> do
t <- safeEnvFindTy l g1 x
case extractCtor g1 t of
Just ct ->
let ct' = substThisCtor ct in
mseq (consCall g1 l (builtinOpId BICtor) (es `zip` nths) ct') $ \(x, g2) -> do
tNew <- safeEnvFindTy l g2 x
tNew' <- pure (adjustCtxMut tNew s)
tNew'' <- pure (substThis (rTypeValueVar tNew') tNew')
Just <$> cgEnvAddFresh "18" l g2 tNew''
Nothing ->
cgError $ errorConstrMissing (srcPos l) t
-- | super
-- | 604 | consExpr g (NewExpr l e es) s
= mseq (consExpr g e Nothing) $ \(x,g1) -> do
t <- safeEnvFindTy l g1 x
case extractCtor g1 t of
Just ct ->
let ct' = substThisCtor ct in
mseq (consCall g1 l (builtinOpId BICtor) (es `zip` nths) ct') $ \(x, g2) -> do
tNew <- safeEnvFindTy l g2 x
tNew' <- pure (adjustCtxMut tNew s)
tNew'' <- pure (substThis (rTypeValueVar tNew') tNew')
Just <$> cgEnvAddFresh "18" l g2 tNew''
Nothing ->
cgError $ errorConstrMissing (srcPos l) t
-- | super
-- | 604 | consExpr g (NewExpr l e es) s
= mseq (consExpr g e Nothing) $ \(x,g1) -> do
t <- safeEnvFindTy l g1 x
case extractCtor g1 t of
Just ct ->
let ct' = substThisCtor ct in
mseq (consCall g1 l (builtinOpId BICtor) (es `zip` nths) ct') $ \(x, g2) -> do
tNew <- safeEnvFindTy l g2 x
tNew' <- pure (adjustCtxMut tNew s)
tNew'' <- pure (substThis (rTypeValueVar tNew') tNew')
Just <$> cgEnvAddFresh "18" l g2 tNew''
Nothing ->
cgError $ errorConstrMissing (srcPos l) t
-- | super
-- | 604 | false | false | 0 | 23 | 220 | 242 | 117 | 125 | null | null |
athanclark/digestive-functors-lucid | src/Text/Digestive/Lucid/Html5.hs | bsd-3-clause | childErrorList :: Monad m => Text -> View (HtmlT m ()) -> HtmlT m ()
childErrorList ref view = case childErrors ref view of
[] -> mempty
errs -> ul_ [class_ "digestive-functors-error-list"] $ forM_ errs $ \e ->
li_ [class_ "digestive-functors-error"] e | 276 | childErrorList :: Monad m => Text -> View (HtmlT m ()) -> HtmlT m ()
childErrorList ref view = case childErrors ref view of
[] -> mempty
errs -> ul_ [class_ "digestive-functors-error-list"] $ forM_ errs $ \e ->
li_ [class_ "digestive-functors-error"] e | 276 | childErrorList ref view = case childErrors ref view of
[] -> mempty
errs -> ul_ [class_ "digestive-functors-error-list"] $ forM_ errs $ \e ->
li_ [class_ "digestive-functors-error"] e | 207 | false | true | 0 | 12 | 65 | 114 | 53 | 61 | null | null |
jwiegley/ghc-release | libraries/Cabal/cabal-install/Distribution/Client/Upload.hs | gpl-3.0 | mkRequest :: URI -> FilePath -> IO (Request String)
mkRequest uri path =
do pkg <- readBinaryFile path
boundary <- genBoundary
let body = printMultiPart boundary (mkFormData path pkg)
return $ Request {
rqURI = uri,
rqMethod = POST,
rqHeaders = [Header HdrContentType ("multipart/form-data; boundary="++boundary),
Header HdrContentLength (show (length body)),
Header HdrAccept ("text/plain")],
rqBody = body
} | 635 | mkRequest :: URI -> FilePath -> IO (Request String)
mkRequest uri path =
do pkg <- readBinaryFile path
boundary <- genBoundary
let body = printMultiPart boundary (mkFormData path pkg)
return $ Request {
rqURI = uri,
rqMethod = POST,
rqHeaders = [Header HdrContentType ("multipart/form-data; boundary="++boundary),
Header HdrContentLength (show (length body)),
Header HdrAccept ("text/plain")],
rqBody = body
} | 635 | mkRequest uri path =
do pkg <- readBinaryFile path
boundary <- genBoundary
let body = printMultiPart boundary (mkFormData path pkg)
return $ Request {
rqURI = uri,
rqMethod = POST,
rqHeaders = [Header HdrContentType ("multipart/form-data; boundary="++boundary),
Header HdrContentLength (show (length body)),
Header HdrAccept ("text/plain")],
rqBody = body
} | 583 | false | true | 0 | 16 | 282 | 156 | 78 | 78 | null | null |
DaMSL/K3 | src/Language/K3/Codegen/CPP/Declaration.hs | apache-2.0 | declaration (tag -> DRole _) = throwE $ CPPGenE "Roles below top-level are deprecated." | 87 | declaration (tag -> DRole _) = throwE $ CPPGenE "Roles below top-level are deprecated." | 87 | declaration (tag -> DRole _) = throwE $ CPPGenE "Roles below top-level are deprecated." | 87 | false | false | 0 | 8 | 13 | 26 | 12 | 14 | null | null |
brendanhay/gogol | gogol-androidmanagement/gen/Network/Google/AndroidManagement/Types/Product.hs | mpl-2.0 | -- | The package name of the app that installed this app.
arInstallerPackageName :: Lens' ApplicationReport (Maybe Text)
arInstallerPackageName
= lens _arInstallerPackageName
(\ s a -> s{_arInstallerPackageName = a}) | 224 | arInstallerPackageName :: Lens' ApplicationReport (Maybe Text)
arInstallerPackageName
= lens _arInstallerPackageName
(\ s a -> s{_arInstallerPackageName = a}) | 166 | arInstallerPackageName
= lens _arInstallerPackageName
(\ s a -> s{_arInstallerPackageName = a}) | 103 | true | true | 0 | 8 | 36 | 49 | 25 | 24 | null | null |
kirstin-rhys/nestedmap | src/Data/Nested/Internal.hs | bsd-3-clause | memberTree ∷ (Traversable φ, Ord κ) ⇒ Tree κ α → φ κ → φ Bool
memberTree t = (isJust <$>) ∘ snd ∘ lookupTree t | 110 | memberTree ∷ (Traversable φ, Ord κ) ⇒ Tree κ α → φ κ → φ Bool
memberTree t = (isJust <$>) ∘ snd ∘ lookupTree t | 110 | memberTree t = (isJust <$>) ∘ snd ∘ lookupTree t | 48 | false | true | 0 | 8 | 25 | 63 | 31 | 32 | null | null |
spechub/Hets | OWL2/ShipSyntax.hs | gpl-2.0 | ppp :: (a -> Doc) -> CharParser () a -> String -> String
ppp pr pa s = case parse (skip >> pa << eof) "" s of
Right a -> show $ pr a
Left e -> show e | 153 | ppp :: (a -> Doc) -> CharParser () a -> String -> String
ppp pr pa s = case parse (skip >> pa << eof) "" s of
Right a -> show $ pr a
Left e -> show e | 153 | ppp pr pa s = case parse (skip >> pa << eof) "" s of
Right a -> show $ pr a
Left e -> show e | 96 | false | true | 0 | 9 | 43 | 98 | 46 | 52 | null | null |
sheyll/b9-vm-image-builder | src/lib/B9/Artifact/Content/ErlTerms.hs | mit | prettyPrintErlTerm (ErlChar c) = PP.text ("$" ++ toErlAtomChar c) | 65 | prettyPrintErlTerm (ErlChar c) = PP.text ("$" ++ toErlAtomChar c) | 65 | prettyPrintErlTerm (ErlChar c) = PP.text ("$" ++ toErlAtomChar c) | 65 | false | false | 0 | 8 | 8 | 30 | 14 | 16 | null | null |
kovach/tm | src/Log2.hs | mit | sep1 a b = show a ++ ", " ++ b | 30 | sep1 a b = show a ++ ", " ++ b | 30 | sep1 a b = show a ++ ", " ++ b | 30 | false | false | 0 | 7 | 10 | 22 | 10 | 12 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.