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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Nathan-Fenner/New-Nickel | Scope.hs | mit | freezeVariable' :: String -> Scope -> Scope
freezeVariable' name scope = scope { scopeFrozenStack = name : scopeFrozenStack scope } | 131 | freezeVariable' :: String -> Scope -> Scope
freezeVariable' name scope = scope { scopeFrozenStack = name : scopeFrozenStack scope } | 131 | freezeVariable' name scope = scope { scopeFrozenStack = name : scopeFrozenStack scope } | 87 | false | true | 0 | 8 | 19 | 39 | 20 | 19 | null | null |
kvelicka/Fizz | CellTypes.hs | lgpl-2.1 | locateTetra n C = Vertex3 (2*n) 0.0 0.0 | 40 | locateTetra n C = Vertex3 (2*n) 0.0 0.0 | 40 | locateTetra n C = Vertex3 (2*n) 0.0 0.0 | 40 | false | false | 0 | 7 | 8 | 25 | 12 | 13 | null | null |
amccausl/Swish | Swish/HaskellUtils/ParseURI.hs | lgpl-2.1 | countMax n p
| n > 0 = opt ( p >++> ( countMax (n-1) p ) )
| otherwise = parseReturn [] | 109 | countMax n p
| n > 0 = opt ( p >++> ( countMax (n-1) p ) )
| otherwise = parseReturn [] | 109 | countMax n p
| n > 0 = opt ( p >++> ( countMax (n-1) p ) )
| otherwise = parseReturn [] | 109 | false | false | 0 | 12 | 44 | 66 | 30 | 36 | null | null |
drbean/pdrt-sandbox | src/Data/DRS/Show.hs | apache-2.0 | showWhitespace :: Int -> String
showWhitespace l = replicate l ' ' | 66 | showWhitespace :: Int -> String
showWhitespace l = replicate l ' ' | 66 | showWhitespace l = replicate l ' ' | 34 | false | true | 0 | 5 | 11 | 23 | 11 | 12 | null | null |
jfcmacro/calc | src/Language/Calc/Eval.hs | bsd-3-clause | evalExpr :: Expr -> EvalState Int
evalExpr (EInt i) = return $ i | 64 | evalExpr :: Expr -> EvalState Int
evalExpr (EInt i) = return $ i | 64 | evalExpr (EInt i) = return $ i | 30 | false | true | 0 | 7 | 12 | 31 | 15 | 16 | null | null |
aconbere/Hed | Hed/Buffer.hs | mit | dropAlphaNums = dropInNumbered isAlphaNum | 41 | dropAlphaNums = dropInNumbered isAlphaNum | 41 | dropAlphaNums = dropInNumbered isAlphaNum | 41 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
AlexeyRaga/eta | compiler/ETA/CodeGen/Types.hs | bsd-3-clause | mkCgIdInfo :: DynFlags -> Id -> LambdaFormInfo -> CgIdInfo
mkCgIdInfo dflags id lfInfo =
CgIdInfo { cgId = id
, cgLambdaForm = lfInfo
, cgLocation = loc }
where loc = mkStaticLoc dflags id lfInfo | 221 | mkCgIdInfo :: DynFlags -> Id -> LambdaFormInfo -> CgIdInfo
mkCgIdInfo dflags id lfInfo =
CgIdInfo { cgId = id
, cgLambdaForm = lfInfo
, cgLocation = loc }
where loc = mkStaticLoc dflags id lfInfo | 221 | mkCgIdInfo dflags id lfInfo =
CgIdInfo { cgId = id
, cgLambdaForm = lfInfo
, cgLocation = loc }
where loc = mkStaticLoc dflags id lfInfo | 162 | false | true | 0 | 7 | 60 | 65 | 35 | 30 | null | null |
fferreira/hnh | InferDeclaration.hs | gpl-3.0 | typeExp _ e = return e | 22 | typeExp _ e = return e | 22 | typeExp _ e = return e | 22 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
micxjo/hs-advent | src/Advent/Day8.hs | bsd-3-clause | charCount :: Text -> Int
charCount text = (codeChars text) - (memChars text) | 76 | charCount :: Text -> Int
charCount text = (codeChars text) - (memChars text) | 76 | charCount text = (codeChars text) - (memChars text) | 51 | false | true | 0 | 7 | 12 | 34 | 17 | 17 | null | null |
peterokagey/haskellOEIS | test/Tables/A284530Spec.hs | apache-2.0 | main :: IO ()
main = hspec spec | 31 | main :: IO ()
main = hspec spec | 31 | main = hspec spec | 17 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
ganeti-github-testing/ganeti-test-1 | src/Ganeti/WConfd/TempRes.hs | bsd-2-clause | -- | Computes the set of all reserved resources and passes it to
-- the given function.
-- This allows it to avoid resources that are already in use.
withReserved :: (MonadError GanetiException m, Show a, Ord a, Ord j)
=> j -> (S.Set a -> m a) -> TempRes j a -> m (a, TempRes j a)
withReserved jobid genfn tr = do
x <- genfn (reserved tr)
(,) x `liftM` reserve jobid x tr
-- | Repeatedly tries to run a given monadic function until it succeeds
-- and the returned value is free to reserve.
-- If such a value is found, it's reserved and returned.
-- Otherwise fails with an error. | 598 | withReserved :: (MonadError GanetiException m, Show a, Ord a, Ord j)
=> j -> (S.Set a -> m a) -> TempRes j a -> m (a, TempRes j a)
withReserved jobid genfn tr = do
x <- genfn (reserved tr)
(,) x `liftM` reserve jobid x tr
-- | Repeatedly tries to run a given monadic function until it succeeds
-- and the returned value is free to reserve.
-- If such a value is found, it's reserved and returned.
-- Otherwise fails with an error. | 448 | withReserved jobid genfn tr = do
x <- genfn (reserved tr)
(,) x `liftM` reserve jobid x tr
-- | Repeatedly tries to run a given monadic function until it succeeds
-- and the returned value is free to reserve.
-- If such a value is found, it's reserved and returned.
-- Otherwise fails with an error. | 304 | true | true | 0 | 11 | 132 | 138 | 71 | 67 | null | null |
sighingnow/Functional-99-Problems | Haskell/09.hs | mit | pack' :: Eq a => [a] -> [[a]]
pack' [] = [] | 44 | pack' :: Eq a => [a] -> [[a]]
pack' [] = [] | 43 | pack' [] = [] | 13 | false | true | 0 | 10 | 12 | 44 | 21 | 23 | null | null |
dmjio/BerkeleyDB | src/Data/BerkeleyDB.hs | bsd-3-clause | -- | /O(n)/. Filter all keys\/values that satisfy the predicate.
filterWithKey :: (Binary k, Binary a) => (k -> a -> Bool) -> Db k a -> Db k a
filterWithKey p Empty = Empty | 172 | filterWithKey :: (Binary k, Binary a) => (k -> a -> Bool) -> Db k a -> Db k a
filterWithKey p Empty = Empty | 107 | filterWithKey p Empty = Empty | 29 | true | true | 0 | 10 | 34 | 66 | 32 | 34 | null | null |
kovach/web | res0/Interpreter.hs | gpl-2.0 | stepEff (c, web) (Del (ERef r)) =
(c, delNode r web) | 54 | stepEff (c, web) (Del (ERef r)) =
(c, delNode r web) | 54 | stepEff (c, web) (Del (ERef r)) =
(c, delNode r web) | 54 | false | false | 0 | 9 | 12 | 40 | 21 | 19 | null | null |
hvr/cryptohash-sha256 | src/Crypto/Hash/SHA256.hs | bsd-3-clause | -- | updates a context with multiple bytestrings
updates :: Ctx -> [ByteString] -> Ctx
updates ctx d
| validCtx ctx = unsafeDoIO $ withCtxCopy ctx $ \ptr -> mapM_ (updateInternalIO ptr) d
| otherwise = error "SHA256.updates: invalid Ctx" | 244 | updates :: Ctx -> [ByteString] -> Ctx
updates ctx d
| validCtx ctx = unsafeDoIO $ withCtxCopy ctx $ \ptr -> mapM_ (updateInternalIO ptr) d
| otherwise = error "SHA256.updates: invalid Ctx" | 195 | updates ctx d
| validCtx ctx = unsafeDoIO $ withCtxCopy ctx $ \ptr -> mapM_ (updateInternalIO ptr) d
| otherwise = error "SHA256.updates: invalid Ctx" | 157 | true | true | 1 | 10 | 46 | 74 | 36 | 38 | null | null |
tsahyt/clingo-haskell | src/Clingo/Internal/AST.hs | mit | fromRawBodyLiteral (AstBodyConditional l x) = BodyConditional
<$> fromRawLocation l <*> fromIndirect x fromRawConditionalLiteral | 132 | fromRawBodyLiteral (AstBodyConditional l x) = BodyConditional
<$> fromRawLocation l <*> fromIndirect x fromRawConditionalLiteral | 132 | fromRawBodyLiteral (AstBodyConditional l x) = BodyConditional
<$> fromRawLocation l <*> fromIndirect x fromRawConditionalLiteral | 132 | false | false | 2 | 7 | 16 | 34 | 15 | 19 | null | null |
peterson/lets-tree | src/Lets/RoseTree.hs | bsd-3-clause | value (Node v _) = Just v | 25 | value (Node v _) = Just v | 25 | value (Node v _) = Just v | 25 | false | false | 0 | 6 | 6 | 21 | 9 | 12 | null | null |
gsdlab/clafer | src/Language/Clafer/Intermediate/Desugarer.hs | mit | -- will never sugar to QuantNOT
sugarQuant ILone = QuantLone noSpan | 67 | sugarQuant ILone = QuantLone noSpan | 35 | sugarQuant ILone = QuantLone noSpan | 35 | true | false | 0 | 5 | 10 | 13 | 6 | 7 | null | null |
spechub/Hets | CSL/Interpreter.hs | gpl-2.0 | loadAS :: AssignmentStore m => [(ConstantName, AssDefinition)] -> m ()
loadAS = assigns . reverse | 97 | loadAS :: AssignmentStore m => [(ConstantName, AssDefinition)] -> m ()
loadAS = assigns . reverse | 97 | loadAS = assigns . reverse | 26 | false | true | 1 | 9 | 14 | 47 | 22 | 25 | null | null |
nushio3/ghc | compiler/stranal/DmdAnal.hs | bsd-3-clause | setBndrsDemandInfo bs _ = pprPanic "setBndrsDemandInfo" (ppr bs) | 65 | setBndrsDemandInfo bs _ = pprPanic "setBndrsDemandInfo" (ppr bs) | 65 | setBndrsDemandInfo bs _ = pprPanic "setBndrsDemandInfo" (ppr bs) | 65 | false | false | 0 | 7 | 8 | 23 | 10 | 13 | null | null |
noughtmare/yi | yi-core/src/Yi/Syntax/Tree.hs | gpl-2.0 | fromNodeToFinal :: IsTree tree => Region -> Node (tree (Tok a))
-> Node (tree (Tok a))
fromNodeToFinal r (xs,root) =
trace ("r = " <> showT r) $
trace ("focused ~ " <> showT (subtreeRegion focused) ) $
trace ("pathFromFocusedToLeaf = " <> showT focusedToLeaf) $
trace ("pruned ~ " <> showT (subtreeRegion focused)) (xs', pruned)
where n@(xs',_) = fromLeafToLeafAfter (regionEnd r) (xs,root)
(_,(focusedToLeaf,focused)) = fromLeafAfterToFinal p0 n
p0 = regionStart r
pruned = pruneNodesBefore p0 focusedToLeaf focused
-- | Return the first element that matches the predicate, or the last
-- of the list if none matches. | 686 | fromNodeToFinal :: IsTree tree => Region -> Node (tree (Tok a))
-> Node (tree (Tok a))
fromNodeToFinal r (xs,root) =
trace ("r = " <> showT r) $
trace ("focused ~ " <> showT (subtreeRegion focused) ) $
trace ("pathFromFocusedToLeaf = " <> showT focusedToLeaf) $
trace ("pruned ~ " <> showT (subtreeRegion focused)) (xs', pruned)
where n@(xs',_) = fromLeafToLeafAfter (regionEnd r) (xs,root)
(_,(focusedToLeaf,focused)) = fromLeafAfterToFinal p0 n
p0 = regionStart r
pruned = pruneNodesBefore p0 focusedToLeaf focused
-- | Return the first element that matches the predicate, or the last
-- of the list if none matches. | 686 | fromNodeToFinal r (xs,root) =
trace ("r = " <> showT r) $
trace ("focused ~ " <> showT (subtreeRegion focused) ) $
trace ("pathFromFocusedToLeaf = " <> showT focusedToLeaf) $
trace ("pruned ~ " <> showT (subtreeRegion focused)) (xs', pruned)
where n@(xs',_) = fromLeafToLeafAfter (regionEnd r) (xs,root)
(_,(focusedToLeaf,focused)) = fromLeafAfterToFinal p0 n
p0 = regionStart r
pruned = pruneNodesBefore p0 focusedToLeaf focused
-- | Return the first element that matches the predicate, or the last
-- of the list if none matches. | 583 | false | true | 3 | 13 | 165 | 229 | 118 | 111 | null | null |
mzero/plush | src/Plush/Run/BuiltIns.hs | apache-2.0 | -- | Utilities that are only available as executables from the TestExec monad.
otherBuiltins :: (PosixLike m) => [(String, BuiltInUtility m)]
otherBuiltins =
[ ("cat", cat)
-- , ("egrep", egrep) -- TODO: enable once regular expressions are implemented
, ("fgrep", fgrep)
-- , ("grep", grep) -- TODO: enable once regular expressions are implemented
, ("mkdir", mkdir)
, ("rm", rm)
, ("touch", touch)
, ("tr", tr)
] | 447 | otherBuiltins :: (PosixLike m) => [(String, BuiltInUtility m)]
otherBuiltins =
[ ("cat", cat)
-- , ("egrep", egrep) -- TODO: enable once regular expressions are implemented
, ("fgrep", fgrep)
-- , ("grep", grep) -- TODO: enable once regular expressions are implemented
, ("mkdir", mkdir)
, ("rm", rm)
, ("touch", touch)
, ("tr", tr)
] | 368 | otherBuiltins =
[ ("cat", cat)
-- , ("egrep", egrep) -- TODO: enable once regular expressions are implemented
, ("fgrep", fgrep)
-- , ("grep", grep) -- TODO: enable once regular expressions are implemented
, ("mkdir", mkdir)
, ("rm", rm)
, ("touch", touch)
, ("tr", tr)
] | 305 | true | true | 0 | 10 | 99 | 96 | 58 | 38 | null | null |
xu-hao/QueryArrow | QueryArrow-db-cypher/src/QueryArrow/Cypher/SQLToCypher.hs | bsd-3-clause | -- | a node of type `nodetype` one or more properties
mappingPattern5 :: [ColI] -> [ColI] -> [ColI] -> [ColI] -> String -> [ColI] -> [ColI] -> CypherMapping
mappingPattern5 keyedges keyids propedges propids nodetype keyprops propprops =
(
map (CypherVar . show) [1..length keyprops + length keyedges + length propedges + length propprops],
GraphPattern (propPatternNode nodetype keyprops : nodePattern (propids ++ keyids) ++ edgePattern keyedges),
GraphPattern (propPatternNode nodetype propprops : edgePattern propedges),
[(CypherVar "d0", vars (keyids ++ keyprops))]
) | 610 | mappingPattern5 :: [ColI] -> [ColI] -> [ColI] -> [ColI] -> String -> [ColI] -> [ColI] -> CypherMapping
mappingPattern5 keyedges keyids propedges propids nodetype keyprops propprops =
(
map (CypherVar . show) [1..length keyprops + length keyedges + length propedges + length propprops],
GraphPattern (propPatternNode nodetype keyprops : nodePattern (propids ++ keyids) ++ edgePattern keyedges),
GraphPattern (propPatternNode nodetype propprops : edgePattern propedges),
[(CypherVar "d0", vars (keyids ++ keyprops))]
) | 556 | mappingPattern5 keyedges keyids propedges propids nodetype keyprops propprops =
(
map (CypherVar . show) [1..length keyprops + length keyedges + length propedges + length propprops],
GraphPattern (propPatternNode nodetype keyprops : nodePattern (propids ++ keyids) ++ edgePattern keyedges),
GraphPattern (propPatternNode nodetype propprops : edgePattern propedges),
[(CypherVar "d0", vars (keyids ++ keyprops))]
) | 453 | true | true | 0 | 12 | 118 | 198 | 102 | 96 | null | null |
Sgoettschkes/learning | haskell/ProjectEuler/src/Problems/Problem015.hs | mit | p15 :: Integer
p15 = fact 40 `div` (fact 20 * fact 20) | 54 | p15 :: Integer
p15 = fact 40 `div` (fact 20 * fact 20) | 54 | p15 = fact 40 `div` (fact 20 * fact 20) | 39 | false | true | 0 | 9 | 12 | 40 | 18 | 22 | null | null |
apyrgio/ganeti | src/Ganeti/HTools/Backend/IAlloc.hs | bsd-2-clause | runIAllocator :: AlgorithmOptions
-> Request -> (Maybe (Node.List, Instance.List), String)
runIAllocator opts request =
let (ok, info, result, cdata) =
case processRequest opts request of
Ok (msg, r, nl, il) -> (True, "Request successful: " ++ msg, r,
Just (nl, il))
Bad msg -> (False, "Request failed: " ++ msg, JSArray [], Nothing)
rstring = formatResponse ok info result
in (cdata, rstring) | 479 | runIAllocator :: AlgorithmOptions
-> Request -> (Maybe (Node.List, Instance.List), String)
runIAllocator opts request =
let (ok, info, result, cdata) =
case processRequest opts request of
Ok (msg, r, nl, il) -> (True, "Request successful: " ++ msg, r,
Just (nl, il))
Bad msg -> (False, "Request failed: " ++ msg, JSArray [], Nothing)
rstring = formatResponse ok info result
in (cdata, rstring) | 479 | runIAllocator opts request =
let (ok, info, result, cdata) =
case processRequest opts request of
Ok (msg, r, nl, il) -> (True, "Request successful: " ++ msg, r,
Just (nl, il))
Bad msg -> (False, "Request failed: " ++ msg, JSArray [], Nothing)
rstring = formatResponse ok info result
in (cdata, rstring) | 374 | false | true | 0 | 14 | 147 | 170 | 93 | 77 | null | null |
conal/reification-rules | test/RuleTest.hs | bsd-3-clause | abstP4 :: (HasRep p, Rep p ~ ((a,b),(c,d))) => EP (a -> b -> c -> d -> p)
abstP4 = reifyP (\ a b c d -> abst ((a,b),(c,d))) | 123 | abstP4 :: (HasRep p, Rep p ~ ((a,b),(c,d))) => EP (a -> b -> c -> d -> p)
abstP4 = reifyP (\ a b c d -> abst ((a,b),(c,d))) | 123 | abstP4 = reifyP (\ a b c d -> abst ((a,b),(c,d))) | 49 | false | true | 0 | 11 | 29 | 109 | 61 | 48 | null | null |
gcampax/ghc | compiler/rename/RnTypes.hs | bsd-3-clause | extractDataDefnKindVars :: HsDataDefn RdrName -> [RdrName]
-- Get the scoped kind variables mentioned free in the constructor decls
-- Eg data T a = T1 (S (a :: k) | forall (b::k). T2 (S b)
-- Here k should scope over the whole definition
extractDataDefnKindVars (HsDataDefn { dd_ctxt = ctxt, dd_kindSig = ksig
, dd_cons = cons, dd_derivs = derivs })
= fst $ extract_lctxt ctxt $
extract_mb extract_lkind ksig $
extract_mb (extract_ltys . unLoc) derivs $
foldr (extract_con . unLoc) ([],[]) cons
where
extract_con (ConDecl { con_res = ResTyGADT {} }) acc = acc
extract_con (ConDecl { con_res = ResTyH98, con_qvars = qvs
, con_cxt = ctxt, con_details = details }) acc
= extract_hs_tv_bndrs qvs acc $
extract_lctxt ctxt $
extract_ltys (hsConDeclArgTys details) ([],[]) | 894 | extractDataDefnKindVars :: HsDataDefn RdrName -> [RdrName]
extractDataDefnKindVars (HsDataDefn { dd_ctxt = ctxt, dd_kindSig = ksig
, dd_cons = cons, dd_derivs = derivs })
= fst $ extract_lctxt ctxt $
extract_mb extract_lkind ksig $
extract_mb (extract_ltys . unLoc) derivs $
foldr (extract_con . unLoc) ([],[]) cons
where
extract_con (ConDecl { con_res = ResTyGADT {} }) acc = acc
extract_con (ConDecl { con_res = ResTyH98, con_qvars = qvs
, con_cxt = ctxt, con_details = details }) acc
= extract_hs_tv_bndrs qvs acc $
extract_lctxt ctxt $
extract_ltys (hsConDeclArgTys details) ([],[]) | 711 | extractDataDefnKindVars (HsDataDefn { dd_ctxt = ctxt, dd_kindSig = ksig
, dd_cons = cons, dd_derivs = derivs })
= fst $ extract_lctxt ctxt $
extract_mb extract_lkind ksig $
extract_mb (extract_ltys . unLoc) derivs $
foldr (extract_con . unLoc) ([],[]) cons
where
extract_con (ConDecl { con_res = ResTyGADT {} }) acc = acc
extract_con (ConDecl { con_res = ResTyH98, con_qvars = qvs
, con_cxt = ctxt, con_details = details }) acc
= extract_hs_tv_bndrs qvs acc $
extract_lctxt ctxt $
extract_ltys (hsConDeclArgTys details) ([],[]) | 652 | true | true | 1 | 10 | 252 | 221 | 121 | 100 | null | null |
ben-schulz/Idris-dev | src/Idris/Core/Evaluate.hs | bsd-3-clause | normaliseTrace :: Bool -> Context -> Env -> TT Name -> TT Name
normaliseTrace tr ctxt env t
= evalState (do val <- eval tr ctxt [] (map finalEntry env) (finalise t) []
quote 0 val) initEval | 211 | normaliseTrace :: Bool -> Context -> Env -> TT Name -> TT Name
normaliseTrace tr ctxt env t
= evalState (do val <- eval tr ctxt [] (map finalEntry env) (finalise t) []
quote 0 val) initEval | 211 | normaliseTrace tr ctxt env t
= evalState (do val <- eval tr ctxt [] (map finalEntry env) (finalise t) []
quote 0 val) initEval | 148 | false | true | 0 | 12 | 58 | 102 | 46 | 56 | null | null |
christiaanb/Idris-dev | src/IRTS/Java/JTypes.hs | bsd-3-clause | constType (B64V v) = arithTyToJType (ATInt . ITVec IT64 $ V.length v) | 69 | constType (B64V v) = arithTyToJType (ATInt . ITVec IT64 $ V.length v) | 69 | constType (B64V v) = arithTyToJType (ATInt . ITVec IT64 $ V.length v) | 69 | false | false | 0 | 9 | 11 | 37 | 17 | 20 | null | null |
rodrigogribeiro/mptc | src/Language/Haskell/Exts/Annotated/ExactPrint.hs | bsd-3-clause | errorEP :: String -> EP a
errorEP = fail | 40 | errorEP :: String -> EP a
errorEP = fail | 40 | errorEP = fail | 14 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
Potregon/while | src/Parser/While.hs | gpl-3.0 | state states@(104:_) stack input = case headMay input of
Nothing -> reduce 20 states stack input
Just ( PosToken _ (Token ')') ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Times) ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Plus) ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Minus) ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp DivBy) ) -> reduce 20 states stack input
Just ( PosToken _ (Token ';') ) -> reduce 20 states stack input
Just ( PosToken _ (Token ']') ) -> reduce 20 states stack input
Just ( PosToken _ (Token '}') ) -> reduce 20 states stack input
Just ( PosToken _ (LogOp And) ) -> reduce 20 states stack input
Just ( PosToken _ Do ) -> reduce 20 states stack input
Just ( PosToken _ Else ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Mod) ) -> reduce 20 states stack input
Just ( PosToken _ (LogOp Or) ) -> reduce 20 states stack input
Just ( PosToken _ (RelOp _) ) -> reduce 20 states stack input
Just ( PosToken _ Then ) -> reduce 20 states stack input
_ -> error $ "unexpected " ++
if null input then "end of file" else show (head input)
++ "\nexpecting 'eof', ')', '*', '+', '-', '/', ';', ']', '}', and, do, else, mod, or, relop, then" | 1,295 | state states@(104:_) stack input = case headMay input of
Nothing -> reduce 20 states stack input
Just ( PosToken _ (Token ')') ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Times) ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Plus) ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Minus) ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp DivBy) ) -> reduce 20 states stack input
Just ( PosToken _ (Token ';') ) -> reduce 20 states stack input
Just ( PosToken _ (Token ']') ) -> reduce 20 states stack input
Just ( PosToken _ (Token '}') ) -> reduce 20 states stack input
Just ( PosToken _ (LogOp And) ) -> reduce 20 states stack input
Just ( PosToken _ Do ) -> reduce 20 states stack input
Just ( PosToken _ Else ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Mod) ) -> reduce 20 states stack input
Just ( PosToken _ (LogOp Or) ) -> reduce 20 states stack input
Just ( PosToken _ (RelOp _) ) -> reduce 20 states stack input
Just ( PosToken _ Then ) -> reduce 20 states stack input
_ -> error $ "unexpected " ++
if null input then "end of file" else show (head input)
++ "\nexpecting 'eof', ')', '*', '+', '-', '/', ';', ']', '}', and, do, else, mod, or, relop, then" | 1,295 | state states@(104:_) stack input = case headMay input of
Nothing -> reduce 20 states stack input
Just ( PosToken _ (Token ')') ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Times) ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Plus) ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Minus) ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp DivBy) ) -> reduce 20 states stack input
Just ( PosToken _ (Token ';') ) -> reduce 20 states stack input
Just ( PosToken _ (Token ']') ) -> reduce 20 states stack input
Just ( PosToken _ (Token '}') ) -> reduce 20 states stack input
Just ( PosToken _ (LogOp And) ) -> reduce 20 states stack input
Just ( PosToken _ Do ) -> reduce 20 states stack input
Just ( PosToken _ Else ) -> reduce 20 states stack input
Just ( PosToken _ (MathOp Mod) ) -> reduce 20 states stack input
Just ( PosToken _ (LogOp Or) ) -> reduce 20 states stack input
Just ( PosToken _ (RelOp _) ) -> reduce 20 states stack input
Just ( PosToken _ Then ) -> reduce 20 states stack input
_ -> error $ "unexpected " ++
if null input then "end of file" else show (head input)
++ "\nexpecting 'eof', ')', '*', '+', '-', '/', ';', ']', '}', and, do, else, mod, or, relop, then" | 1,295 | false | false | 1 | 13 | 310 | 544 | 256 | 288 | null | null |
brendanhay/gogol | gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/Placements/Insert.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
piUploadProtocol :: Lens' PlacementsInsert (Maybe Text)
piUploadProtocol
= lens _piUploadProtocol
(\ s a -> s{_piUploadProtocol = a}) | 203 | piUploadProtocol :: Lens' PlacementsInsert (Maybe Text)
piUploadProtocol
= lens _piUploadProtocol
(\ s a -> s{_piUploadProtocol = a}) | 141 | piUploadProtocol
= lens _piUploadProtocol
(\ s a -> s{_piUploadProtocol = a}) | 85 | true | true | 1 | 9 | 33 | 52 | 25 | 27 | null | null |
mzero/plush | src/Plush/Main.hs | apache-2.0 | processScript :: Options -> String -> IO ()
processScript opts script = do
r <- initialRunner opts
(st, _) <- run (runScript script) r
exitWith $ statusExitCode st
--
-- Web & Server Modes
-- | 204 | processScript :: Options -> String -> IO ()
processScript opts script = do
r <- initialRunner opts
(st, _) <- run (runScript script) r
exitWith $ statusExitCode st
--
-- Web & Server Modes
-- | 204 | processScript opts script = do
r <- initialRunner opts
(st, _) <- run (runScript script) r
exitWith $ statusExitCode st
--
-- Web & Server Modes
-- | 160 | false | true | 0 | 10 | 47 | 76 | 37 | 39 | null | null |
hvr/vector | Data/Vector/Unboxed.hs | bsd-3-clause | length = G.length | 17 | length = G.length | 17 | length = G.length | 17 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
phischu/fragnix | builtins/integer-gmp/GHC.Integer.Type.hs | bsd-3-clause | gcdInteger a@(S# _) b = gcdInteger b a | 38 | gcdInteger a@(S# _) b = gcdInteger b a | 38 | gcdInteger a@(S# _) b = gcdInteger b a | 38 | false | false | 0 | 8 | 7 | 25 | 12 | 13 | null | null |
mrmonday/Idris-dev | src/Idris/Primitives.hs | bsd-3-clause | bitBin (ITFixed IT32) op [B32 x, B32 y] = Just $ B32 (op x y) | 65 | bitBin (ITFixed IT32) op [B32 x, B32 y] = Just $ B32 (op x y) | 65 | bitBin (ITFixed IT32) op [B32 x, B32 y] = Just $ B32 (op x y) | 65 | false | false | 0 | 8 | 18 | 46 | 22 | 24 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/types/Kind.hs | bsd-3-clause | defaultKind_maybe :: Kind -> Maybe Kind
-- ^ Used when generalising: default OpenKind and ArgKind to *.
-- See "Type#kind_subtyping" for more information on what that means
-- When we generalise, we make generic type variables whose kind is
-- simple (* or *->* etc). So generic type variables (other than
-- built-in constants like 'error') always have simple kinds. This is important;
-- consider
-- f x = True
-- We want f to get type
-- f :: forall (a::*). a -> Bool
-- Not
-- f :: forall (a::ArgKind). a -> Bool
-- because that would allow a call like (f 3#) as well as (f True),
-- and the calling conventions differ.
-- This defaulting is done in TcMType.zonkTcTyVarBndr.
--
-- The test is really whether the kind is strictly above '*'
defaultKind_maybe (TyConApp kc _args)
| isOpenTypeKindCon kc = ASSERT( null _args ) Just liftedTypeKind | 866 | defaultKind_maybe :: Kind -> Maybe Kind
defaultKind_maybe (TyConApp kc _args)
| isOpenTypeKindCon kc = ASSERT( null _args ) Just liftedTypeKind | 145 | defaultKind_maybe (TyConApp kc _args)
| isOpenTypeKindCon kc = ASSERT( null _args ) Just liftedTypeKind | 105 | true | true | 0 | 8 | 169 | 67 | 39 | 28 | null | null |
diku-dk/futhark | src/Futhark/CodeGen/Backends/CCUDA.hs | isc | cudaMemoryType space =
error $ "CUDA backend does not support '" ++ space ++ "' memory space." | 96 | cudaMemoryType space =
error $ "CUDA backend does not support '" ++ space ++ "' memory space." | 96 | cudaMemoryType space =
error $ "CUDA backend does not support '" ++ space ++ "' memory space." | 96 | false | false | 0 | 7 | 18 | 21 | 10 | 11 | null | null |
themoritz/cabal | Cabal/Distribution/Types/LocalBuildInfo.hs | bsd-3-clause | componentNameCLBIs :: LocalBuildInfo -> ComponentName -> [ComponentLocalBuildInfo]
componentNameCLBIs lbi cname =
case Map.lookup cname (componentNameMap lbi) of
Just clbis -> clbis
Nothing -> []
-- TODO: Maybe cache topsort (Graph can do this)
-- | Return the list of default 'TargetInfo's associated with a
-- configured package, in the order they need to be built.
-- Has a prime because it takes a 'PackageDescription' argument
-- which may disagree with 'localPkgDescr' in 'LocalBuildInfo'. | 517 | componentNameCLBIs :: LocalBuildInfo -> ComponentName -> [ComponentLocalBuildInfo]
componentNameCLBIs lbi cname =
case Map.lookup cname (componentNameMap lbi) of
Just clbis -> clbis
Nothing -> []
-- TODO: Maybe cache topsort (Graph can do this)
-- | Return the list of default 'TargetInfo's associated with a
-- configured package, in the order they need to be built.
-- Has a prime because it takes a 'PackageDescription' argument
-- which may disagree with 'localPkgDescr' in 'LocalBuildInfo'. | 517 | componentNameCLBIs lbi cname =
case Map.lookup cname (componentNameMap lbi) of
Just clbis -> clbis
Nothing -> []
-- TODO: Maybe cache topsort (Graph can do this)
-- | Return the list of default 'TargetInfo's associated with a
-- configured package, in the order they need to be built.
-- Has a prime because it takes a 'PackageDescription' argument
-- which may disagree with 'localPkgDescr' in 'LocalBuildInfo'. | 434 | false | true | 3 | 8 | 94 | 66 | 35 | 31 | null | null |
nushio3/ghc | compiler/main/GhcMake.hs | bsd-3-clause | intermediateCleanTempFiles :: DynFlags -> [ModSummary] -> HscEnv -> IO ()
intermediateCleanTempFiles dflags summaries hsc_env
= do notIntermediate <- readIORef (filesToNotIntermediateClean dflags)
cleanTempFilesExcept dflags (notIntermediate ++ except)
where
except =
-- Save preprocessed files. The preprocessed file *might* be
-- the same as the source file, but that doesn't do any
-- harm.
map ms_hspp_file summaries ++
-- Save object files for loaded modules. The point of this
-- is that we might have generated and compiled a stub C
-- file, and in the case of GHCi the object file will be a
-- temporary file which we must not remove because we need
-- to load/link it later.
hptObjs (hsc_HPT hsc_env)
-- | If there is no -o option, guess the name of target executable
-- by using top-level source file name as a base. | 941 | intermediateCleanTempFiles :: DynFlags -> [ModSummary] -> HscEnv -> IO ()
intermediateCleanTempFiles dflags summaries hsc_env
= do notIntermediate <- readIORef (filesToNotIntermediateClean dflags)
cleanTempFilesExcept dflags (notIntermediate ++ except)
where
except =
-- Save preprocessed files. The preprocessed file *might* be
-- the same as the source file, but that doesn't do any
-- harm.
map ms_hspp_file summaries ++
-- Save object files for loaded modules. The point of this
-- is that we might have generated and compiled a stub C
-- file, and in the case of GHCi the object file will be a
-- temporary file which we must not remove because we need
-- to load/link it later.
hptObjs (hsc_HPT hsc_env)
-- | If there is no -o option, guess the name of target executable
-- by using top-level source file name as a base. | 941 | intermediateCleanTempFiles dflags summaries hsc_env
= do notIntermediate <- readIORef (filesToNotIntermediateClean dflags)
cleanTempFilesExcept dflags (notIntermediate ++ except)
where
except =
-- Save preprocessed files. The preprocessed file *might* be
-- the same as the source file, but that doesn't do any
-- harm.
map ms_hspp_file summaries ++
-- Save object files for loaded modules. The point of this
-- is that we might have generated and compiled a stub C
-- file, and in the case of GHCi the object file will be a
-- temporary file which we must not remove because we need
-- to load/link it later.
hptObjs (hsc_HPT hsc_env)
-- | If there is no -o option, guess the name of target executable
-- by using top-level source file name as a base. | 867 | false | true | 0 | 10 | 250 | 105 | 55 | 50 | null | null |
mcimini/Gradualizer | LazyUD.hs | mit | blameIsError_rule :: [Rule]
blameIsError_rule = [(Rule []
(Formula "error" [] [(Constructor "blame" [Var "L"])] [])
)] | 160 | blameIsError_rule :: [Rule]
blameIsError_rule = [(Rule []
(Formula "error" [] [(Constructor "blame" [Var "L"])] [])
)] | 160 | blameIsError_rule = [(Rule []
(Formula "error" [] [(Constructor "blame" [Var "L"])] [])
)] | 132 | false | true | 0 | 14 | 57 | 60 | 32 | 28 | null | null |
jb55/cabal2nix | src/Cabal2Nix/Name.hs | bsd-3-clause | libNixName "libsoup-gnome-2.4" = return "libsoup" | 66 | libNixName "libsoup-gnome-2.4" = return "libsoup" | 66 | libNixName "libsoup-gnome-2.4" = return "libsoup" | 66 | false | false | 0 | 5 | 21 | 13 | 5 | 8 | null | null |
timthelion/fenfire | Fenfire/RDF.hs | gpl-2.0 | turtle_escaped c ('\r':xs) = '\\': 'r':turtle_escaped c xs | 58 | turtle_escaped c ('\r':xs) = '\\': 'r':turtle_escaped c xs | 58 | turtle_escaped c ('\r':xs) = '\\': 'r':turtle_escaped c xs | 58 | false | false | 0 | 6 | 7 | 33 | 15 | 18 | null | null |
abakst/liquidhaskell | src/Language/Haskell/Liquid/Bare/OfType.hs | bsd-3-clause | tyApp (RApp c ts rs r) ts' rs' r' = RApp c (ts ++ ts') (rs ++ rs') (r `meet` r') | 80 | tyApp (RApp c ts rs r) ts' rs' r' = RApp c (ts ++ ts') (rs ++ rs') (r `meet` r') | 80 | tyApp (RApp c ts rs r) ts' rs' r' = RApp c (ts ++ ts') (rs ++ rs') (r `meet` r') | 80 | false | false | 1 | 7 | 20 | 61 | 31 | 30 | null | null |
shimazing/haskell-study-fall2016 | HW05/HW05.hs | bsd-3-clause | writeJSON :: ToJSON a => FilePath -> a -> IO ()
writeJSON path content = BS.writeFile path $ encode content | 107 | writeJSON :: ToJSON a => FilePath -> a -> IO ()
writeJSON path content = BS.writeFile path $ encode content | 107 | writeJSON path content = BS.writeFile path $ encode content | 59 | false | true | 0 | 9 | 19 | 48 | 22 | 26 | null | null |
NightRa/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v (LMinus ATFloat) [l, r] = v ++ "FLOATOP(-," ++ creg l ++ ", " ++ creg r ++ ")" | 85 | doOp v (LMinus ATFloat) [l, r] = v ++ "FLOATOP(-," ++ creg l ++ ", " ++ creg r ++ ")" | 85 | doOp v (LMinus ATFloat) [l, r] = v ++ "FLOATOP(-," ++ creg l ++ ", " ++ creg r ++ ")" | 85 | false | false | 0 | 9 | 20 | 51 | 25 | 26 | null | null |
FranklinChen/hugs98-plus-Sep2006 | packages/network/tests/URITest.hs | bsd-3-clause | testURIRef103 = testURIRef InvRf "A[**]C" | 41 | testURIRef103 = testURIRef InvRf "A[**]C" | 41 | testURIRef103 = testURIRef InvRf "A[**]C" | 41 | false | false | 1 | 5 | 4 | 16 | 5 | 11 | null | null |
olorin/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'InstanceState' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'isName'
--
-- * 'isCode'
instanceState
:: InstanceStateName -- ^ 'isName'
-> Int -- ^ 'isCode'
-> InstanceState
instanceState pName_ pCode_ =
InstanceState'
{ _isName = pName_
, _isCode = pCode_
} | 398 | instanceState
:: InstanceStateName -- ^ 'isName'
-> Int -- ^ 'isCode'
-> InstanceState
instanceState pName_ pCode_ =
InstanceState'
{ _isName = pName_
, _isCode = pCode_
} | 199 | instanceState pName_ pCode_ =
InstanceState'
{ _isName = pName_
, _isCode = pCode_
} | 100 | true | true | 0 | 6 | 92 | 47 | 30 | 17 | null | null |
dikmax/haskell-blog | src/HtmlTags.hs | bsd-2-clause | --
-- link element
--
link :: Node
link = Element "link" [] [] | 62 | link :: Node
link = Element "link" [] [] | 40 | link = Element "link" [] [] | 27 | true | true | 0 | 6 | 13 | 25 | 14 | 11 | null | null |
technogeeky/centered | src/Pearl/GaDtTLHT/Internal/Unhom.hs | gpl-3.0 | hom f k e (x:xs) = f (h [x], h xs)
where h = hom f k e | 70 | hom f k e (x:xs) = f (h [x], h xs)
where h = hom f k e | 70 | hom f k e (x:xs) = f (h [x], h xs)
where h = hom f k e | 70 | false | false | 0 | 8 | 33 | 54 | 27 | 27 | null | null |
unisonweb/platform | unison-core/src/Unison/Name.hs | mit | sortNames :: [Name] -> [Name]
sortNames = sortNamed id | 54 | sortNames :: [Name] -> [Name]
sortNames = sortNamed id | 54 | sortNames = sortNamed id | 24 | false | true | 0 | 6 | 8 | 24 | 13 | 11 | null | null |
facebookincubator/duckling | Duckling/Time/EN/Rules.hs | bsd-3-clause | -- Blocked for :latent time.
ruleIntervalDash :: Rule
ruleIntervalDash = Rule
{ name = "<datetime> - <datetime> (interval)"
, pattern =
[ Predicate isNotLatent
, regex "\\-|to|th?ru|through|(un)?til(l)?"
, Predicate isNotLatent
]
, prod = \case
(Token Time td1:_:Token Time td2:_) ->
Token Time <$> interval TTime.Closed td1 td2
_ -> Nothing
} | 387 | ruleIntervalDash :: Rule
ruleIntervalDash = Rule
{ name = "<datetime> - <datetime> (interval)"
, pattern =
[ Predicate isNotLatent
, regex "\\-|to|th?ru|through|(un)?til(l)?"
, Predicate isNotLatent
]
, prod = \case
(Token Time td1:_:Token Time td2:_) ->
Token Time <$> interval TTime.Closed td1 td2
_ -> Nothing
} | 358 | ruleIntervalDash = Rule
{ name = "<datetime> - <datetime> (interval)"
, pattern =
[ Predicate isNotLatent
, regex "\\-|to|th?ru|through|(un)?til(l)?"
, Predicate isNotLatent
]
, prod = \case
(Token Time td1:_:Token Time td2:_) ->
Token Time <$> interval TTime.Closed td1 td2
_ -> Nothing
} | 333 | true | true | 0 | 15 | 95 | 115 | 57 | 58 | null | null |
sapek/pandoc | src/Text/Pandoc/Writers/Custom.hs | gpl-2.0 | getList :: StackValue a => LuaState -> Int -> IO [a]
getList lua i' = do
continue <- Lua.next lua i'
if continue
then do
next <- Lua.peek lua (-1)
Lua.pop lua 1
x <- maybe (fail "peek returned Nothing") return next
rest <- getList lua i'
return (x : rest)
else return [] | 319 | getList :: StackValue a => LuaState -> Int -> IO [a]
getList lua i' = do
continue <- Lua.next lua i'
if continue
then do
next <- Lua.peek lua (-1)
Lua.pop lua 1
x <- maybe (fail "peek returned Nothing") return next
rest <- getList lua i'
return (x : rest)
else return [] | 319 | getList lua i' = do
continue <- Lua.next lua i'
if continue
then do
next <- Lua.peek lua (-1)
Lua.pop lua 1
x <- maybe (fail "peek returned Nothing") return next
rest <- getList lua i'
return (x : rest)
else return [] | 266 | false | true | 0 | 14 | 102 | 146 | 66 | 80 | null | null |
rahulmutt/ghcvm | compiler/Eta/TypeCheck/TcRnTypes.hs | bsd-3-clause | pprCtOrigin (DerivOriginDC dc n)
= hang (ctoHerald <+> ptext (sLit "the") <+> speakNth n
<+> ptext (sLit "field of") <+> quotes (ppr dc))
2 (parens (ptext (sLit "type") <+> quotes (ppr ty)))
where
ty = dataConOrigArgTys dc !! (n-1) | 256 | pprCtOrigin (DerivOriginDC dc n)
= hang (ctoHerald <+> ptext (sLit "the") <+> speakNth n
<+> ptext (sLit "field of") <+> quotes (ppr dc))
2 (parens (ptext (sLit "type") <+> quotes (ppr ty)))
where
ty = dataConOrigArgTys dc !! (n-1) | 256 | pprCtOrigin (DerivOriginDC dc n)
= hang (ctoHerald <+> ptext (sLit "the") <+> speakNth n
<+> ptext (sLit "field of") <+> quotes (ppr dc))
2 (parens (ptext (sLit "type") <+> quotes (ppr ty)))
where
ty = dataConOrigArgTys dc !! (n-1) | 256 | false | false | 1 | 12 | 63 | 133 | 60 | 73 | null | null |
noschinl/cyp | src/Test/Info2/Cyp/Term.hs | mit | unparseLiteral (PrimFloat _ c _) = show c | 41 | unparseLiteral (PrimFloat _ c _) = show c | 41 | unparseLiteral (PrimFloat _ c _) = show c | 41 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
Teaspot-Studio/Urho3D-Haskell | src/Graphics/Urho3D/Input/Input.hs | mit | inputGetScancodeFromName :: (Parent Input a, Pointer p a, MonadIO m)
=> p -- ^ Pointer to Input or ascentor
-> String -- ^ name
-> m Scancode
inputGetScancodeFromName p n = liftIO $ withCString n $ \n' -> do
let ptr = parentPointer p
toEnum . fromIntegral <$> [C.exp| int { (int)$(Input* ptr)->GetScancodeFromName(String($(const char* n'))) } |]
-- | Return name of key from scancode. | 395 | inputGetScancodeFromName :: (Parent Input a, Pointer p a, MonadIO m)
=> p -- ^ Pointer to Input or ascentor
-> String -- ^ name
-> m Scancode
inputGetScancodeFromName p n = liftIO $ withCString n $ \n' -> do
let ptr = parentPointer p
toEnum . fromIntegral <$> [C.exp| int { (int)$(Input* ptr)->GetScancodeFromName(String($(const char* n'))) } |]
-- | Return name of key from scancode. | 395 | inputGetScancodeFromName p n = liftIO $ withCString n $ \n' -> do
let ptr = parentPointer p
toEnum . fromIntegral <$> [C.exp| int { (int)$(Input* ptr)->GetScancodeFromName(String($(const char* n'))) } |]
-- | Return name of key from scancode. | 247 | false | true | 0 | 12 | 75 | 101 | 52 | 49 | null | null |
prasmussen/glot-www | Glot/Pagination.hs | mit | intToText :: Int -> Text
intToText n =
Text.pack (show n) | 61 | intToText :: Int -> Text
intToText n =
Text.pack (show n) | 61 | intToText n =
Text.pack (show n) | 36 | false | true | 0 | 7 | 14 | 29 | 14 | 15 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_IMAGE_2D_ARRAY_EXT :: GLenum
gl_IMAGE_2D_ARRAY_EXT = 0x9053 | 62 | gl_IMAGE_2D_ARRAY_EXT :: GLenum
gl_IMAGE_2D_ARRAY_EXT = 0x9053 | 62 | gl_IMAGE_2D_ARRAY_EXT = 0x9053 | 30 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
A1kmm/sbasetram | BuildGeneList.hs | agpl-3.0 | main = do
args <- getArgs
case getOpt RequireOrder options args of
(o,_,[]) ->
let
opts = foldl (\opt f -> f opt) emptyProgramOptions o
in
case opts of
ProgramOptions { poshowHelp = True } ->
commandLineInfo "Help information"
ProgramOptions { poMatrixFile = Nothing } ->
commandLineInfo "Matrix file not specified"
ProgramOptions { poMatrixFile = Just mf } ->
do
buildGeneList mf
return ()
(_, _, e) -> commandLineInfo $ "Command line parse error:\n" ++ (concat e) | 635 | main = do
args <- getArgs
case getOpt RequireOrder options args of
(o,_,[]) ->
let
opts = foldl (\opt f -> f opt) emptyProgramOptions o
in
case opts of
ProgramOptions { poshowHelp = True } ->
commandLineInfo "Help information"
ProgramOptions { poMatrixFile = Nothing } ->
commandLineInfo "Matrix file not specified"
ProgramOptions { poMatrixFile = Just mf } ->
do
buildGeneList mf
return ()
(_, _, e) -> commandLineInfo $ "Command line parse error:\n" ++ (concat e) | 635 | main = do
args <- getArgs
case getOpt RequireOrder options args of
(o,_,[]) ->
let
opts = foldl (\opt f -> f opt) emptyProgramOptions o
in
case opts of
ProgramOptions { poshowHelp = True } ->
commandLineInfo "Help information"
ProgramOptions { poMatrixFile = Nothing } ->
commandLineInfo "Matrix file not specified"
ProgramOptions { poMatrixFile = Just mf } ->
do
buildGeneList mf
return ()
(_, _, e) -> commandLineInfo $ "Command line parse error:\n" ++ (concat e) | 635 | false | false | 1 | 19 | 246 | 181 | 87 | 94 | null | null |
christinem/courseography | app/Database/Tables.hs | gpl-3.0 | parseInstr :: Value -> Parser T.Text
parseInstr (Object io) = do
firstName <- io .:? "firstName" .!= ""
lastName <- io .:? "lastName" .!= ""
return (T.concat [firstName, ". ", lastName]) | 192 | parseInstr :: Value -> Parser T.Text
parseInstr (Object io) = do
firstName <- io .:? "firstName" .!= ""
lastName <- io .:? "lastName" .!= ""
return (T.concat [firstName, ". ", lastName]) | 192 | parseInstr (Object io) = do
firstName <- io .:? "firstName" .!= ""
lastName <- io .:? "lastName" .!= ""
return (T.concat [firstName, ". ", lastName]) | 155 | false | true | 0 | 11 | 36 | 87 | 41 | 46 | null | null |
inq/agitpunkt | app/main.hs | agpl-3.0 | main :: IO ()
-- ^ The main function
main = do
response404 <-
[parse|html
body
div
p
| oops 404!
|]
run routeTree response404 databaseName socketFile
where
databaseName = "agitpunkt"
socketFile = "tmp/sockets/agitpunkt.sock" -- pidFile = "tmp/pids/agitpunkt.pid"
-- stdOut = "tmp/logs/stdout"
-- stdErr = "tmp/logs/stderr" | 390 | main :: IO ()
main = do
response404 <-
[parse|html
body
div
p
| oops 404!
|]
run routeTree response404 databaseName socketFile
where
databaseName = "agitpunkt"
socketFile = "tmp/sockets/agitpunkt.sock" -- pidFile = "tmp/pids/agitpunkt.pid"
-- stdOut = "tmp/logs/stdout"
-- stdErr = "tmp/logs/stderr" | 367 | main = do
response404 <-
[parse|html
body
div
p
| oops 404!
|]
run routeTree response404 databaseName socketFile
where
databaseName = "agitpunkt"
socketFile = "tmp/sockets/agitpunkt.sock" -- pidFile = "tmp/pids/agitpunkt.pid"
-- stdOut = "tmp/logs/stdout"
-- stdErr = "tmp/logs/stderr" | 353 | true | true | 1 | 7 | 113 | 58 | 31 | 27 | null | null |
Nehmulos/audiobooks.hs | src/Listing.hs | gpl-3.0 | cdJson :: (String, [FilePath]) -> JSObject JSValue
cdJson (name, tracks) = toJSObject [ ("name", JSString (toJSString name))
, ("tracks", JSArray $ map (JSString . toJSString) tracks)
] | 255 | cdJson :: (String, [FilePath]) -> JSObject JSValue
cdJson (name, tracks) = toJSObject [ ("name", JSString (toJSString name))
, ("tracks", JSArray $ map (JSString . toJSString) tracks)
] | 255 | cdJson (name, tracks) = toJSObject [ ("name", JSString (toJSString name))
, ("tracks", JSArray $ map (JSString . toJSString) tracks)
] | 204 | false | true | 0 | 11 | 96 | 82 | 45 | 37 | null | null |
schell/blocks | src/Game/Tetris.hs | bsd-3-clause | widthOfPieces :: Pieces -> GLfloat
widthOfPieces = heightOfPieces . transpose . reverse | 87 | widthOfPieces :: Pieces -> GLfloat
widthOfPieces = heightOfPieces . transpose . reverse | 87 | widthOfPieces = heightOfPieces . transpose . reverse | 52 | false | true | 0 | 6 | 11 | 23 | 12 | 11 | null | null |
facebookincubator/duckling | Duckling/Rules/SK.hs | bsd-3-clause | langRules (Seal RegexMatch) = [] | 32 | langRules (Seal RegexMatch) = [] | 32 | langRules (Seal RegexMatch) = [] | 32 | false | false | 0 | 7 | 4 | 17 | 8 | 9 | null | null |
expipiplus1/vulkan | utils/src/Vulkan/Utils/ShaderQQ/GLSL/Shaderc.hs | bsd-3-clause | -- | QuasiQuoter for creating a fragment shader.
--
-- Equivalent to calling @$(compileShaderQ Nothing "frag" [glsl|...|])@ without
-- interpolation support.
frag :: QuasiQuoter
frag = shaderQQ "frag" | 200 | frag :: QuasiQuoter
frag = shaderQQ "frag" | 42 | frag = shaderQQ "frag" | 22 | true | true | 0 | 6 | 27 | 25 | 12 | 13 | null | null |
gelisam/submake | src/Submake/Cooker.hs | unlicense | cook_recipe :: Cachefile -> Recipe -> IO ()
cook_recipe c r = do
input_hash <- cacheFile (sourceFile r)
output_hash <- loopM (commands r) input_hash (cook_command c)
output <- readHash output_hash
writeFile (targetFile r) output | 244 | cook_recipe :: Cachefile -> Recipe -> IO ()
cook_recipe c r = do
input_hash <- cacheFile (sourceFile r)
output_hash <- loopM (commands r) input_hash (cook_command c)
output <- readHash output_hash
writeFile (targetFile r) output | 244 | cook_recipe c r = do
input_hash <- cacheFile (sourceFile r)
output_hash <- loopM (commands r) input_hash (cook_command c)
output <- readHash output_hash
writeFile (targetFile r) output | 200 | false | true | 0 | 11 | 49 | 100 | 44 | 56 | null | null |
andrewpetrovic/pandoc | src/Text/Pandoc/Writers/RST.hs | gpl-2.0 | inlineToRST (Cite _ lst) =
inlineListToRST lst | 49 | inlineToRST (Cite _ lst) =
inlineListToRST lst | 49 | inlineToRST (Cite _ lst) =
inlineListToRST lst | 49 | false | false | 0 | 7 | 9 | 20 | 9 | 11 | null | null |
printedheart/Dao | src/Dao/Text/Editor.hs | agpl-3.0 | -- | Whenever a 'nextLine' operation is executed, this string is copied into the 'outputText' and
-- the 'currentLine' is incremented.
newlineString :: Monad m => Lens m PPrintState StrictText
newlineString = pPrintStateLens >>> tuple2 | 235 | newlineString :: Monad m => Lens m PPrintState StrictText
newlineString = pPrintStateLens >>> tuple2 | 100 | newlineString = pPrintStateLens >>> tuple2 | 42 | true | true | 0 | 6 | 34 | 31 | 16 | 15 | null | null |
MaKToff/SPbSU_Homeworks | Semester 3/Homework 3/Homework3.hs | mit | to_list (O first a second) = (to_list first) ++ (a : (to_list second)) | 70 | to_list (O first a second) = (to_list first) ++ (a : (to_list second)) | 70 | to_list (O first a second) = (to_list first) ++ (a : (to_list second)) | 70 | false | false | 0 | 9 | 12 | 43 | 21 | 22 | null | null |
fpco/inline-c | inline-c/src/Language/C/Types/Parse.hs | mit | abstract_declarator :: CParser i m => m (AbstractDeclarator i)
abstract_declarator = do
ptrs <- many pointer
-- If there are no pointers, there must be an abstract declarator.
let p = if null ptrs
then Just <$> direct_abstract_declarator
else (Just <$> try direct_abstract_declarator) <|> return Nothing
AbstractDeclarator ptrs <$> p | 357 | abstract_declarator :: CParser i m => m (AbstractDeclarator i)
abstract_declarator = do
ptrs <- many pointer
-- If there are no pointers, there must be an abstract declarator.
let p = if null ptrs
then Just <$> direct_abstract_declarator
else (Just <$> try direct_abstract_declarator) <|> return Nothing
AbstractDeclarator ptrs <$> p | 357 | abstract_declarator = do
ptrs <- many pointer
-- If there are no pointers, there must be an abstract declarator.
let p = if null ptrs
then Just <$> direct_abstract_declarator
else (Just <$> try direct_abstract_declarator) <|> return Nothing
AbstractDeclarator ptrs <$> p | 294 | false | true | 0 | 14 | 73 | 91 | 43 | 48 | null | null |
oldmanmike/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | constraintKindTyCon :: TyCon
constraintKindTyCon = pcTyCon False NonRecursive constraintKindTyConName
Nothing [] [] | 145 | constraintKindTyCon :: TyCon
constraintKindTyCon = pcTyCon False NonRecursive constraintKindTyConName
Nothing [] [] | 145 | constraintKindTyCon = pcTyCon False NonRecursive constraintKindTyConName
Nothing [] [] | 116 | false | true | 0 | 6 | 41 | 39 | 15 | 24 | null | null |
kyren/hsgb | lib/Gameboy/Instructions.hs | unlicense | encodeInstruction (SET_B_R Bit3 CRegister) = [0xcb, 0xd9] | 57 | encodeInstruction (SET_B_R Bit3 CRegister) = [0xcb, 0xd9] | 57 | encodeInstruction (SET_B_R Bit3 CRegister) = [0xcb, 0xd9] | 57 | false | false | 0 | 6 | 6 | 24 | 12 | 12 | null | null |
heathweiss/Tricad | src/Examples/ShoeLift/SandalsToe.hs | gpl-2.0 | sandalToeStlFile = newStlShape "SandalToe" $ shoeTopTriangles ++ shoeMiddleTriangles | 86 | sandalToeStlFile = newStlShape "SandalToe" $ shoeTopTriangles ++ shoeMiddleTriangles | 86 | sandalToeStlFile = newStlShape "SandalToe" $ shoeTopTriangles ++ shoeMiddleTriangles | 86 | false | false | 0 | 7 | 9 | 17 | 8 | 9 | null | null |
Hodapp87/ivory | ivory-opts/src/Ivory/Opts/ConstFold.hs | bsd-3-clause | liftChoice :: CopyMap -> I.Type -> I.ExpOp -> [I.Expr] -> I.Expr
liftChoice copies ty op args = case op of
I.ExpEq{} -> go2
I.ExpNeq{} -> go2
-- I.ExpCond --unnecessary
I.ExpGt{} -> go2
I.ExpLt{} -> go2
I.ExpNot{} -> go1
I.ExpAnd{} -> go2
I.ExpOr{} -> go2
I.ExpMul -> go2
I.ExpAdd -> go2
I.ExpSub -> go2
I.ExpNegate -> go1
I.ExpAbs -> go1
I.ExpSignum -> go1
-- -- NOT SAFE TO LIFT!
-- I.ExpDiv -> --NO!
-- Unimplemented currently: add as needed
-- I.ExpMod ->
-- I.ExpRecip ->
-- I.ExpIsNan{} ->
-- I.ExpIsInf{} ->
-- I.ExpFExp ->
-- I.ExpFSqrt ->
-- I.ExpFLog ->
-- I.ExpFPow ->
-- I.ExpFLogBase ->
-- I.ExpFSin ->
-- I.ExpFCos ->
-- I.ExpFTan ->
-- I.ExpFAsin ->
-- I.ExpFAcos ->
-- I.ExpFAtan ->
-- I.ExpFAtan2 ->
-- I.ExpFSinh ->
-- I.ExpFCosh ->
-- I.ExpFTanh ->
-- I.ExpFAsinh ->
-- I.ExpFAcosh ->
-- I.ExpFAtanh ->
-- I.ExpBitAnd ->
-- I.ExpBitOr ->
-- -- Unimplemented right now
-- I.ExpRoundF ->
-- I.ExpCeilF ->
-- I.ExpFloorF ->
-- I.ExpBitXor ->
-- I.ExpBitComplement ->
-- I.ExpBitShiftL ->
-- I.ExpBitShiftR ->
_ -> cfOp copies ty op args
where
go1 = unOpLift copies ty op args
go2 = binOpLift copies ty op args
--XXX the equality comparisons below can be expensive. Hashmap? Also, awkward
-- style, but I want sharing of (liftChoice ...) expression in branch condition
-- and result. | 1,556 | liftChoice :: CopyMap -> I.Type -> I.ExpOp -> [I.Expr] -> I.Expr
liftChoice copies ty op args = case op of
I.ExpEq{} -> go2
I.ExpNeq{} -> go2
-- I.ExpCond --unnecessary
I.ExpGt{} -> go2
I.ExpLt{} -> go2
I.ExpNot{} -> go1
I.ExpAnd{} -> go2
I.ExpOr{} -> go2
I.ExpMul -> go2
I.ExpAdd -> go2
I.ExpSub -> go2
I.ExpNegate -> go1
I.ExpAbs -> go1
I.ExpSignum -> go1
-- -- NOT SAFE TO LIFT!
-- I.ExpDiv -> --NO!
-- Unimplemented currently: add as needed
-- I.ExpMod ->
-- I.ExpRecip ->
-- I.ExpIsNan{} ->
-- I.ExpIsInf{} ->
-- I.ExpFExp ->
-- I.ExpFSqrt ->
-- I.ExpFLog ->
-- I.ExpFPow ->
-- I.ExpFLogBase ->
-- I.ExpFSin ->
-- I.ExpFCos ->
-- I.ExpFTan ->
-- I.ExpFAsin ->
-- I.ExpFAcos ->
-- I.ExpFAtan ->
-- I.ExpFAtan2 ->
-- I.ExpFSinh ->
-- I.ExpFCosh ->
-- I.ExpFTanh ->
-- I.ExpFAsinh ->
-- I.ExpFAcosh ->
-- I.ExpFAtanh ->
-- I.ExpBitAnd ->
-- I.ExpBitOr ->
-- -- Unimplemented right now
-- I.ExpRoundF ->
-- I.ExpCeilF ->
-- I.ExpFloorF ->
-- I.ExpBitXor ->
-- I.ExpBitComplement ->
-- I.ExpBitShiftL ->
-- I.ExpBitShiftR ->
_ -> cfOp copies ty op args
where
go1 = unOpLift copies ty op args
go2 = binOpLift copies ty op args
--XXX the equality comparisons below can be expensive. Hashmap? Also, awkward
-- style, but I want sharing of (liftChoice ...) expression in branch condition
-- and result. | 1,556 | liftChoice copies ty op args = case op of
I.ExpEq{} -> go2
I.ExpNeq{} -> go2
-- I.ExpCond --unnecessary
I.ExpGt{} -> go2
I.ExpLt{} -> go2
I.ExpNot{} -> go1
I.ExpAnd{} -> go2
I.ExpOr{} -> go2
I.ExpMul -> go2
I.ExpAdd -> go2
I.ExpSub -> go2
I.ExpNegate -> go1
I.ExpAbs -> go1
I.ExpSignum -> go1
-- -- NOT SAFE TO LIFT!
-- I.ExpDiv -> --NO!
-- Unimplemented currently: add as needed
-- I.ExpMod ->
-- I.ExpRecip ->
-- I.ExpIsNan{} ->
-- I.ExpIsInf{} ->
-- I.ExpFExp ->
-- I.ExpFSqrt ->
-- I.ExpFLog ->
-- I.ExpFPow ->
-- I.ExpFLogBase ->
-- I.ExpFSin ->
-- I.ExpFCos ->
-- I.ExpFTan ->
-- I.ExpFAsin ->
-- I.ExpFAcos ->
-- I.ExpFAtan ->
-- I.ExpFAtan2 ->
-- I.ExpFSinh ->
-- I.ExpFCosh ->
-- I.ExpFTanh ->
-- I.ExpFAsinh ->
-- I.ExpFAcosh ->
-- I.ExpFAtanh ->
-- I.ExpBitAnd ->
-- I.ExpBitOr ->
-- -- Unimplemented right now
-- I.ExpRoundF ->
-- I.ExpCeilF ->
-- I.ExpFloorF ->
-- I.ExpBitXor ->
-- I.ExpBitComplement ->
-- I.ExpBitShiftL ->
-- I.ExpBitShiftR ->
_ -> cfOp copies ty op args
where
go1 = unOpLift copies ty op args
go2 = binOpLift copies ty op args
--XXX the equality comparisons below can be expensive. Hashmap? Also, awkward
-- style, but I want sharing of (liftChoice ...) expression in branch condition
-- and result. | 1,491 | false | true | 0 | 10 | 482 | 268 | 153 | 115 | null | null |
AndrewRademacher/stack | src/Stack/Coverage.hs | bsd-3-clause | unionTixes :: [Tix] -> ([String], Tix)
unionTixes tixes = (Map.keys errs, Tix (Map.elems outputs))
where
(errs, outputs) = Map.mapEither id $ Map.unionsWith merge $ map toMap tixes
toMap (Tix ms) = Map.fromList (map (\x@(TixModule k _ _ _) -> (k, Right x)) ms)
merge (Right (TixModule k hash1 len1 tix1))
(Right (TixModule _ hash2 len2 tix2))
| hash1 == hash2 && len1 == len2 = Right (TixModule k hash1 len1 (zipWith (+) tix1 tix2))
merge _ _ = Left () | 488 | unionTixes :: [Tix] -> ([String], Tix)
unionTixes tixes = (Map.keys errs, Tix (Map.elems outputs))
where
(errs, outputs) = Map.mapEither id $ Map.unionsWith merge $ map toMap tixes
toMap (Tix ms) = Map.fromList (map (\x@(TixModule k _ _ _) -> (k, Right x)) ms)
merge (Right (TixModule k hash1 len1 tix1))
(Right (TixModule _ hash2 len2 tix2))
| hash1 == hash2 && len1 == len2 = Right (TixModule k hash1 len1 (zipWith (+) tix1 tix2))
merge _ _ = Left () | 488 | unionTixes tixes = (Map.keys errs, Tix (Map.elems outputs))
where
(errs, outputs) = Map.mapEither id $ Map.unionsWith merge $ map toMap tixes
toMap (Tix ms) = Map.fromList (map (\x@(TixModule k _ _ _) -> (k, Right x)) ms)
merge (Right (TixModule k hash1 len1 tix1))
(Right (TixModule _ hash2 len2 tix2))
| hash1 == hash2 && len1 == len2 = Right (TixModule k hash1 len1 (zipWith (+) tix1 tix2))
merge _ _ = Left () | 449 | false | true | 0 | 12 | 115 | 255 | 129 | 126 | null | null |
ekmett/wl-pprint-extras | src/Text/PrettyPrint/Free/Internal.hs | bsd-2-clause | -- | The document @comma@ contains a comma, \",\".
comma :: Doc a e
comma = char ',' | 84 | comma :: Doc a e
comma = char ',' | 33 | comma = char ',' | 16 | true | true | 0 | 5 | 17 | 20 | 10 | 10 | null | null |
TurpIF/Drawhub | src/main/Drawhub/KMeans.hs | mit | chunksOf :: Int -> [a] -> [[a]]
chunksOf n xs = chunksOf' size xs
where
size = ceiling $ fromIntegral (length xs) / fromIntegral n
chunksOf' _ [] = []
chunksOf' n xs = take n xs : chunksOf' n (drop n xs) | 231 | chunksOf :: Int -> [a] -> [[a]]
chunksOf n xs = chunksOf' size xs
where
size = ceiling $ fromIntegral (length xs) / fromIntegral n
chunksOf' _ [] = []
chunksOf' n xs = take n xs : chunksOf' n (drop n xs) | 231 | chunksOf n xs = chunksOf' size xs
where
size = ceiling $ fromIntegral (length xs) / fromIntegral n
chunksOf' _ [] = []
chunksOf' n xs = take n xs : chunksOf' n (drop n xs) | 199 | false | true | 4 | 10 | 70 | 128 | 57 | 71 | null | null |
5hubh4m/99-haskell-problems | ListsContinued.hs | mit | rotateLst n xs
| n < 0 = rotateLst (length xs + n) xs
| n > length xs = rotateLst (n `mod` length xs) xs
| otherwise = rotateLst (n - 1) (tail xs ++ [head xs]) | 165 | rotateLst n xs
| n < 0 = rotateLst (length xs + n) xs
| n > length xs = rotateLst (n `mod` length xs) xs
| otherwise = rotateLst (n - 1) (tail xs ++ [head xs]) | 165 | rotateLst n xs
| n < 0 = rotateLst (length xs + n) xs
| n > length xs = rotateLst (n `mod` length xs) xs
| otherwise = rotateLst (n - 1) (tail xs ++ [head xs]) | 165 | false | false | 1 | 9 | 43 | 106 | 51 | 55 | null | null |
tensorflow/haskell | tensorflow/src/TensorFlow/Build.hs | apache-2.0 | currentScope :: Lens' GraphState [Scope]
currentScope = lens _currentScope (\g x -> g { _currentScope = x }) | 108 | currentScope :: Lens' GraphState [Scope]
currentScope = lens _currentScope (\g x -> g { _currentScope = x }) | 108 | currentScope = lens _currentScope (\g x -> g { _currentScope = x }) | 67 | false | true | 1 | 9 | 17 | 47 | 23 | 24 | null | null |
frenetic-lang/netcore-1.0 | src/Frenetic/NetCore/Compiler.hs | bsd-3-clause | cartMap f c (x:xs) ys =
let (c', xo, ys') = cartMap' c x ys in
let (c'', xs', ys'') = cartMap f c' xs ys' in
let xs'' = case xo of { Just x' -> x' : xs'; Nothing -> xs' } in
(c'',xs'',ys'')
where
cartMap' c x [] = (c, Just x, [])
cartMap' c x (y:ys) =
case f c x y of
(c', Just x', Just y') ->
let (c'', xo', ys') = cartMap' c' x' ys in
(c'', xo', y':ys')
(c', Nothing, Just y') -> (c', Nothing, y':ys)
(c', Just x', Nothing) -> cartMap' c' x' ys
(c', Nothing, Nothing) -> (c', Nothing, ys)
{-| Classifiers are the target of compilation. -} | 619 | cartMap f c (x:xs) ys =
let (c', xo, ys') = cartMap' c x ys in
let (c'', xs', ys'') = cartMap f c' xs ys' in
let xs'' = case xo of { Just x' -> x' : xs'; Nothing -> xs' } in
(c'',xs'',ys'')
where
cartMap' c x [] = (c, Just x, [])
cartMap' c x (y:ys) =
case f c x y of
(c', Just x', Just y') ->
let (c'', xo', ys') = cartMap' c' x' ys in
(c'', xo', y':ys')
(c', Nothing, Just y') -> (c', Nothing, y':ys)
(c', Just x', Nothing) -> cartMap' c' x' ys
(c', Nothing, Nothing) -> (c', Nothing, ys)
{-| Classifiers are the target of compilation. -} | 619 | cartMap f c (x:xs) ys =
let (c', xo, ys') = cartMap' c x ys in
let (c'', xs', ys'') = cartMap f c' xs ys' in
let xs'' = case xo of { Just x' -> x' : xs'; Nothing -> xs' } in
(c'',xs'',ys'')
where
cartMap' c x [] = (c, Just x, [])
cartMap' c x (y:ys) =
case f c x y of
(c', Just x', Just y') ->
let (c'', xo', ys') = cartMap' c' x' ys in
(c'', xo', y':ys')
(c', Nothing, Just y') -> (c', Nothing, y':ys)
(c', Just x', Nothing) -> cartMap' c' x' ys
(c', Nothing, Nothing) -> (c', Nothing, ys)
{-| Classifiers are the target of compilation. -} | 619 | false | false | 0 | 16 | 196 | 339 | 176 | 163 | null | null |
chpatrick/slither-bot | src/SlitherBot/UtilityGrid.hs | bsd-3-clause | snakeBodyPrediction :: Position -> SnakeBody -> [Position]
snakeBodyPrediction snakePosition snakeBody = let
headPos = snakePosition
in case Seq.viewl snakeBody of
Seq.EmptyL -> []
previousPos Seq.:< _ -> let
movement = headPos - previousPos
in take predictedBodyParts (tail (iterate (+ movement) headPos)) | 331 | snakeBodyPrediction :: Position -> SnakeBody -> [Position]
snakeBodyPrediction snakePosition snakeBody = let
headPos = snakePosition
in case Seq.viewl snakeBody of
Seq.EmptyL -> []
previousPos Seq.:< _ -> let
movement = headPos - previousPos
in take predictedBodyParts (tail (iterate (+ movement) headPos)) | 331 | snakeBodyPrediction snakePosition snakeBody = let
headPos = snakePosition
in case Seq.viewl snakeBody of
Seq.EmptyL -> []
previousPos Seq.:< _ -> let
movement = headPos - previousPos
in take predictedBodyParts (tail (iterate (+ movement) headPos)) | 272 | false | true | 0 | 17 | 65 | 109 | 53 | 56 | null | null |
kmilner/tamarin-prover | lib/sapic/src/Sapic/Restrictions.hs | gpl-3.0 | -- flattenSet :: Ord a => S.Set (S.Set a) -> S.Set a
-- flattenSet = S.foldr S.union S.empty
-- | Generate set of restrictions: for a given "from" position
-- | @pf anP pos@ gives set of set position in conjunctive normal form
-- | we produce one restriction for each set of positions in it
generateProgressRestrictions :: (Show ann, Typeable ann, MonadCatch m) => AnProcess ann -> m [Restriction]
generateProgressRestrictions anp = do
dom_pf <- pfFrom anp -- set of "from" positions
lss_to <- mapM restriction (S.toList dom_pf) -- list of set of sets of "to" positions
return $ flattenList lss_to
where
restriction pos = do -- produce restriction to go to one of the tos once pos is reached
toss <- pf anp pos
restrL <- mapM (\tos -> return $ Restriction (name tos) (formula tos)) (S.toList toss)
initL <- toEx resProgressInit
-- return $ Restriction (name tos) (formula tos)
return $ restrL ++ [initL]
where
name tos = "Progress_" ++ show pos ++ "_to_" ++ List.intercalate "_or_" (map show $ S.toList tos)
formula tos = hinted forall pvar $ hinted forall t1var $ antecedent .==>. conclusion tos
pvar = msgVarProgress pos
t1var = LVar "t" LSortNode 1
t2var = LVar "t" LSortNode 2
antecedent = Ato $ Action (varTerm $ Free t1var) $ actionToFactFormula (ProgressFrom pos)
conclusion tos = bigOr $ map progressTo $ S.toList tos
bigOr [to] = to
bigOr (to:tos) = to .||. bigOr tos
bigOr [] = TF False -- This case should never occur
progressTo to = hinted exists t2var $ Ato $ Action (varTerm $ Free t2var) $ actionToFactFormula $ ProgressTo to pos
-- let generate_progress_restrictions anP =
-- let pf = Progressfunction.generate anP in
-- let rec big_or = function
-- | [f] -> f
-- | f::fl -> Or(f,big_or fl)
-- | [] -> raise (ImplementationError "There should be at least one to position for every from.")
-- in
-- let lemma a bset =
-- let a'= Position.pos2string a
-- in
-- let pvar = "p "
-- in
-- let blist = (PSet.elements bset)
-- in
-- let progress_to =
-- (* List.map (fun p -> (sprintf "(Ex #t2. ProgressTo_%s(%s)@t2)" (pos2string p) pvar)) blist *)
-- List.map (fun p -> (Ex ( (VarSet.of_list [Temp "t2"]),
-- Atom ( At (Action("ProgressTo_"^(pos2string p),[Var (Msg pvar)]),Temp "t2")))))
-- blist
-- in
-- Restriction ( (sprintf "progress_%s_to_%s" a' (rule_name_part)),
-- All (VarSet.of_list [Msg pvar; Temp "t1"],
-- Imp( Atom ( At (Action("ProgressFrom_"^a',[Var (Msg pvar)]),Temp "t1")),
-- (big_or progress_to))))
-- in
-- (* let print_tosetset a bsetset = *)
-- (* PSetSet.fold (fun bset s -> (print_toset a bset) ^ s) bsetset "" *)
-- (* in *)
-- (* (PMap.fold (fun a bsetset s -> (print_tosetset a bsetset) ^ s) pf "") *)
-- let lemmas a bsetset = List.map (lemma a) (PSetSet.elements bsetset) in
-- List.flatten (PMap.fold (fun a bsetset s -> (lemmas a bsetset) :: s) pf [])
-- | generate restrictions depending on options set (op) and the structure
-- of the process (anP) | 3,431 | generateProgressRestrictions :: (Show ann, Typeable ann, MonadCatch m) => AnProcess ann -> m [Restriction]
generateProgressRestrictions anp = do
dom_pf <- pfFrom anp -- set of "from" positions
lss_to <- mapM restriction (S.toList dom_pf) -- list of set of sets of "to" positions
return $ flattenList lss_to
where
restriction pos = do -- produce restriction to go to one of the tos once pos is reached
toss <- pf anp pos
restrL <- mapM (\tos -> return $ Restriction (name tos) (formula tos)) (S.toList toss)
initL <- toEx resProgressInit
-- return $ Restriction (name tos) (formula tos)
return $ restrL ++ [initL]
where
name tos = "Progress_" ++ show pos ++ "_to_" ++ List.intercalate "_or_" (map show $ S.toList tos)
formula tos = hinted forall pvar $ hinted forall t1var $ antecedent .==>. conclusion tos
pvar = msgVarProgress pos
t1var = LVar "t" LSortNode 1
t2var = LVar "t" LSortNode 2
antecedent = Ato $ Action (varTerm $ Free t1var) $ actionToFactFormula (ProgressFrom pos)
conclusion tos = bigOr $ map progressTo $ S.toList tos
bigOr [to] = to
bigOr (to:tos) = to .||. bigOr tos
bigOr [] = TF False -- This case should never occur
progressTo to = hinted exists t2var $ Ato $ Action (varTerm $ Free t2var) $ actionToFactFormula $ ProgressTo to pos
-- let generate_progress_restrictions anP =
-- let pf = Progressfunction.generate anP in
-- let rec big_or = function
-- | [f] -> f
-- | f::fl -> Or(f,big_or fl)
-- | [] -> raise (ImplementationError "There should be at least one to position for every from.")
-- in
-- let lemma a bset =
-- let a'= Position.pos2string a
-- in
-- let pvar = "p "
-- in
-- let blist = (PSet.elements bset)
-- in
-- let progress_to =
-- (* List.map (fun p -> (sprintf "(Ex #t2. ProgressTo_%s(%s)@t2)" (pos2string p) pvar)) blist *)
-- List.map (fun p -> (Ex ( (VarSet.of_list [Temp "t2"]),
-- Atom ( At (Action("ProgressTo_"^(pos2string p),[Var (Msg pvar)]),Temp "t2")))))
-- blist
-- in
-- Restriction ( (sprintf "progress_%s_to_%s" a' (rule_name_part)),
-- All (VarSet.of_list [Msg pvar; Temp "t1"],
-- Imp( Atom ( At (Action("ProgressFrom_"^a',[Var (Msg pvar)]),Temp "t1")),
-- (big_or progress_to))))
-- in
-- (* let print_tosetset a bsetset = *)
-- (* PSetSet.fold (fun bset s -> (print_toset a bset) ^ s) bsetset "" *)
-- (* in *)
-- (* (PMap.fold (fun a bsetset s -> (print_tosetset a bsetset) ^ s) pf "") *)
-- let lemmas a bsetset = List.map (lemma a) (PSetSet.elements bsetset) in
-- List.flatten (PMap.fold (fun a bsetset s -> (lemmas a bsetset) :: s) pf [])
-- | generate restrictions depending on options set (op) and the structure
-- of the process (anP) | 3,136 | generateProgressRestrictions anp = do
dom_pf <- pfFrom anp -- set of "from" positions
lss_to <- mapM restriction (S.toList dom_pf) -- list of set of sets of "to" positions
return $ flattenList lss_to
where
restriction pos = do -- produce restriction to go to one of the tos once pos is reached
toss <- pf anp pos
restrL <- mapM (\tos -> return $ Restriction (name tos) (formula tos)) (S.toList toss)
initL <- toEx resProgressInit
-- return $ Restriction (name tos) (formula tos)
return $ restrL ++ [initL]
where
name tos = "Progress_" ++ show pos ++ "_to_" ++ List.intercalate "_or_" (map show $ S.toList tos)
formula tos = hinted forall pvar $ hinted forall t1var $ antecedent .==>. conclusion tos
pvar = msgVarProgress pos
t1var = LVar "t" LSortNode 1
t2var = LVar "t" LSortNode 2
antecedent = Ato $ Action (varTerm $ Free t1var) $ actionToFactFormula (ProgressFrom pos)
conclusion tos = bigOr $ map progressTo $ S.toList tos
bigOr [to] = to
bigOr (to:tos) = to .||. bigOr tos
bigOr [] = TF False -- This case should never occur
progressTo to = hinted exists t2var $ Ato $ Action (varTerm $ Free t2var) $ actionToFactFormula $ ProgressTo to pos
-- let generate_progress_restrictions anP =
-- let pf = Progressfunction.generate anP in
-- let rec big_or = function
-- | [f] -> f
-- | f::fl -> Or(f,big_or fl)
-- | [] -> raise (ImplementationError "There should be at least one to position for every from.")
-- in
-- let lemma a bset =
-- let a'= Position.pos2string a
-- in
-- let pvar = "p "
-- in
-- let blist = (PSet.elements bset)
-- in
-- let progress_to =
-- (* List.map (fun p -> (sprintf "(Ex #t2. ProgressTo_%s(%s)@t2)" (pos2string p) pvar)) blist *)
-- List.map (fun p -> (Ex ( (VarSet.of_list [Temp "t2"]),
-- Atom ( At (Action("ProgressTo_"^(pos2string p),[Var (Msg pvar)]),Temp "t2")))))
-- blist
-- in
-- Restriction ( (sprintf "progress_%s_to_%s" a' (rule_name_part)),
-- All (VarSet.of_list [Msg pvar; Temp "t1"],
-- Imp( Atom ( At (Action("ProgressFrom_"^a',[Var (Msg pvar)]),Temp "t1")),
-- (big_or progress_to))))
-- in
-- (* let print_tosetset a bsetset = *)
-- (* PSetSet.fold (fun bset s -> (print_toset a bset) ^ s) bsetset "" *)
-- (* in *)
-- (* (PMap.fold (fun a bsetset s -> (print_tosetset a bsetset) ^ s) pf "") *)
-- let lemmas a bsetset = List.map (lemma a) (PSetSet.elements bsetset) in
-- List.flatten (PMap.fold (fun a bsetset s -> (lemmas a bsetset) :: s) pf [])
-- | generate restrictions depending on options set (op) and the structure
-- of the process (anP) | 3,029 | true | true | 0 | 14 | 1,041 | 490 | 255 | 235 | null | null |
mavenraven/github | samples/Gists/ShowGist.hs | bsd-3-clause | main = do
possibleGist <- Github.gist "23084"
case possibleGist of
(Left error) -> putStrLn $ "Error: " ++ (show error)
(Right gist) -> putStrLn $ formatGist gist | 175 | main = do
possibleGist <- Github.gist "23084"
case possibleGist of
(Left error) -> putStrLn $ "Error: " ++ (show error)
(Right gist) -> putStrLn $ formatGist gist | 175 | main = do
possibleGist <- Github.gist "23084"
case possibleGist of
(Left error) -> putStrLn $ "Error: " ++ (show error)
(Right gist) -> putStrLn $ formatGist gist | 175 | false | false | 1 | 13 | 39 | 74 | 33 | 41 | null | null |
Jem777/deepthought | src/Types.hs | gpl-3.0 | -- functions for the tree
treeName (Tree a _ _ _ _) = a | 56 | treeName (Tree a _ _ _ _) = a | 29 | treeName (Tree a _ _ _ _) = a | 29 | true | false | 0 | 7 | 14 | 24 | 12 | 12 | null | null |
madmann91/Ape | src/Ape/Type.hs | lgpl-3.0 | bitCount (F32 n) = n * 32 | 25 | bitCount (F32 n) = n * 32 | 25 | bitCount (F32 n) = n * 32 | 25 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
AndrewRademacher/poker | src/Poker/Classify.hs | mit | defaultHandRules :: [ClassifiactionT Identity (Maybe Hand)]
defaultHandRules = [ straightFlush, fourOfAKind, fullHouse, flush, straight, threeOfAKind, pairs, highCard ] | 168 | defaultHandRules :: [ClassifiactionT Identity (Maybe Hand)]
defaultHandRules = [ straightFlush, fourOfAKind, fullHouse, flush, straight, threeOfAKind, pairs, highCard ] | 168 | defaultHandRules = [ straightFlush, fourOfAKind, fullHouse, flush, straight, threeOfAKind, pairs, highCard ] | 108 | false | true | 0 | 8 | 17 | 49 | 29 | 20 | null | null |
MagneticDuck/simpleirc | Network/SimpleIRC/Core.hs | bsd-3-clause | remEvent :: MIrc -> Unique -> IO ()
remEvent mIrc uniq = do
s <- readMVar mIrc
writeChan (sCmdChan s) (SIrcRemoveEvent uniq) | 129 | remEvent :: MIrc -> Unique -> IO ()
remEvent mIrc uniq = do
s <- readMVar mIrc
writeChan (sCmdChan s) (SIrcRemoveEvent uniq) | 129 | remEvent mIrc uniq = do
s <- readMVar mIrc
writeChan (sCmdChan s) (SIrcRemoveEvent uniq) | 93 | false | true | 0 | 9 | 26 | 59 | 27 | 32 | null | null |
Oblosys/webviews | src/lib/WebViewPrim.hs | mit | -- TODO should script have all fields? Or is a missing field no problem (or preventable by type checker)
-- TODO generate script nodes before executing scripts? Now they are generated by the scripts, so either
-- child cannot refer to parent or parent cannot refer to child.
onClick :: (Widget (Button db)) -> String -> String
onClick button expr = onEvent "Click" button expr | 381 | onClick :: (Widget (Button db)) -> String -> String
onClick button expr = onEvent "Click" button expr | 101 | onClick button expr = onEvent "Click" button expr | 49 | true | true | 0 | 9 | 69 | 50 | 25 | 25 | null | null |
phadej/stack | src/Stack/Build/ConstructPlan.hs | bsd-3-clause | describeConfigDiff :: Config -> ConfigCache -> ConfigCache -> Maybe Text
describeConfigDiff config old new
| not (configCacheDeps new `Set.isSubsetOf` configCacheDeps old) = Just "dependencies changed"
| not $ Set.null newComponents =
Just $ "components added: " `T.append` T.intercalate ", "
(map (decodeUtf8With lenientDecode) (Set.toList newComponents))
| not (configCacheHaddock old) && configCacheHaddock new = Just "rebuilding with haddocks"
| oldOpts /= newOpts = Just $ T.pack $ concat
[ "flags changed from "
, show oldOpts
, " to "
, show newOpts
]
| otherwise = Nothing
where
stripGhcOptions =
go
where
go [] = []
go ("--ghc-option":x:xs) = go' x xs
go ("--ghc-options":x:xs) = go' x xs
go ((T.stripPrefix "--ghc-option=" -> Just x):xs) = go' x xs
go ((T.stripPrefix "--ghc-options=" -> Just x):xs) = go' x xs
go (x:xs) = x : go xs
go' x xs = checkKeepers x $ go xs
checkKeepers x xs =
case filter isKeeper $ T.words x of
[] -> xs
keepers -> "--ghc-options" : T.unwords keepers : xs
-- GHC options which affect build results and therefore should always
-- force a rebuild
--
-- For the most part, we only care about options generated by Stack
-- itself
isKeeper = (== "-fhpc") -- more to be added later
userOpts = filter (not . isStackOpt)
. (if configRebuildGhcOptions config
then id
else stripGhcOptions)
. map T.pack
. (\(ConfigureOpts x y) -> x ++ y)
. configCacheOpts
(oldOpts, newOpts) = removeMatching (userOpts old) (userOpts new)
removeMatching (x:xs) (y:ys)
| x == y = removeMatching xs ys
removeMatching xs ys = (xs, ys)
newComponents = configCacheComponents new `Set.difference` configCacheComponents old | 2,008 | describeConfigDiff :: Config -> ConfigCache -> ConfigCache -> Maybe Text
describeConfigDiff config old new
| not (configCacheDeps new `Set.isSubsetOf` configCacheDeps old) = Just "dependencies changed"
| not $ Set.null newComponents =
Just $ "components added: " `T.append` T.intercalate ", "
(map (decodeUtf8With lenientDecode) (Set.toList newComponents))
| not (configCacheHaddock old) && configCacheHaddock new = Just "rebuilding with haddocks"
| oldOpts /= newOpts = Just $ T.pack $ concat
[ "flags changed from "
, show oldOpts
, " to "
, show newOpts
]
| otherwise = Nothing
where
stripGhcOptions =
go
where
go [] = []
go ("--ghc-option":x:xs) = go' x xs
go ("--ghc-options":x:xs) = go' x xs
go ((T.stripPrefix "--ghc-option=" -> Just x):xs) = go' x xs
go ((T.stripPrefix "--ghc-options=" -> Just x):xs) = go' x xs
go (x:xs) = x : go xs
go' x xs = checkKeepers x $ go xs
checkKeepers x xs =
case filter isKeeper $ T.words x of
[] -> xs
keepers -> "--ghc-options" : T.unwords keepers : xs
-- GHC options which affect build results and therefore should always
-- force a rebuild
--
-- For the most part, we only care about options generated by Stack
-- itself
isKeeper = (== "-fhpc") -- more to be added later
userOpts = filter (not . isStackOpt)
. (if configRebuildGhcOptions config
then id
else stripGhcOptions)
. map T.pack
. (\(ConfigureOpts x y) -> x ++ y)
. configCacheOpts
(oldOpts, newOpts) = removeMatching (userOpts old) (userOpts new)
removeMatching (x:xs) (y:ys)
| x == y = removeMatching xs ys
removeMatching xs ys = (xs, ys)
newComponents = configCacheComponents new `Set.difference` configCacheComponents old | 2,008 | describeConfigDiff config old new
| not (configCacheDeps new `Set.isSubsetOf` configCacheDeps old) = Just "dependencies changed"
| not $ Set.null newComponents =
Just $ "components added: " `T.append` T.intercalate ", "
(map (decodeUtf8With lenientDecode) (Set.toList newComponents))
| not (configCacheHaddock old) && configCacheHaddock new = Just "rebuilding with haddocks"
| oldOpts /= newOpts = Just $ T.pack $ concat
[ "flags changed from "
, show oldOpts
, " to "
, show newOpts
]
| otherwise = Nothing
where
stripGhcOptions =
go
where
go [] = []
go ("--ghc-option":x:xs) = go' x xs
go ("--ghc-options":x:xs) = go' x xs
go ((T.stripPrefix "--ghc-option=" -> Just x):xs) = go' x xs
go ((T.stripPrefix "--ghc-options=" -> Just x):xs) = go' x xs
go (x:xs) = x : go xs
go' x xs = checkKeepers x $ go xs
checkKeepers x xs =
case filter isKeeper $ T.words x of
[] -> xs
keepers -> "--ghc-options" : T.unwords keepers : xs
-- GHC options which affect build results and therefore should always
-- force a rebuild
--
-- For the most part, we only care about options generated by Stack
-- itself
isKeeper = (== "-fhpc") -- more to be added later
userOpts = filter (not . isStackOpt)
. (if configRebuildGhcOptions config
then id
else stripGhcOptions)
. map T.pack
. (\(ConfigureOpts x y) -> x ++ y)
. configCacheOpts
(oldOpts, newOpts) = removeMatching (userOpts old) (userOpts new)
removeMatching (x:xs) (y:ys)
| x == y = removeMatching xs ys
removeMatching xs ys = (xs, ys)
newComponents = configCacheComponents new `Set.difference` configCacheComponents old | 1,935 | false | true | 2 | 13 | 646 | 627 | 314 | 313 | null | null |
patperry/hs-linear-algebra | tests-old/STVector.hs | bsd-3-clause | commutes2 :: (AEq a, Show a, AEq e, BLAS1 e) =>
STVector s e -> STVector s e ->
(STVector s e -> STVector s e -> ST s a) ->
([e] -> [e] -> (a,[e],[e])) -> ST s Bool
commutes2 x y a f = do
oldX <- abstract x
oldY <- abstract y
r <- a x y
newX <- abstract x
newY <- abstract y
let s = f oldX oldY
s' = (r,newX,newY)
passed = s ~== s'
when (not passed) $
trace (printf ("expected `%s' but got `%s'") (show s) (show s'))
return ()
return passed | 557 | commutes2 :: (AEq a, Show a, AEq e, BLAS1 e) =>
STVector s e -> STVector s e ->
(STVector s e -> STVector s e -> ST s a) ->
([e] -> [e] -> (a,[e],[e])) -> ST s Bool
commutes2 x y a f = do
oldX <- abstract x
oldY <- abstract y
r <- a x y
newX <- abstract x
newY <- abstract y
let s = f oldX oldY
s' = (r,newX,newY)
passed = s ~== s'
when (not passed) $
trace (printf ("expected `%s' but got `%s'") (show s) (show s'))
return ()
return passed | 557 | commutes2 x y a f = do
oldX <- abstract x
oldY <- abstract y
r <- a x y
newX <- abstract x
newY <- abstract y
let s = f oldX oldY
s' = (r,newX,newY)
passed = s ~== s'
when (not passed) $
trace (printf ("expected `%s' but got `%s'") (show s) (show s'))
return ()
return passed | 374 | false | true | 0 | 14 | 217 | 281 | 137 | 144 | null | null |
sdiehl/ghc | compiler/basicTypes/Lexeme.hs | bsd-3-clause | -- | Is this an acceptable constructor name?
okConOcc :: String -> Bool
okConOcc str@(c:_)
| startsConId c
= okConIdOcc str
| startsConSym c
= okConSymOcc str
| str == "[]"
= True | 191 | okConOcc :: String -> Bool
okConOcc str@(c:_)
| startsConId c
= okConIdOcc str
| startsConSym c
= okConSymOcc str
| str == "[]"
= True | 146 | okConOcc str@(c:_)
| startsConId c
= okConIdOcc str
| startsConSym c
= okConSymOcc str
| str == "[]"
= True | 119 | true | true | 2 | 8 | 44 | 68 | 32 | 36 | null | null |
tcsc/ffs | src/Ffs/Time.hs | mit | getTimeInZone :: TimeZone -> IO ZonedTime
getTimeInZone tz = utcToZonedTime tz <$> getCurrentTime | 97 | getTimeInZone :: TimeZone -> IO ZonedTime
getTimeInZone tz = utcToZonedTime tz <$> getCurrentTime | 97 | getTimeInZone tz = utcToZonedTime tz <$> getCurrentTime | 55 | false | true | 0 | 7 | 12 | 33 | 14 | 19 | null | null |
robinp/haskell-toys | src/Toys/LazyRec.hs | bsd-3-clause | main = do
--mapM_ print $ refek prog
mapM_ print $ refekM2 prog | 67 | main = do
--mapM_ print $ refek prog
mapM_ print $ refekM2 prog | 67 | main = do
--mapM_ print $ refek prog
mapM_ print $ refekM2 prog | 67 | false | false | 1 | 9 | 16 | 24 | 9 | 15 | null | null |
DanielWaterworth/Idris-dev | src/IRTS/CodegenLLVM.hs | bsd-3-clause | cgExpr (SLet _ varExpr bodyExpr) = do
val <- cgExpr varExpr
binds [val] $ cgExpr bodyExpr | 93 | cgExpr (SLet _ varExpr bodyExpr) = do
val <- cgExpr varExpr
binds [val] $ cgExpr bodyExpr | 93 | cgExpr (SLet _ varExpr bodyExpr) = do
val <- cgExpr varExpr
binds [val] $ cgExpr bodyExpr | 93 | false | false | 0 | 9 | 19 | 45 | 20 | 25 | null | null |
mcschroeder/ttrie | benchmarks/Bench.hs | mit | hashmapEval Delete k m = modifyTVar' m (HashMap.delete k) | 57 | hashmapEval Delete k m = modifyTVar' m (HashMap.delete k) | 57 | hashmapEval Delete k m = modifyTVar' m (HashMap.delete k) | 57 | false | false | 0 | 8 | 8 | 26 | 12 | 14 | null | null |
RefactoringTools/HaRe | old/testing/introThreshold/UTest.hs | bsd-3-clause | egativeTest system pfeCmd cacheCmd refactorCmd args
=TestCase (do let inputFiles = fst args
tokExpOutputFiles=map (createNewFileName "_TokOut") inputFiles
tempFiles = map (createNewFileName "_temp") inputFiles
params =refactorCmd: ((head inputFiles) : (snd (snd args)))
inputTemps =zip inputFiles tempFiles
inputOutputs=zip inputFiles tokExpOutputFiles
mapM (createTempFile system) inputTemps
system ("echo " ++ concatMap (\t->t ++ " ") params ++ " |" ++ pfeCmd)
results<-mapM (compareResult system) inputOutputs
mapM (recoverFiles system) inputTemps
mapM (rmTempFiles system) tempFiles
assertEqual (show (refactorCmd,args)) True (all (==ExitSuccess) results)
)
| 913 | negativeTest system pfeCmd cacheCmd refactorCmd args
=TestCase (do let inputFiles = fst args
tokExpOutputFiles=map (createNewFileName "_TokOut") inputFiles
tempFiles = map (createNewFileName "_temp") inputFiles
params =refactorCmd: ((head inputFiles) : (snd (snd args)))
inputTemps =zip inputFiles tempFiles
inputOutputs=zip inputFiles tokExpOutputFiles
mapM (createTempFile system) inputTemps
system ("echo " ++ concatMap (\t->t ++ " ") params ++ " |" ++ pfeCmd)
results<-mapM (compareResult system) inputOutputs
mapM (recoverFiles system) inputTemps
mapM (rmTempFiles system) tempFiles
assertEqual (show (refactorCmd,args)) True (all (==ExitSuccess) results)
) | 913 | negativeTest system pfeCmd cacheCmd refactorCmd args
=TestCase (do let inputFiles = fst args
tokExpOutputFiles=map (createNewFileName "_TokOut") inputFiles
tempFiles = map (createNewFileName "_temp") inputFiles
params =refactorCmd: ((head inputFiles) : (snd (snd args)))
inputTemps =zip inputFiles tempFiles
inputOutputs=zip inputFiles tokExpOutputFiles
mapM (createTempFile system) inputTemps
system ("echo " ++ concatMap (\t->t ++ " ") params ++ " |" ++ pfeCmd)
results<-mapM (compareResult system) inputOutputs
mapM (recoverFiles system) inputTemps
mapM (rmTempFiles system) tempFiles
assertEqual (show (refactorCmd,args)) True (all (==ExitSuccess) results)
) | 913 | false | false | 0 | 18 | 328 | 253 | 123 | 130 | null | null |
czchen/haskell-gosper | src/lib/Gosper.hs | mit | getNext :: Integer -> Integer
getNext x
| x <= 0 = 0
| otherwise =
let
y = x .&. (- x)
c = x + y
in
(((x `xor` c) `shiftR` 2) `div` y) .|. c | 200 | getNext :: Integer -> Integer
getNext x
| x <= 0 = 0
| otherwise =
let
y = x .&. (- x)
c = x + y
in
(((x `xor` c) `shiftR` 2) `div` y) .|. c | 200 | getNext x
| x <= 0 = 0
| otherwise =
let
y = x .&. (- x)
c = x + y
in
(((x `xor` c) `shiftR` 2) `div` y) .|. c | 170 | false | true | 1 | 13 | 97 | 96 | 52 | 44 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Custom/Navigator.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/Navigator.webkitGetUserMedia Mozilla Navigator.webkitGetUserMedia documentation>
getUserMedia' :: MonadDOM m => Navigator -> MediaStreamConstraints -> m (Either NavigatorUserMediaError MediaStream)
getUserMedia' self constraints = do
result <- liftIO newEmptyMVar
withCallback (newNavigatorUserMediaSuccessCallback (liftIO . putMVar result . Right)) $ \success ->
withCallback (newNavigatorUserMediaErrorCallback (liftIO . putMVar result . Left)) $ \error -> do
Generated.getUserMedia self constraints success error
liftIO $ takeMVar result | 635 | getUserMedia' :: MonadDOM m => Navigator -> MediaStreamConstraints -> m (Either NavigatorUserMediaError MediaStream)
getUserMedia' self constraints = do
result <- liftIO newEmptyMVar
withCallback (newNavigatorUserMediaSuccessCallback (liftIO . putMVar result . Right)) $ \success ->
withCallback (newNavigatorUserMediaErrorCallback (liftIO . putMVar result . Left)) $ \error -> do
Generated.getUserMedia self constraints success error
liftIO $ takeMVar result | 499 | getUserMedia' self constraints = do
result <- liftIO newEmptyMVar
withCallback (newNavigatorUserMediaSuccessCallback (liftIO . putMVar result . Right)) $ \success ->
withCallback (newNavigatorUserMediaErrorCallback (liftIO . putMVar result . Left)) $ \error -> do
Generated.getUserMedia self constraints success error
liftIO $ takeMVar result | 382 | true | true | 0 | 16 | 99 | 144 | 68 | 76 | null | null |
nomeata/ghc | compiler/nativeGen/PPC/Regs.hs | bsd-3-clause | globalRegMaybe HpLim = Just (RealRegSingle REG_HpLim) | 72 | globalRegMaybe HpLim = Just (RealRegSingle REG_HpLim) | 72 | globalRegMaybe HpLim = Just (RealRegSingle REG_HpLim) | 72 | false | false | 0 | 7 | 24 | 19 | 8 | 11 | null | null |
chrisdone/path | src/Path/Include.hs | bsd-3-clause | dirname (Path l) = Path (last (FilePath.splitPath l)) | 53 | dirname (Path l) = Path (last (FilePath.splitPath l)) | 53 | dirname (Path l) = Path (last (FilePath.splitPath l)) | 53 | false | false | 0 | 10 | 7 | 32 | 15 | 17 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.