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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sdiehl/ghc | libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs | bsd-3-clause | openTypeFamilyD :: Quote m => Name -> [m TyVarBndr] -> m FamilyResultSig
-> Maybe InjectivityAnn -> m Dec
openTypeFamilyD tc tvs res inj =
do tvs' <- sequenceA tvs
res' <- res
pure $ OpenTypeFamilyD (TypeFamilyHead tc tvs' res' inj) | 260 | openTypeFamilyD :: Quote m => Name -> [m TyVarBndr] -> m FamilyResultSig
-> Maybe InjectivityAnn -> m Dec
openTypeFamilyD tc tvs res inj =
do tvs' <- sequenceA tvs
res' <- res
pure $ OpenTypeFamilyD (TypeFamilyHead tc tvs' res' inj) | 260 | openTypeFamilyD tc tvs res inj =
do tvs' <- sequenceA tvs
res' <- res
pure $ OpenTypeFamilyD (TypeFamilyHead tc tvs' res' inj) | 138 | false | true | 0 | 10 | 67 | 97 | 44 | 53 | null | null |
tolysz/vector-algorithms | src/Data/Vector/Algorithms/Optimal.hs | bsd-3-clause | -- | Sorts the elements at the two given indices using the comparison. This
-- is essentially a compare-and-swap, although the first index is assumed to
-- be the 'lower' of the two.
sort2ByIndex :: (PrimMonad m, MVector v e)
=> Comparison e -> v (PrimState m) e -> Int -> Int -> m ()
sort2ByIndex cmp a i j = UNSAFE_CHECK(checkIndex) "sort2ByIndex" i (length a)
$ UNSAFE_CHECK(checkIndex) "sort2ByIndex" j (length a) $ do
a0 <- unsafeRead a i
a1 <- unsafeRead a j
case cmp a0 a1 of
GT -> unsafeWrite a i a1 >> unsafeWrite a j a0
_ -> return ()
| 597 | sort2ByIndex :: (PrimMonad m, MVector v e)
=> Comparison e -> v (PrimState m) e -> Int -> Int -> m ()
sort2ByIndex cmp a i j = UNSAFE_CHECK(checkIndex) "sort2ByIndex" i (length a)
$ UNSAFE_CHECK(checkIndex) "sort2ByIndex" j (length a) $ do
a0 <- unsafeRead a i
a1 <- unsafeRead a j
case cmp a0 a1 of
GT -> unsafeWrite a i a1 >> unsafeWrite a j a0
_ -> return ()
| 414 | sort2ByIndex cmp a i j = UNSAFE_CHECK(checkIndex) "sort2ByIndex" i (length a)
$ UNSAFE_CHECK(checkIndex) "sort2ByIndex" j (length a) $ do
a0 <- unsafeRead a i
a1 <- unsafeRead a j
case cmp a0 a1 of
GT -> unsafeWrite a i a1 >> unsafeWrite a j a0
_ -> return ()
| 299 | true | true | 0 | 12 | 156 | 190 | 91 | 99 | null | null |
keera-studios/hssdl | Examples/NeHe/lesson08/lesson8.sdl.hs | bsd-3-clause | main = withInit [InitVideo] $
do progName <- getProgName
setVideoMode width height 0 [OpenGL,Resizeable]
setCaption progName ""
resizeGLScene width height
initAndRun
where width = 640
height = 480 | 257 | main = withInit [InitVideo] $
do progName <- getProgName
setVideoMode width height 0 [OpenGL,Resizeable]
setCaption progName ""
resizeGLScene width height
initAndRun
where width = 640
height = 480 | 257 | main = withInit [InitVideo] $
do progName <- getProgName
setVideoMode width height 0 [OpenGL,Resizeable]
setCaption progName ""
resizeGLScene width height
initAndRun
where width = 640
height = 480 | 257 | false | false | 1 | 9 | 88 | 77 | 34 | 43 | null | null |
nymacro/hs-kmip | src/Ttlv/Validator/Operations.hs | bsd-3-clause | serverRequestOperation = serverNotifyRequest <|>
serverPutRequest | 90 | serverRequestOperation = serverNotifyRequest <|>
serverPutRequest | 90 | serverRequestOperation = serverNotifyRequest <|>
serverPutRequest | 90 | false | false | 0 | 5 | 29 | 10 | 5 | 5 | null | null |
rodneyp290/Brainfunc | src/Execution.hs | bsd-3-clause | instruction Decr code tape = pure (code, decrReg tape) | 54 | instruction Decr code tape = pure (code, decrReg tape) | 54 | instruction Decr code tape = pure (code, decrReg tape) | 54 | false | false | 0 | 7 | 8 | 25 | 12 | 13 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Protocol.hs | bsd-3-clause | parseQueryResult (IfThenElseFloatW32 _ _ _) (IfThenElseFloatLeftReply r) = Just $ exprLeft $ lit r | 98 | parseQueryResult (IfThenElseFloatW32 _ _ _) (IfThenElseFloatLeftReply r) = Just $ exprLeft $ lit r | 98 | parseQueryResult (IfThenElseFloatW32 _ _ _) (IfThenElseFloatLeftReply r) = Just $ exprLeft $ lit r | 98 | false | false | 0 | 7 | 13 | 38 | 18 | 20 | null | null |
valderman/selda | selda/src/Database/Selda/SqlType.hs | mit | litConTag (LUUID{}) = 13 | 28 | litConTag (LUUID{}) = 13 | 28 | litConTag (LUUID{}) = 13 | 28 | false | false | 0 | 7 | 7 | 16 | 8 | 8 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/show_2.hs | mit | modMyInt :: MyInt -> MyInt -> MyInt
modMyInt = primModInt | 61 | modMyInt :: MyInt -> MyInt -> MyInt
modMyInt = primModInt | 61 | modMyInt = primModInt | 21 | false | true | 0 | 8 | 13 | 26 | 11 | 15 | null | null |
oldmanmike/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | gHC_STACK_TYPES = mkBaseModule (fsLit "GHC.Stack.Types") | 56 | gHC_STACK_TYPES = mkBaseModule (fsLit "GHC.Stack.Types") | 56 | gHC_STACK_TYPES = mkBaseModule (fsLit "GHC.Stack.Types") | 56 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
egison/egison | hs-src/Language/Egison/PrettyMath/Mathematica.hs | mit | showMathExpr (Multiply (NegativeAtom "1":xs)) = "-" ++ showMathExpr (Multiply xs) | 81 | showMathExpr (Multiply (NegativeAtom "1":xs)) = "-" ++ showMathExpr (Multiply xs) | 81 | showMathExpr (Multiply (NegativeAtom "1":xs)) = "-" ++ showMathExpr (Multiply xs) | 81 | false | false | 0 | 9 | 9 | 39 | 18 | 21 | null | null |
kazu-yamamoto/http2 | Network/HPACK/Table/RevIndex.hs | bsd-3-clause | deleteDynamicRevIndex :: Token -> HeaderValue -> DynamicRevIndex -> IO ()
deleteDynamicRevIndex t v drev = modifyIORef ref $ M.delete v
where
ref = drev `unsafeAt` tokenIx t
---------------------------------------------------------------- | 245 | deleteDynamicRevIndex :: Token -> HeaderValue -> DynamicRevIndex -> IO ()
deleteDynamicRevIndex t v drev = modifyIORef ref $ M.delete v
where
ref = drev `unsafeAt` tokenIx t
---------------------------------------------------------------- | 245 | deleteDynamicRevIndex t v drev = modifyIORef ref $ M.delete v
where
ref = drev `unsafeAt` tokenIx t
---------------------------------------------------------------- | 171 | false | true | 0 | 9 | 34 | 65 | 32 | 33 | null | null |
ktvoelker/KB | clay/Colors.hs | gpl-3.0 | noteButtonHover = colors (darkMain, white) | 42 | noteButtonHover = colors (darkMain, white) | 42 | noteButtonHover = colors (darkMain, white) | 42 | false | false | 0 | 6 | 4 | 15 | 8 | 7 | null | null |
snoyberg/ghc | compiler/typecheck/TcAnnotations.hs | bsd-3-clause | tcAnnotations :: [LAnnDecl Name] -> TcM [Annotation]
-- No GHCI; emit a warning (not an error) and ignore. cf Trac #4268
tcAnnotations [] = return [] | 149 | tcAnnotations :: [LAnnDecl Name] -> TcM [Annotation]
tcAnnotations [] = return [] | 81 | tcAnnotations [] = return [] | 28 | true | true | 0 | 7 | 25 | 38 | 19 | 19 | null | null |
mplamann/magic-spieler | src/Action.hs | mit | runAction (DeclareBlocker _ pair) = do
blockers <>= [pair]
ioRequest .= Just IOReqChooseBlocker | 99 | runAction (DeclareBlocker _ pair) = do
blockers <>= [pair]
ioRequest .= Just IOReqChooseBlocker | 99 | runAction (DeclareBlocker _ pair) = do
blockers <>= [pair]
ioRequest .= Just IOReqChooseBlocker | 99 | false | false | 0 | 8 | 16 | 38 | 17 | 21 | null | null |
siddhanathan/ghc | libraries/base/Text/Printf.hs | bsd-3-clause | -- | Formatter for 'String' values.
--
-- @since 4.7.0.0
formatString :: IsChar a => [a] -> FieldFormatter
formatString x ufmt =
case fmtChar $ vFmt 's' ufmt of
's' -> map toChar . (adjust ufmt ("", ts) ++)
where
ts = map toChar $ trunc $ fmtPrecision ufmt
where
trunc Nothing = x
trunc (Just n) = take n x
c -> errorBadFormat c
-- Possibly apply the int modifiers to get a new
-- int width for conversion. | 492 | formatString :: IsChar a => [a] -> FieldFormatter
formatString x ufmt =
case fmtChar $ vFmt 's' ufmt of
's' -> map toChar . (adjust ufmt ("", ts) ++)
where
ts = map toChar $ trunc $ fmtPrecision ufmt
where
trunc Nothing = x
trunc (Just n) = take n x
c -> errorBadFormat c
-- Possibly apply the int modifiers to get a new
-- int width for conversion. | 435 | formatString x ufmt =
case fmtChar $ vFmt 's' ufmt of
's' -> map toChar . (adjust ufmt ("", ts) ++)
where
ts = map toChar $ trunc $ fmtPrecision ufmt
where
trunc Nothing = x
trunc (Just n) = take n x
c -> errorBadFormat c
-- Possibly apply the int modifiers to get a new
-- int width for conversion. | 385 | true | true | 0 | 14 | 165 | 140 | 70 | 70 | null | null |
cbrghostrider/Hacking | HackerRank/FunctionalProgramming/Recursion/cellular_automata_memoize_attempt.hs | mit | simulateAutomataStep parentv rule (Branch v l r) =
let pv = if parentv == Nothing then False else fromMaybe False parentv
mynewval = getNextState rule (pv, treeVal l, v, treeVal r)
mynewleft = simulateAutomataStep (Just v) rule l
mynewright = simulateAutomataStep (Just v) rule r
in Branch mynewval mynewleft mynewright | 354 | simulateAutomataStep parentv rule (Branch v l r) =
let pv = if parentv == Nothing then False else fromMaybe False parentv
mynewval = getNextState rule (pv, treeVal l, v, treeVal r)
mynewleft = simulateAutomataStep (Just v) rule l
mynewright = simulateAutomataStep (Just v) rule r
in Branch mynewval mynewleft mynewright | 354 | simulateAutomataStep parentv rule (Branch v l r) =
let pv = if parentv == Nothing then False else fromMaybe False parentv
mynewval = getNextState rule (pv, treeVal l, v, treeVal r)
mynewleft = simulateAutomataStep (Just v) rule l
mynewright = simulateAutomataStep (Just v) rule r
in Branch mynewval mynewleft mynewright | 354 | false | false | 0 | 11 | 84 | 122 | 61 | 61 | null | null |
stevezhee/eel | src/Eel.hs | bsd-3-clause | newVar :: Ty a => M (V a)
newVar = let b = newVarT (ty b) in b | 62 | newVar :: Ty a => M (V a)
newVar = let b = newVarT (ty b) in b | 62 | newVar = let b = newVarT (ty b) in b | 36 | false | true | 0 | 11 | 17 | 47 | 22 | 25 | null | null |
nbrunt/JSHOP | src/Analyser.hs | mit | anAddExpr (Plus addExpr multExpr) = anAddExpr addExpr >> anMultExpr multExpr | 77 | anAddExpr (Plus addExpr multExpr) = anAddExpr addExpr >> anMultExpr multExpr | 77 | anAddExpr (Plus addExpr multExpr) = anAddExpr addExpr >> anMultExpr multExpr | 77 | false | false | 0 | 7 | 10 | 27 | 12 | 15 | null | null |
swift-nav/plover | src/Language/Plover/CodeGen.hs | mit | compileStructDef :: DefBinding -> [StructMember] -> CM [C.Definition]
compileStructDef defb members = do cmembs <- forM members $ \(v, (vpos, exty, _)) -> do
(bl, cty) <- withCode $ compileInitType exty
when (not $ null bl) $ codegenError vpos $
"The struct member has a type which is too complicated for the code generator (sorry)."
return [csdecl| $ty:cty $id:v; |]
return [ [cedecl| typedef struct $id:name { $sdecls:cmembs } $id:name; |] ]
where name = binding defb | 656 | compileStructDef :: DefBinding -> [StructMember] -> CM [C.Definition]
compileStructDef defb members = do cmembs <- forM members $ \(v, (vpos, exty, _)) -> do
(bl, cty) <- withCode $ compileInitType exty
when (not $ null bl) $ codegenError vpos $
"The struct member has a type which is too complicated for the code generator (sorry)."
return [csdecl| $ty:cty $id:v; |]
return [ [cedecl| typedef struct $id:name { $sdecls:cmembs } $id:name; |] ]
where name = binding defb | 656 | compileStructDef defb members = do cmembs <- forM members $ \(v, (vpos, exty, _)) -> do
(bl, cty) <- withCode $ compileInitType exty
when (not $ null bl) $ codegenError vpos $
"The struct member has a type which is too complicated for the code generator (sorry)."
return [csdecl| $ty:cty $id:v; |]
return [ [cedecl| typedef struct $id:name { $sdecls:cmembs } $id:name; |] ]
where name = binding defb | 586 | false | true | 1 | 17 | 263 | 158 | 79 | 79 | null | null |
kulshrax/haskml | src/Tags.hs | mit | input :: HtmlLeaf
input = newVoid "input" | 41 | input :: HtmlLeaf
input = newVoid "input" | 41 | input = newVoid "input" | 23 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
mpickering/ghc-exactprint | tests/examples/ghc710/TupleSections.hs | bsd-3-clause | foo = do
liftIO $ atomicModifyIORef ciTokens ((,()) . f)
liftIO $ atomicModifyIORef ciTokens (((),) . f)
liftIO $ atomicModifyIORef ciTokens ((,) . f)
-- | Make bilateral dictionary from PoliMorf. | 203 | foo = do
liftIO $ atomicModifyIORef ciTokens ((,()) . f)
liftIO $ atomicModifyIORef ciTokens (((),) . f)
liftIO $ atomicModifyIORef ciTokens ((,) . f)
-- | Make bilateral dictionary from PoliMorf. | 203 | foo = do
liftIO $ atomicModifyIORef ciTokens ((,()) . f)
liftIO $ atomicModifyIORef ciTokens (((),) . f)
liftIO $ atomicModifyIORef ciTokens ((,) . f)
-- | Make bilateral dictionary from PoliMorf. | 203 | false | false | 1 | 13 | 37 | 83 | 41 | 42 | null | null |
mightymoose/liquidhaskell | src/Language/Haskell/Liquid/PrettyPrint.hs | bsd-3-clause | ppSpine (RRTy _ _ _ _) = text "RRTy" | 38 | ppSpine (RRTy _ _ _ _) = text "RRTy" | 38 | ppSpine (RRTy _ _ _ _) = text "RRTy" | 38 | false | false | 0 | 7 | 10 | 24 | 11 | 13 | null | null |
guoy34/ampersand | src/Database/Design/Ampersand/Input/ADL1/ParsingLib.hs | gpl-3.0 | pZero :: AmpParser String
pZero = pNumber 0 | 43 | pZero :: AmpParser String
pZero = pNumber 0 | 43 | pZero = pNumber 0 | 17 | false | true | 1 | 5 | 7 | 20 | 8 | 12 | null | null |
alphalambda/codeworld | codeworld-compiler/src/CodeWorld/Compile/Requirements/Matcher.hs | apache-2.0 | matchesSpecials (toSplice ->
Just (HsUntypedSplice _ _ _ (L _ (HsApp _ op (L _ (ExplicitList _ _ (sequence . map (\(L _ (HsBracket _ b)) -> fromBracket b) -> Just xs))))))) x =
matchLogical op xs x | 205 | matchesSpecials (toSplice ->
Just (HsUntypedSplice _ _ _ (L _ (HsApp _ op (L _ (ExplicitList _ _ (sequence . map (\(L _ (HsBracket _ b)) -> fromBracket b) -> Just xs))))))) x =
matchLogical op xs x | 205 | matchesSpecials (toSplice ->
Just (HsUntypedSplice _ _ _ (L _ (HsApp _ op (L _ (ExplicitList _ _ (sequence . map (\(L _ (HsBracket _ b)) -> fromBracket b) -> Just xs))))))) x =
matchLogical op xs x | 205 | false | false | 1 | 27 | 45 | 123 | 59 | 64 | null | null |
vikraman/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | tcSplitFunTy_maybe _ = Nothing | 65 | tcSplitFunTy_maybe _ = Nothing | 65 | tcSplitFunTy_maybe _ = Nothing | 65 | false | false | 0 | 4 | 38 | 10 | 4 | 6 | null | null |
randallalexander/LYAH | src/Ch4.hs | bsd-3-clause | sayMe nope = "Blarg!" | 21 | sayMe nope = "Blarg!" | 21 | sayMe nope = "Blarg!" | 21 | false | false | 0 | 4 | 3 | 9 | 4 | 5 | null | null |
sandrolovnicki/lambda-calculus-interpreter | src/Parser.hs | mit | parseDetailed :: Parser EvaluateOption
parseDetailed = Detailed <$ reserved ":d" | 80 | parseDetailed :: Parser EvaluateOption
parseDetailed = Detailed <$ reserved ":d" | 80 | parseDetailed = Detailed <$ reserved ":d" | 41 | false | true | 0 | 6 | 9 | 21 | 10 | 11 | null | null |
cdxr/haskell-interface | module-diff/Render.hs | bsd-3-clause | qual :: Qual String -> RDoc
qual q = RDoc $ do
qc <- asks reQualContext
pure $ text $ resolveQual qc q | 110 | qual :: Qual String -> RDoc
qual q = RDoc $ do
qc <- asks reQualContext
pure $ text $ resolveQual qc q | 110 | qual q = RDoc $ do
qc <- asks reQualContext
pure $ text $ resolveQual qc q | 82 | false | true | 0 | 9 | 30 | 51 | 23 | 28 | null | null |
Mathnerd314/lamdu | src/Lamdu/CodeEdit/Sugar/Convert/Hole.hs | gpl-3.0 | pickResult ::
MonadA m =>
ExprIRef.ExpressionIM m ->
ExprIRef.ExpressionM m (Infer.Inferred (DefI (Tag m)), Maybe (StorePoint (Tag m))) ->
T m (Maybe Guid)
pickResult exprIRef =
fmap
( fmap (ExprIRef.exprGuid . (^. Expr.ePayload . Lens._1))
. listToMaybe . orderedInnerHoles
) .
writeExprMStored exprIRef . fmap swap | 334 | pickResult ::
MonadA m =>
ExprIRef.ExpressionIM m ->
ExprIRef.ExpressionM m (Infer.Inferred (DefI (Tag m)), Maybe (StorePoint (Tag m))) ->
T m (Maybe Guid)
pickResult exprIRef =
fmap
( fmap (ExprIRef.exprGuid . (^. Expr.ePayload . Lens._1))
. listToMaybe . orderedInnerHoles
) .
writeExprMStored exprIRef . fmap swap | 334 | pickResult exprIRef =
fmap
( fmap (ExprIRef.exprGuid . (^. Expr.ePayload . Lens._1))
. listToMaybe . orderedInnerHoles
) .
writeExprMStored exprIRef . fmap swap | 170 | false | true | 0 | 15 | 63 | 142 | 69 | 73 | null | null |
notae/haskell-exercise | cp/CFPFD1.hs | bsd-3-clause | alldiffmod :: Integral a => a -> [Var s a] -> FD s ()
alldiffmod _ [] = return () | 85 | alldiffmod :: Integral a => a -> [Var s a] -> FD s ()
alldiffmod _ [] = return () | 85 | alldiffmod _ [] = return () | 31 | false | true | 0 | 9 | 23 | 53 | 25 | 28 | null | null |
fmthoma/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | tcSplitSigmaTy :: Type -> ([TyVar], ThetaType, Type)
tcSplitSigmaTy ty = case tcSplitForAllTys ty of
(tvs, rho) -> case tcSplitPhiTy rho of
(theta, tau) -> (tvs, theta, tau)
----------------------- | 262 | tcSplitSigmaTy :: Type -> ([TyVar], ThetaType, Type)
tcSplitSigmaTy ty = case tcSplitForAllTys ty of
(tvs, rho) -> case tcSplitPhiTy rho of
(theta, tau) -> (tvs, theta, tau)
----------------------- | 262 | tcSplitSigmaTy ty = case tcSplitForAllTys ty of
(tvs, rho) -> case tcSplitPhiTy rho of
(theta, tau) -> (tvs, theta, tau)
----------------------- | 209 | false | true | 0 | 11 | 92 | 78 | 44 | 34 | null | null |
CindyLinz/Haskell.js | trans/src/Desugar/LambdaCase.hs | mit | deLambdaCaseInstHead (IHInfix l type0 qName) = IHInfix (id l) (deLambdaCaseType type0) (deLambdaCaseQName qName) | 112 | deLambdaCaseInstHead (IHInfix l type0 qName) = IHInfix (id l) (deLambdaCaseType type0) (deLambdaCaseQName qName) | 112 | deLambdaCaseInstHead (IHInfix l type0 qName) = IHInfix (id l) (deLambdaCaseType type0) (deLambdaCaseQName qName) | 112 | false | false | 0 | 7 | 12 | 44 | 21 | 23 | null | null |
truls/almique | src/Almique/Analyzer.hs | gpl-3.0 | genExpr (PSelfDot v) = SMEIL.Var . SMEIL.NamedVar SMEIL.AnyType <$> pure v | 74 | genExpr (PSelfDot v) = SMEIL.Var . SMEIL.NamedVar SMEIL.AnyType <$> pure v | 74 | genExpr (PSelfDot v) = SMEIL.Var . SMEIL.NamedVar SMEIL.AnyType <$> pure v | 74 | false | false | 0 | 8 | 10 | 36 | 16 | 20 | null | null |
mariefarrell/Hets | Common/MathLink.hs | gpl-2.0 | dfMLTKAPCTEND = 10 | 18 | dfMLTKAPCTEND = 10 | 18 | dfMLTKAPCTEND = 10 | 18 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
mudphone/HaskellBook | src/Tree.hs | mit | preorder :: BinaryTree a -> [a]
preorder Leaf = [] | 50 | preorder :: BinaryTree a -> [a]
preorder Leaf = [] | 50 | preorder Leaf = [] | 18 | false | true | 0 | 8 | 9 | 32 | 14 | 18 | null | null |
barrucadu/cabal-info | library/Cabal/Info.hs | mit | -- * Utils
-- | Flipped fmap
(<$$>) :: Functor f => f a -> (a -> b) -> f b
(<$$>) = flip fmap | 94 | (<$$>) :: Functor f => f a -> (a -> b) -> f b
(<$$>) = flip fmap | 64 | (<$$>) = flip fmap | 18 | true | true | 0 | 9 | 25 | 48 | 26 | 22 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_212 (105#) = happyGoto action_352 | 40 | action_212 (105#) = happyGoto action_352 | 40 | action_212 (105#) = happyGoto action_352 | 40 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
jb55/cabal2nix | src/Cabal2Nix/PostProcess.hs | bsd-3-clause | xmonadPostInstall :: String
xmonadPostInstall = unlines
[ "postInstall = ''"
, " shopt -s globstar"
, " mkdir -p $out/share/man/man1"
, " mv \"$out/\"**\"/man/\"*.1 $out/share/man/man1/"
, "'';"
] | 211 | xmonadPostInstall :: String
xmonadPostInstall = unlines
[ "postInstall = ''"
, " shopt -s globstar"
, " mkdir -p $out/share/man/man1"
, " mv \"$out/\"**\"/man/\"*.1 $out/share/man/man1/"
, "'';"
] | 211 | xmonadPostInstall = unlines
[ "postInstall = ''"
, " shopt -s globstar"
, " mkdir -p $out/share/man/man1"
, " mv \"$out/\"**\"/man/\"*.1 $out/share/man/man1/"
, "'';"
] | 183 | false | true | 0 | 5 | 42 | 29 | 17 | 12 | null | null |
urbanslug/ghc | utils/testremove/checkremove.hs | bsd-3-clause | pprTree :: Tree -> [String]
pprTree t = f [] t
where f ps (Node fi m) = (pprInfo fi ++ " " ++ fromFilePathFragments ps)
: concat [ f (p : ps) m' | (p, m') <- Map.toList m ] | 203 | pprTree :: Tree -> [String]
pprTree t = f [] t
where f ps (Node fi m) = (pprInfo fi ++ " " ++ fromFilePathFragments ps)
: concat [ f (p : ps) m' | (p, m') <- Map.toList m ] | 203 | pprTree t = f [] t
where f ps (Node fi m) = (pprInfo fi ++ " " ++ fromFilePathFragments ps)
: concat [ f (p : ps) m' | (p, m') <- Map.toList m ] | 175 | false | true | 2 | 10 | 71 | 117 | 54 | 63 | null | null |
jamshidh/ethereum-rlp | src/Blockchain/Data/RLP.hs | bsd-3-clause | rlpSplit (x:rest) | x >= 0xB8 && x <= 0xBF =
(RLPString $ w2c <$> strList, nextRest)
where
(strLength, restAfterLen) = getLength (fromIntegral x - 0xB7) rest
(strList, nextRest) = splitAtWithError (fromIntegral strLength) restAfterLen | 246 | rlpSplit (x:rest) | x >= 0xB8 && x <= 0xBF =
(RLPString $ w2c <$> strList, nextRest)
where
(strLength, restAfterLen) = getLength (fromIntegral x - 0xB7) rest
(strList, nextRest) = splitAtWithError (fromIntegral strLength) restAfterLen | 246 | rlpSplit (x:rest) | x >= 0xB8 && x <= 0xBF =
(RLPString $ w2c <$> strList, nextRest)
where
(strLength, restAfterLen) = getLength (fromIntegral x - 0xB7) rest
(strList, nextRest) = splitAtWithError (fromIntegral strLength) restAfterLen | 246 | false | false | 0 | 10 | 45 | 102 | 51 | 51 | null | null |
rueshyna/gogol | gogol-safebrowsing/gen/Network/Google/Resource/SafeBrowsing/ThreatListUpdates/Fetch.hs | mpl-2.0 | -- | JSONP
tlufCallback :: Lens' ThreatListUpdatesFetch (Maybe Text)
tlufCallback
= lens _tlufCallback (\ s a -> s{_tlufCallback = a}) | 136 | tlufCallback :: Lens' ThreatListUpdatesFetch (Maybe Text)
tlufCallback
= lens _tlufCallback (\ s a -> s{_tlufCallback = a}) | 125 | tlufCallback
= lens _tlufCallback (\ s a -> s{_tlufCallback = a}) | 67 | true | true | 0 | 9 | 21 | 48 | 25 | 23 | null | null |
emilaxelsson/ag-graph | bench/Bench.hs | bsd-3-clause | value :: (Depth :< a) => Syn IntTreeF a Value
value (Leaf l) = Value (l+d)
where
Depth d = above | 102 | value :: (Depth :< a) => Syn IntTreeF a Value
value (Leaf l) = Value (l+d)
where
Depth d = above | 102 | value (Leaf l) = Value (l+d)
where
Depth d = above | 56 | false | true | 0 | 7 | 26 | 58 | 29 | 29 | null | null |
nomeata/ghc | compiler/llvmGen/Llvm/PpLlvm.hs | bsd-3-clause | ppLlvmExpression :: LlvmExpression -> SDoc
ppLlvmExpression expr
= case expr of
Alloca tp amount -> ppAlloca tp amount
LlvmOp op left right -> ppMachOp op left right
Call tp fp args attrs -> ppCall tp fp args attrs
Cast op from to -> ppCast op from to
Compare op left right -> ppCmpOp op left right
GetElemPtr inb ptr indexes -> ppGetElementPtr inb ptr indexes
Load ptr -> ppLoad ptr
Malloc tp amount -> ppMalloc tp amount
Phi tp precessors -> ppPhi tp precessors
Asm asm c ty v se sk -> ppAsm asm c ty v se sk
MetaExpr meta expr -> ppMetaExpr meta expr
--------------------------------------------------------------------------------
-- * Individual print functions
--------------------------------------------------------------------------------
-- | Should always be a function pointer. So a global var of function type
-- (since globals are always pointers) or a local var of pointer function type. | 1,094 | ppLlvmExpression :: LlvmExpression -> SDoc
ppLlvmExpression expr
= case expr of
Alloca tp amount -> ppAlloca tp amount
LlvmOp op left right -> ppMachOp op left right
Call tp fp args attrs -> ppCall tp fp args attrs
Cast op from to -> ppCast op from to
Compare op left right -> ppCmpOp op left right
GetElemPtr inb ptr indexes -> ppGetElementPtr inb ptr indexes
Load ptr -> ppLoad ptr
Malloc tp amount -> ppMalloc tp amount
Phi tp precessors -> ppPhi tp precessors
Asm asm c ty v se sk -> ppAsm asm c ty v se sk
MetaExpr meta expr -> ppMetaExpr meta expr
--------------------------------------------------------------------------------
-- * Individual print functions
--------------------------------------------------------------------------------
-- | Should always be a function pointer. So a global var of function type
-- (since globals are always pointers) or a local var of pointer function type. | 1,094 | ppLlvmExpression expr
= case expr of
Alloca tp amount -> ppAlloca tp amount
LlvmOp op left right -> ppMachOp op left right
Call tp fp args attrs -> ppCall tp fp args attrs
Cast op from to -> ppCast op from to
Compare op left right -> ppCmpOp op left right
GetElemPtr inb ptr indexes -> ppGetElementPtr inb ptr indexes
Load ptr -> ppLoad ptr
Malloc tp amount -> ppMalloc tp amount
Phi tp precessors -> ppPhi tp precessors
Asm asm c ty v se sk -> ppAsm asm c ty v se sk
MetaExpr meta expr -> ppMetaExpr meta expr
--------------------------------------------------------------------------------
-- * Individual print functions
--------------------------------------------------------------------------------
-- | Should always be a function pointer. So a global var of function type
-- (since globals are always pointers) or a local var of pointer function type. | 1,051 | false | true | 0 | 8 | 333 | 239 | 111 | 128 | null | null |
sdiehl/ghc | libraries/base/GHC/Event/Manager.hs | bsd-3-clause | unregisterFd :: EventManager -> FdKey -> IO ()
unregisterFd mgr reg = do
wake <- unregisterFd_ mgr reg
when wake $ wakeManager mgr
-- | Close a file descriptor in a race-safe way. | 184 | unregisterFd :: EventManager -> FdKey -> IO ()
unregisterFd mgr reg = do
wake <- unregisterFd_ mgr reg
when wake $ wakeManager mgr
-- | Close a file descriptor in a race-safe way. | 184 | unregisterFd mgr reg = do
wake <- unregisterFd_ mgr reg
when wake $ wakeManager mgr
-- | Close a file descriptor in a race-safe way. | 137 | false | true | 0 | 8 | 37 | 55 | 25 | 30 | null | null |
snoyberg/ghc | compiler/typecheck/TcClassDcl.hs | bsd-3-clause | tcATDefault :: Bool -- If a warning should be emitted when a default instance
-- definition is not provided by the user
-> SrcSpan
-> TCvSubst
-> NameSet
-> ClassATItem
-> TcM [FamInst]
-- ^ Construct default instances for any associated types that
-- aren't given a user definition
-- Returns [] or singleton
tcATDefault emit_warn loc inst_subst defined_ats (ATI fam_tc defs)
-- User supplied instances ==> everything is OK
| tyConName fam_tc `elemNameSet` defined_ats
= return []
-- No user instance, have defaults ==> instatiate them
-- Example: class C a where { type F a b :: *; type F a b = () }
-- instance C [x]
-- Then we want to generate the decl: type F [x] b = ()
| Just (rhs_ty, _loc) <- defs
= do { let (subst', pat_tys') = mapAccumL subst_tv inst_subst
(tyConTyVars fam_tc)
rhs' = substTyUnchecked subst' rhs_ty
tcv' = tyCoVarsOfTypesList pat_tys'
(tv', cv') = partition isTyVar tcv'
tvs' = toposortTyVars tv'
cvs' = toposortTyVars cv'
; rep_tc_name <- newFamInstTyConName (L loc (tyConName fam_tc)) pat_tys'
; let axiom = mkSingleCoAxiom Nominal rep_tc_name tvs' cvs'
fam_tc pat_tys' rhs'
-- NB: no validity check. We check validity of default instances
-- in the class definition. Because type instance arguments cannot
-- be type family applications and cannot be polytypes, the
-- validity check is redundant.
; traceTc "mk_deflt_at_instance" (vcat [ ppr fam_tc, ppr rhs_ty
, pprCoAxiom axiom ])
; fam_inst <- newFamInst SynFamilyInst axiom
; return [fam_inst] }
-- No defaults ==> generate a warning
| otherwise -- defs = Nothing
= do { when emit_warn $ warnMissingAT (tyConName fam_tc)
; return [] }
where
subst_tv subst tc_tv
| Just ty <- lookupVarEnv (getTvSubstEnv subst) tc_tv
= (subst, ty)
| otherwise
= (extendTvSubst subst tc_tv ty', ty')
where
ty' = mkTyVarTy (updateTyVarKind (substTyUnchecked subst) tc_tv) | 2,298 | tcATDefault :: Bool -- If a warning should be emitted when a default instance
-- definition is not provided by the user
-> SrcSpan
-> TCvSubst
-> NameSet
-> ClassATItem
-> TcM [FamInst]
tcATDefault emit_warn loc inst_subst defined_ats (ATI fam_tc defs)
-- User supplied instances ==> everything is OK
| tyConName fam_tc `elemNameSet` defined_ats
= return []
-- No user instance, have defaults ==> instatiate them
-- Example: class C a where { type F a b :: *; type F a b = () }
-- instance C [x]
-- Then we want to generate the decl: type F [x] b = ()
| Just (rhs_ty, _loc) <- defs
= do { let (subst', pat_tys') = mapAccumL subst_tv inst_subst
(tyConTyVars fam_tc)
rhs' = substTyUnchecked subst' rhs_ty
tcv' = tyCoVarsOfTypesList pat_tys'
(tv', cv') = partition isTyVar tcv'
tvs' = toposortTyVars tv'
cvs' = toposortTyVars cv'
; rep_tc_name <- newFamInstTyConName (L loc (tyConName fam_tc)) pat_tys'
; let axiom = mkSingleCoAxiom Nominal rep_tc_name tvs' cvs'
fam_tc pat_tys' rhs'
-- NB: no validity check. We check validity of default instances
-- in the class definition. Because type instance arguments cannot
-- be type family applications and cannot be polytypes, the
-- validity check is redundant.
; traceTc "mk_deflt_at_instance" (vcat [ ppr fam_tc, ppr rhs_ty
, pprCoAxiom axiom ])
; fam_inst <- newFamInst SynFamilyInst axiom
; return [fam_inst] }
-- No defaults ==> generate a warning
| otherwise -- defs = Nothing
= do { when emit_warn $ warnMissingAT (tyConName fam_tc)
; return [] }
where
subst_tv subst tc_tv
| Just ty <- lookupVarEnv (getTvSubstEnv subst) tc_tv
= (subst, ty)
| otherwise
= (extendTvSubst subst tc_tv ty', ty')
where
ty' = mkTyVarTy (updateTyVarKind (substTyUnchecked subst) tc_tv) | 2,174 | tcATDefault emit_warn loc inst_subst defined_ats (ATI fam_tc defs)
-- User supplied instances ==> everything is OK
| tyConName fam_tc `elemNameSet` defined_ats
= return []
-- No user instance, have defaults ==> instatiate them
-- Example: class C a where { type F a b :: *; type F a b = () }
-- instance C [x]
-- Then we want to generate the decl: type F [x] b = ()
| Just (rhs_ty, _loc) <- defs
= do { let (subst', pat_tys') = mapAccumL subst_tv inst_subst
(tyConTyVars fam_tc)
rhs' = substTyUnchecked subst' rhs_ty
tcv' = tyCoVarsOfTypesList pat_tys'
(tv', cv') = partition isTyVar tcv'
tvs' = toposortTyVars tv'
cvs' = toposortTyVars cv'
; rep_tc_name <- newFamInstTyConName (L loc (tyConName fam_tc)) pat_tys'
; let axiom = mkSingleCoAxiom Nominal rep_tc_name tvs' cvs'
fam_tc pat_tys' rhs'
-- NB: no validity check. We check validity of default instances
-- in the class definition. Because type instance arguments cannot
-- be type family applications and cannot be polytypes, the
-- validity check is redundant.
; traceTc "mk_deflt_at_instance" (vcat [ ppr fam_tc, ppr rhs_ty
, pprCoAxiom axiom ])
; fam_inst <- newFamInst SynFamilyInst axiom
; return [fam_inst] }
-- No defaults ==> generate a warning
| otherwise -- defs = Nothing
= do { when emit_warn $ warnMissingAT (tyConName fam_tc)
; return [] }
where
subst_tv subst tc_tv
| Just ty <- lookupVarEnv (getTvSubstEnv subst) tc_tv
= (subst, ty)
| otherwise
= (extendTvSubst subst tc_tv ty', ty')
where
ty' = mkTyVarTy (updateTyVarKind (substTyUnchecked subst) tc_tv) | 1,908 | true | true | 1 | 13 | 763 | 451 | 224 | 227 | null | null |
timtylin/scholdoc-texmath | src/Text/TeXMath/Readers/TeX.hs | gpl-2.0 | number :: TP Exp
number = lexeme $ ENumber <$> many1 digit | 58 | number :: TP Exp
number = lexeme $ ENumber <$> many1 digit | 58 | number = lexeme $ ENumber <$> many1 digit | 41 | false | true | 0 | 6 | 11 | 25 | 12 | 13 | null | null |
DavidAlphaFox/ghc | libraries/haskeline/Setup.hs | bsd-3-clause | warnIfNotTerminfo flags = when (not (hasFlagSet flags (FlagName "terminfo")))
$ mapM_ putStrLn
[ "*** Warning: running on POSIX but not building the terminfo backend. ***"
, "You may need to install the terminfo package manually, e.g. with"
, "\"cabal install terminfo\"; or, use \"-fterminfo\" when configuring or"
, "installing this package."
,""
] | 378 | warnIfNotTerminfo flags = when (not (hasFlagSet flags (FlagName "terminfo")))
$ mapM_ putStrLn
[ "*** Warning: running on POSIX but not building the terminfo backend. ***"
, "You may need to install the terminfo package manually, e.g. with"
, "\"cabal install terminfo\"; or, use \"-fterminfo\" when configuring or"
, "installing this package."
,""
] | 378 | warnIfNotTerminfo flags = when (not (hasFlagSet flags (FlagName "terminfo")))
$ mapM_ putStrLn
[ "*** Warning: running on POSIX but not building the terminfo backend. ***"
, "You may need to install the terminfo package manually, e.g. with"
, "\"cabal install terminfo\"; or, use \"-fterminfo\" when configuring or"
, "installing this package."
,""
] | 378 | false | false | 2 | 11 | 80 | 58 | 29 | 29 | null | null |
phischu/fragnix | tests/packages/scotty/Data.Vector.Unboxed.Mutable.hs | bsd-3-clause | move = G.move | 13 | move = G.move | 13 | move = G.move | 13 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
rrnewton/accelerate | Data/Array/Accelerate/Trafo/Substitution.hs | bsd-3-clause | compose _ _ = error "compose: impossible evaluation" | 78 | compose _ _ = error "compose: impossible evaluation" | 78 | compose _ _ = error "compose: impossible evaluation" | 78 | false | false | 0 | 5 | 33 | 14 | 6 | 8 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/enumFromThenTo_2.hs | mit | takeWhile :: (a -> MyBool) -> (List a) -> (List a);
takeWhile p Nil = takeWhile3 p Nil | 92 | takeWhile :: (a -> MyBool) -> (List a) -> (List a)
takeWhile p Nil = takeWhile3 p Nil | 91 | takeWhile p Nil = takeWhile3 p Nil | 34 | false | true | 0 | 8 | 23 | 49 | 25 | 24 | null | null |
flipstone/orville | orville-postgresql-libpq/test/Test/PgGen.hs | mit | pgIdentifier :: HH.Gen String
pgIdentifier =
Gen.string (Range.linear 1 63) $ Gen.element pgIdentifierChars | 109 | pgIdentifier :: HH.Gen String
pgIdentifier =
Gen.string (Range.linear 1 63) $ Gen.element pgIdentifierChars | 109 | pgIdentifier =
Gen.string (Range.linear 1 63) $ Gen.element pgIdentifierChars | 79 | false | true | 0 | 9 | 14 | 40 | 19 | 21 | null | null |
brendanhay/gogol | gogol-partners/gen/Network/Google/Resource/Partners/Analytics/List.hs | mpl-2.0 | -- | OAuth access token.
alAccessToken :: Lens' AnalyticsList (Maybe Text)
alAccessToken
= lens _alAccessToken
(\ s a -> s{_alAccessToken = a}) | 151 | alAccessToken :: Lens' AnalyticsList (Maybe Text)
alAccessToken
= lens _alAccessToken
(\ s a -> s{_alAccessToken = a}) | 126 | alAccessToken
= lens _alAccessToken
(\ s a -> s{_alAccessToken = a}) | 76 | true | true | 0 | 9 | 29 | 48 | 25 | 23 | null | null |
jaspervdj/lorem-markdownum | lib/LoremMarkdownum/Gen/Markdown.hs | bsd-3-clause | --------------------------------------------------------------------------------
mkDefaultMarkdownConfig :: Markov (Token Int)
-> Map Int (FrequencyTree Text)
-> CodeConfig
-> MarkdownConfig
mkDefaultMarkdownConfig mrkv ft cc = MarkdownConfig mrkv ft cc
False False False False False False False False False Nothing 2 False False | 405 | mkDefaultMarkdownConfig :: Markov (Token Int)
-> Map Int (FrequencyTree Text)
-> CodeConfig
-> MarkdownConfig
mkDefaultMarkdownConfig mrkv ft cc = MarkdownConfig mrkv ft cc
False False False False False False False False False Nothing 2 False False | 324 | mkDefaultMarkdownConfig mrkv ft cc = MarkdownConfig mrkv ft cc
False False False False False False False False False Nothing 2 False False | 142 | true | true | 0 | 9 | 112 | 86 | 41 | 45 | null | null |
dillonhuff/AFL | src/CoreSyntax.hs | bsd-3-clause | newVar :: String -> VarName
newVar s = var $ "#" ++ s | 53 | newVar :: String -> VarName
newVar s = var $ "#" ++ s | 53 | newVar s = var $ "#" ++ s | 25 | false | true | 0 | 6 | 12 | 26 | 13 | 13 | null | null |
rpglover64/Idris-dev | codegen/idris-codegen-javascript/Main.hs | bsd-3-clause | getOpts :: IO Opts
getOpts = do xs <- getArgs
return $ process (Opts False [] "main.js") xs
where
process opts ("--yes-really":xs) = process (opts { really = True }) xs
process opts ("-o":o:xs) = process (opts { output = o }) xs
process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
process opts [] = opts | 349 | getOpts :: IO Opts
getOpts = do xs <- getArgs
return $ process (Opts False [] "main.js") xs
where
process opts ("--yes-really":xs) = process (opts { really = True }) xs
process opts ("-o":o:xs) = process (opts { output = o }) xs
process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
process opts [] = opts | 349 | getOpts = do xs <- getArgs
return $ process (Opts False [] "main.js") xs
where
process opts ("--yes-really":xs) = process (opts { really = True }) xs
process opts ("-o":o:xs) = process (opts { output = o }) xs
process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
process opts [] = opts | 330 | false | true | 3 | 11 | 91 | 167 | 87 | 80 | null | null |
ivanperez-keera/SoOSiM-ui | src/Graphics/Diagrams/MultiCoreStatus.hs | bsd-3-clause | toggleVisibilityS :: UnitStatus -> UnitStatus
toggleVisibilityS UnitCollapsed = UnitExpanded | 92 | toggleVisibilityS :: UnitStatus -> UnitStatus
toggleVisibilityS UnitCollapsed = UnitExpanded | 92 | toggleVisibilityS UnitCollapsed = UnitExpanded | 46 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
jmct/IterativeCompiler | frontend/GMachine.hs | mit | dispatch Ge = geI | 29 | dispatch Ge = geI | 29 | dispatch Ge = geI | 29 | false | false | 0 | 5 | 15 | 9 | 4 | 5 | null | null |
foreverbell/project-euler-solutions | src/537.hs | bsd-3-clause | mkNumMod True 1004535809
type Zn = Int1004535809 | 48 | mkNumMod True 1004535809
type Zn = Int1004535809 | 48 | mkNumMod True 1004535809
type Zn = Int1004535809 | 48 | false | false | 0 | 4 | 6 | 16 | 7 | 9 | null | null |
martin-kolinek/stack | src/Stack/PackageDump.hs | bsd-3-clause | eachPair :: Monad m
=> (Text -> Sink Line m a)
-> Conduit Line m a
eachPair inner =
start
where
start = await >>= maybe (return ()) start'
start' bs1 =
toConsumer (valSrc =$= inner key) >>= yield >> start
where
(key, bs2) = T.break (== ':') bs1
(spaces, bs3) = T.span (== ' ') $ T.drop 1 bs2
indent = T.length key + 1 + T.length spaces
valSrc
| T.null bs3 = noIndent
| otherwise = yield bs3 >> loopIndent indent
noIndent = do
mx <- await
case mx of
Nothing -> return ()
Just bs -> do
let (spaces, val) = T.span (== ' ') bs
if T.length spaces == 0
then leftover val
else do
yield val
loopIndent (T.length spaces)
loopIndent i =
loop
where
loop = await >>= maybe (return ()) go
go bs
| T.length spaces == i && T.all (== ' ') spaces =
yield val >> loop
| otherwise = leftover bs
where
(spaces, val) = T.splitAt i bs
-- | General purpose utility | 1,209 | eachPair :: Monad m
=> (Text -> Sink Line m a)
-> Conduit Line m a
eachPair inner =
start
where
start = await >>= maybe (return ()) start'
start' bs1 =
toConsumer (valSrc =$= inner key) >>= yield >> start
where
(key, bs2) = T.break (== ':') bs1
(spaces, bs3) = T.span (== ' ') $ T.drop 1 bs2
indent = T.length key + 1 + T.length spaces
valSrc
| T.null bs3 = noIndent
| otherwise = yield bs3 >> loopIndent indent
noIndent = do
mx <- await
case mx of
Nothing -> return ()
Just bs -> do
let (spaces, val) = T.span (== ' ') bs
if T.length spaces == 0
then leftover val
else do
yield val
loopIndent (T.length spaces)
loopIndent i =
loop
where
loop = await >>= maybe (return ()) go
go bs
| T.length spaces == i && T.all (== ' ') spaces =
yield val >> loop
| otherwise = leftover bs
where
(spaces, val) = T.splitAt i bs
-- | General purpose utility | 1,209 | eachPair inner =
start
where
start = await >>= maybe (return ()) start'
start' bs1 =
toConsumer (valSrc =$= inner key) >>= yield >> start
where
(key, bs2) = T.break (== ':') bs1
(spaces, bs3) = T.span (== ' ') $ T.drop 1 bs2
indent = T.length key + 1 + T.length spaces
valSrc
| T.null bs3 = noIndent
| otherwise = yield bs3 >> loopIndent indent
noIndent = do
mx <- await
case mx of
Nothing -> return ()
Just bs -> do
let (spaces, val) = T.span (== ' ') bs
if T.length spaces == 0
then leftover val
else do
yield val
loopIndent (T.length spaces)
loopIndent i =
loop
where
loop = await >>= maybe (return ()) go
go bs
| T.length spaces == i && T.all (== ' ') spaces =
yield val >> loop
| otherwise = leftover bs
where
(spaces, val) = T.splitAt i bs
-- | General purpose utility | 1,124 | false | true | 12 | 18 | 539 | 475 | 217 | 258 | null | null |
distillation/paralleliser | Paralleliser.hs | gpl-3.0 | isDistilledExpression (Let _ e e') = isDistilledExpression e && isDistilledExpression e' | 88 | isDistilledExpression (Let _ e e') = isDistilledExpression e && isDistilledExpression e' | 88 | isDistilledExpression (Let _ e e') = isDistilledExpression e && isDistilledExpression e' | 88 | false | false | 0 | 7 | 10 | 29 | 13 | 16 | null | null |
mitchellwrosen/regex-applicative | Text/Regex/Applicative/Object.hs | mit | addThread :: Thread s r -> ReObject s r -> ReObject s r
addThread t (ReObject q) =
case t of
Accept {} -> ReObject $ SQ.insert t q
Thread { threadId_ = ThreadId i } -> ReObject $ SQ.insertUnique i t q
-- | Compile a regular expression into a regular expression object | 288 | addThread :: Thread s r -> ReObject s r -> ReObject s r
addThread t (ReObject q) =
case t of
Accept {} -> ReObject $ SQ.insert t q
Thread { threadId_ = ThreadId i } -> ReObject $ SQ.insertUnique i t q
-- | Compile a regular expression into a regular expression object | 288 | addThread t (ReObject q) =
case t of
Accept {} -> ReObject $ SQ.insert t q
Thread { threadId_ = ThreadId i } -> ReObject $ SQ.insertUnique i t q
-- | Compile a regular expression into a regular expression object | 232 | false | true | 0 | 11 | 74 | 106 | 50 | 56 | null | null |
meiersi/psqueues-old | src/Data/OrdPSQ/Internal.hs | bsd-3-clause | rbalance k p v l m r
| size' l + size' r < 2 = rloser k p v l m r
| size' r > omega * size' l = rbalanceLeft k p v l m r
| size' l > omega * size' r = rbalanceRight k p v l m r
| otherwise = rloser k p v l m r | 260 | rbalance k p v l m r
| size' l + size' r < 2 = rloser k p v l m r
| size' r > omega * size' l = rbalanceLeft k p v l m r
| size' l > omega * size' r = rbalanceRight k p v l m r
| otherwise = rloser k p v l m r | 260 | rbalance k p v l m r
| size' l + size' r < 2 = rloser k p v l m r
| size' r > omega * size' l = rbalanceLeft k p v l m r
| size' l > omega * size' r = rbalanceRight k p v l m r
| otherwise = rloser k p v l m r | 260 | false | false | 0 | 10 | 115 | 146 | 65 | 81 | null | null |
osa1/Idris-dev | src/Idris/WhoCalls.hs | bsd-3-clause | namesSC :: SC -> [Name]
namesSC (Case _ _ alts) = concatMap namesCaseAlt alts | 77 | namesSC :: SC -> [Name]
namesSC (Case _ _ alts) = concatMap namesCaseAlt alts | 77 | namesSC (Case _ _ alts) = concatMap namesCaseAlt alts | 53 | false | true | 0 | 7 | 13 | 36 | 18 | 18 | null | null |
michalt/cvector | Data/CVector/Mutable.hs | bsd-3-clause | unsafeSlice :: Int -> Int -> CMVector s a -> CMVector s a
unsafeSlice = G.unsafeSlice | 85 | unsafeSlice :: Int -> Int -> CMVector s a -> CMVector s a
unsafeSlice = G.unsafeSlice | 85 | unsafeSlice = G.unsafeSlice | 27 | false | true | 0 | 8 | 15 | 35 | 17 | 18 | null | null |
NicolasDP/hs-cli | Console/Options.hs | bsd-3-clause | modifyCT :: (Command r -> Command r) -> OptionDesc r ()
modifyCT f = modify $ \st -> st { stCT = f (stCT st) } | 110 | modifyCT :: (Command r -> Command r) -> OptionDesc r ()
modifyCT f = modify $ \st -> st { stCT = f (stCT st) } | 110 | modifyCT f = modify $ \st -> st { stCT = f (stCT st) } | 54 | false | true | 0 | 11 | 25 | 64 | 32 | 32 | null | null |
Bodigrim/arithmoi | test-suite/Math/NumberTheory/Moduli/ClassTests.hs | mit | getValModProperty :: Integer -> Positive Natural -> Bool
getValModProperty x (Positive m) = case z of
SomeMod t -> z == getVal t `modulo` getNatMod t && z == toInteger (getNatVal t) `modulo` fromInteger (getMod t)
InfMod{} -> False
where
z = x `modulo` m | 264 | getValModProperty :: Integer -> Positive Natural -> Bool
getValModProperty x (Positive m) = case z of
SomeMod t -> z == getVal t `modulo` getNatMod t && z == toInteger (getNatVal t) `modulo` fromInteger (getMod t)
InfMod{} -> False
where
z = x `modulo` m | 264 | getValModProperty x (Positive m) = case z of
SomeMod t -> z == getVal t `modulo` getNatMod t && z == toInteger (getNatVal t) `modulo` fromInteger (getMod t)
InfMod{} -> False
where
z = x `modulo` m | 207 | false | true | 0 | 13 | 54 | 120 | 59 | 61 | null | null |
abarbu/csp-haskell | src/Control/Monad/CSP.hs | lgpl-3.0 | -- | Return a single solution to the CSP. 'solveCSP' running with 'oneValueT'
oneCSPSolution :: CSPResult a1 => CSP (Result a1) a1 -> Result a1
oneCSPSolution = solveCSP oneValueT | 179 | oneCSPSolution :: CSPResult a1 => CSP (Result a1) a1 -> Result a1
oneCSPSolution = solveCSP oneValueT | 101 | oneCSPSolution = solveCSP oneValueT | 35 | true | true | 0 | 10 | 28 | 46 | 20 | 26 | null | null |
NCrashed/pohodnik-ration | src/Ration/Util.hs | bsd-3-clause | saveText :: String -> String -> IO ()
saveText = ffi "(function(str, filename) {saveText(str, filename);})" | 107 | saveText :: String -> String -> IO ()
saveText = ffi "(function(str, filename) {saveText(str, filename);})" | 107 | saveText = ffi "(function(str, filename) {saveText(str, filename);})" | 69 | false | true | 0 | 8 | 14 | 27 | 13 | 14 | null | null |
markuspf/Idris-dev | src/IRTS/JavaScript/LangTransforms.hs | bsd-3-clause | usedDecls :: Map Name LDecl -> [Name] -> Map Name LDecl
usedDecls dcls start =
let used = reverse $ start ++ usedFunctions dcls (Set.fromList start) start
in restrictKeys dcls (Set.fromList used) | 199 | usedDecls :: Map Name LDecl -> [Name] -> Map Name LDecl
usedDecls dcls start =
let used = reverse $ start ++ usedFunctions dcls (Set.fromList start) start
in restrictKeys dcls (Set.fromList used) | 199 | usedDecls dcls start =
let used = reverse $ start ++ usedFunctions dcls (Set.fromList start) start
in restrictKeys dcls (Set.fromList used) | 143 | false | true | 0 | 13 | 35 | 90 | 41 | 49 | null | null |
hspec/hspec | hspec-core/src/Test/Hspec/Core/Example/Location.hs | mit | parseCallStack :: String -> Maybe Location
parseCallStack input = case reverse (lines input) of
[] -> Nothing
line : _ -> findLocation line
where
findLocation xs = case xs of
[] -> Nothing
_ : ys -> case stripPrefix prefix xs of
Just zs -> parseLocation (takeWhile (not . isSpace) zs)
Nothing -> findLocation ys
prefix = ", called at " | 377 | parseCallStack :: String -> Maybe Location
parseCallStack input = case reverse (lines input) of
[] -> Nothing
line : _ -> findLocation line
where
findLocation xs = case xs of
[] -> Nothing
_ : ys -> case stripPrefix prefix xs of
Just zs -> parseLocation (takeWhile (not . isSpace) zs)
Nothing -> findLocation ys
prefix = ", called at " | 377 | parseCallStack input = case reverse (lines input) of
[] -> Nothing
line : _ -> findLocation line
where
findLocation xs = case xs of
[] -> Nothing
_ : ys -> case stripPrefix prefix xs of
Just zs -> parseLocation (takeWhile (not . isSpace) zs)
Nothing -> findLocation ys
prefix = ", called at " | 334 | false | true | 0 | 15 | 102 | 138 | 66 | 72 | null | null |
travitch/llvm-analysis | src/LLVM/Analysis/Dominance.hs | bsd-3-clause | postdominators :: (HasPostdomTree t) => t -> [(Instruction, [Instruction])]
postdominators pt =
zip is (map (getDominators t) is)
where
pdt@(PDT _ t) = getPostdomTree pt
f = getFunction pdt
is = functionInstructions f | 233 | postdominators :: (HasPostdomTree t) => t -> [(Instruction, [Instruction])]
postdominators pt =
zip is (map (getDominators t) is)
where
pdt@(PDT _ t) = getPostdomTree pt
f = getFunction pdt
is = functionInstructions f | 233 | postdominators pt =
zip is (map (getDominators t) is)
where
pdt@(PDT _ t) = getPostdomTree pt
f = getFunction pdt
is = functionInstructions f | 157 | false | true | 0 | 9 | 48 | 97 | 50 | 47 | null | null |
mydaum/cabal | cabal-install/Distribution/Client/CmdBench.hs | bsd-3-clause | renderTargetProblem (TargetProblemNoTargets targetSelector) =
case targetSelectorFilter targetSelector of
Just kind | kind /= BenchKind
-> "The bench command is for running benchmarks, but the target '"
++ showTargetSelector targetSelector ++ "' refers to "
++ renderTargetSelector targetSelector ++ "."
_ -> renderTargetProblemNoTargets "benchmark" targetSelector
where
targetSelectorFilter (TargetAllPackages mkfilter) = mkfilter
targetSelectorFilter (TargetPackage _ _ mkfilter) = mkfilter
targetSelectorFilter (TargetComponent _ _ _) = Nothing | 616 | renderTargetProblem (TargetProblemNoTargets targetSelector) =
case targetSelectorFilter targetSelector of
Just kind | kind /= BenchKind
-> "The bench command is for running benchmarks, but the target '"
++ showTargetSelector targetSelector ++ "' refers to "
++ renderTargetSelector targetSelector ++ "."
_ -> renderTargetProblemNoTargets "benchmark" targetSelector
where
targetSelectorFilter (TargetAllPackages mkfilter) = mkfilter
targetSelectorFilter (TargetPackage _ _ mkfilter) = mkfilter
targetSelectorFilter (TargetComponent _ _ _) = Nothing | 616 | renderTargetProblem (TargetProblemNoTargets targetSelector) =
case targetSelectorFilter targetSelector of
Just kind | kind /= BenchKind
-> "The bench command is for running benchmarks, but the target '"
++ showTargetSelector targetSelector ++ "' refers to "
++ renderTargetSelector targetSelector ++ "."
_ -> renderTargetProblemNoTargets "benchmark" targetSelector
where
targetSelectorFilter (TargetAllPackages mkfilter) = mkfilter
targetSelectorFilter (TargetPackage _ _ mkfilter) = mkfilter
targetSelectorFilter (TargetComponent _ _ _) = Nothing | 616 | false | false | 0 | 13 | 132 | 127 | 59 | 68 | null | null |
dasuxullebt/inflate.hs | inflate.recSlowdown.hs | gpl-3.0 | peekBit :: BitStream -> Maybe Bool
peekBit (_, _, []) = Nothing | 63 | peekBit :: BitStream -> Maybe Bool
peekBit (_, _, []) = Nothing | 63 | peekBit (_, _, []) = Nothing | 28 | false | true | 0 | 7 | 11 | 32 | 17 | 15 | null | null |
sdiehl/ghc | testsuite/tests/programs/galois_raytrace/Eval.hs | bsd-3-clause | {-
* Oops, one of the example actually has something
* on the stack at the end.
* Oh well...
; if null stk
then return ()
else do { putStrLn done
; print stk
}
-}
done = "Items still on stack at (successful) termination of program" | 357 | done = "Items still on stack at (successful) termination of program" | 68 | done = "Items still on stack at (successful) termination of program" | 68 | true | false | 1 | 5 | 173 | 11 | 4 | 7 | null | null |
anttisalonen/cgen | src/CppGen.hs | bsd-3-clause | handleTemplateTypes :: [(String, String)] -> String -> String
handleTemplateTypes rens t =
let alltypes = typesInType t
newtypes = map (renameType rens) alltypes
in foldr (uncurry replace) t (zip alltypes newtypes) | 225 | handleTemplateTypes :: [(String, String)] -> String -> String
handleTemplateTypes rens t =
let alltypes = typesInType t
newtypes = map (renameType rens) alltypes
in foldr (uncurry replace) t (zip alltypes newtypes) | 225 | handleTemplateTypes rens t =
let alltypes = typesInType t
newtypes = map (renameType rens) alltypes
in foldr (uncurry replace) t (zip alltypes newtypes) | 163 | false | true | 0 | 11 | 41 | 84 | 42 | 42 | null | null |
pauloborba/plc | src/DetalhesSobreListasERecursao.hs | cc0-1.0 | procurar n [] = [] | 18 | procurar n [] = [] | 18 | procurar n [] = [] | 18 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
hverr/lxdfile | src/Language/LXDFile/Types.hs | gpl-3.0 | lxdFile :: MonadError ASTError m => AST -> m LXDFile
lxdFile ast = LXDFile <$> onlyOne NoBaseImage ManyBaseImages baseImages
<*> maybeOne ManyDescriptions descriptions
<*> allVolumes
<*> allActions
where
instructions = map instruction ast
baseImages = mapMaybe baseImage' instructions
baseImage' (From x) = Just x
baseImage' _ = Nothing
descriptions = mapMaybe description' instructions
description' (Description x) = Just x
description' _ = Nothing
allActions = pure $ mapMaybe action' instructions
action' (Action x) = Just x
action' _ = Nothing
allVolumes = pure $ mapMaybe volume' instructions
volume' (Volume x) = Just x
volume' _ = Nothing
onlyOne _ _ [x] = return x
onlyOne noneErr _ [] = throwError noneErr
onlyOne _ manyErr _ = throwError manyErr
maybeOne _ [x] = return $ Just x
maybeOne _ [] = return Nothing
maybeOne manyErr _ = throwError manyErr | 1,072 | lxdFile :: MonadError ASTError m => AST -> m LXDFile
lxdFile ast = LXDFile <$> onlyOne NoBaseImage ManyBaseImages baseImages
<*> maybeOne ManyDescriptions descriptions
<*> allVolumes
<*> allActions
where
instructions = map instruction ast
baseImages = mapMaybe baseImage' instructions
baseImage' (From x) = Just x
baseImage' _ = Nothing
descriptions = mapMaybe description' instructions
description' (Description x) = Just x
description' _ = Nothing
allActions = pure $ mapMaybe action' instructions
action' (Action x) = Just x
action' _ = Nothing
allVolumes = pure $ mapMaybe volume' instructions
volume' (Volume x) = Just x
volume' _ = Nothing
onlyOne _ _ [x] = return x
onlyOne noneErr _ [] = throwError noneErr
onlyOne _ manyErr _ = throwError manyErr
maybeOne _ [x] = return $ Just x
maybeOne _ [] = return Nothing
maybeOne manyErr _ = throwError manyErr | 1,072 | lxdFile ast = LXDFile <$> onlyOne NoBaseImage ManyBaseImages baseImages
<*> maybeOne ManyDescriptions descriptions
<*> allVolumes
<*> allActions
where
instructions = map instruction ast
baseImages = mapMaybe baseImage' instructions
baseImage' (From x) = Just x
baseImage' _ = Nothing
descriptions = mapMaybe description' instructions
description' (Description x) = Just x
description' _ = Nothing
allActions = pure $ mapMaybe action' instructions
action' (Action x) = Just x
action' _ = Nothing
allVolumes = pure $ mapMaybe volume' instructions
volume' (Volume x) = Just x
volume' _ = Nothing
onlyOne _ _ [x] = return x
onlyOne noneErr _ [] = throwError noneErr
onlyOne _ manyErr _ = throwError manyErr
maybeOne _ [x] = return $ Just x
maybeOne _ [] = return Nothing
maybeOne manyErr _ = throwError manyErr | 1,019 | false | true | 18 | 10 | 350 | 310 | 152 | 158 | null | null |
codygman/yesod-dsl | YesodDsl/Generator/Common.hs | bsd-2-clause | brackets :: Bool -> String -> String
brackets True s = "(" ++ s ++ ")" | 70 | brackets :: Bool -> String -> String
brackets True s = "(" ++ s ++ ")" | 70 | brackets True s = "(" ++ s ++ ")" | 33 | false | true | 4 | 8 | 15 | 40 | 17 | 23 | null | null |
jwiegley/ghc-release | libraries/base/Data/List.hs | gpl-3.0 | -- | The '\\' function is list difference (non-associative).
-- In the result of @xs@ '\\' @ys@, the first occurrence of each element of
-- @ys@ in turn (if any) has been removed from @xs@. Thus
--
-- > (xs ++ ys) \\ xs == ys.
--
-- It is a special case of 'deleteFirstsBy', which allows the programmer
-- to supply their own equality test.
(\\) :: (Eq a) => [a] -> [a] -> [a]
(\\) = foldl (flip delete) | 444 | (\\) :: (Eq a) => [a] -> [a] -> [a]
(\\) = foldl (flip delete) | 101 | (\\) = foldl (flip delete) | 46 | true | true | 0 | 8 | 121 | 58 | 37 | 21 | null | null |
SimSaladin/rnfssp | rnfssp-util/Utils.hs | bsd-3-clause | guessFiletype :: FilePath -> Text
guessFiletype fp
| ext `elem` map ('.':) ["mkv","avi","sfv","ogm","mp4"] = "video"
| ext `elem` map ('.':) ["flac","mid","mp3","ogg","tak","tif","tta","wav","wma","wv"] = "audio"
| otherwise = "unknown"
where ext = takeExtension fp
-- * Utils | 293 | guessFiletype :: FilePath -> Text
guessFiletype fp
| ext `elem` map ('.':) ["mkv","avi","sfv","ogm","mp4"] = "video"
| ext `elem` map ('.':) ["flac","mid","mp3","ogg","tak","tif","tta","wav","wma","wv"] = "audio"
| otherwise = "unknown"
where ext = takeExtension fp
-- * Utils | 293 | guessFiletype fp
| ext `elem` map ('.':) ["mkv","avi","sfv","ogm","mp4"] = "video"
| ext `elem` map ('.':) ["flac","mid","mp3","ogg","tak","tif","tta","wav","wma","wv"] = "audio"
| otherwise = "unknown"
where ext = takeExtension fp
-- * Utils | 259 | false | true | 1 | 10 | 51 | 129 | 74 | 55 | null | null |
alexander-at-github/eta | compiler/ETA/DeSugar/DsForeign.hs | bsd-3-clause | getArgClass :: ExtendsInfo -> Type -> (Bool, Maybe Text)
getArgClass extendsInfo ty
| Just var <- getTyVar_maybe ty
= case lookupVarEnv extendsInfo var of
Just (_, tagType, _) ->
let (_, res) = getArgClass extendsInfo tagType
in (True, res)
_ -> (False, Nothing)
| otherwise = (False, Just $ tagTypeToText ty) | 343 | getArgClass :: ExtendsInfo -> Type -> (Bool, Maybe Text)
getArgClass extendsInfo ty
| Just var <- getTyVar_maybe ty
= case lookupVarEnv extendsInfo var of
Just (_, tagType, _) ->
let (_, res) = getArgClass extendsInfo tagType
in (True, res)
_ -> (False, Nothing)
| otherwise = (False, Just $ tagTypeToText ty) | 343 | getArgClass extendsInfo ty
| Just var <- getTyVar_maybe ty
= case lookupVarEnv extendsInfo var of
Just (_, tagType, _) ->
let (_, res) = getArgClass extendsInfo tagType
in (True, res)
_ -> (False, Nothing)
| otherwise = (False, Just $ tagTypeToText ty) | 286 | false | true | 1 | 13 | 84 | 140 | 70 | 70 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | tagOf_PrimOp WordEqOp = _ILIT(55) | 33 | tagOf_PrimOp WordEqOp = _ILIT(55) | 33 | tagOf_PrimOp WordEqOp = _ILIT(55) | 33 | false | false | 0 | 6 | 3 | 15 | 7 | 8 | null | null |
alphaHeavy/cabal | cabal-install/Distribution/Client/Dependency/Modular/Validate.hs | bsd-3-clause | extractDeps :: FAssignment -> SAssignment -> FlaggedDeps QPN -> [Dep QPN]
extractDeps fa sa deps = do
d <- deps
case d of
Simple sd -> return sd
Flagged qfn _ td fd -> case M.lookup qfn fa of
Nothing -> mzero
Just True -> extractDeps fa sa td
Just False -> extractDeps fa sa fd
Stanza qsn td -> case M.lookup qsn sa of
Nothing -> mzero
Just True -> extractDeps fa sa td
Just False -> []
-- | We try to find new dependencies that become available due to the given
-- flag or stanza choice. We therefore look for the choice in question, and then call
-- 'extractDeps' for everything underneath. | 807 | extractDeps :: FAssignment -> SAssignment -> FlaggedDeps QPN -> [Dep QPN]
extractDeps fa sa deps = do
d <- deps
case d of
Simple sd -> return sd
Flagged qfn _ td fd -> case M.lookup qfn fa of
Nothing -> mzero
Just True -> extractDeps fa sa td
Just False -> extractDeps fa sa fd
Stanza qsn td -> case M.lookup qsn sa of
Nothing -> mzero
Just True -> extractDeps fa sa td
Just False -> []
-- | We try to find new dependencies that become available due to the given
-- flag or stanza choice. We therefore look for the choice in question, and then call
-- 'extractDeps' for everything underneath. | 807 | extractDeps fa sa deps = do
d <- deps
case d of
Simple sd -> return sd
Flagged qfn _ td fd -> case M.lookup qfn fa of
Nothing -> mzero
Just True -> extractDeps fa sa td
Just False -> extractDeps fa sa fd
Stanza qsn td -> case M.lookup qsn sa of
Nothing -> mzero
Just True -> extractDeps fa sa td
Just False -> []
-- | We try to find new dependencies that become available due to the given
-- flag or stanza choice. We therefore look for the choice in question, and then call
-- 'extractDeps' for everything underneath. | 733 | false | true | 0 | 13 | 329 | 187 | 87 | 100 | null | null |
raboof/xmobar | src/Main.hs | bsd-3-clause | license :: String
license = "\nThis program is distributed in the hope that it will be useful,\n" ++
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" ++
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" ++
"See the License for more details." | 296 | license :: String
license = "\nThis program is distributed in the hope that it will be useful,\n" ++
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" ++
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" ++
"See the License for more details." | 296 | license = "\nThis program is distributed in the hope that it will be useful,\n" ++
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" ++
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" ++
"See the License for more details." | 278 | false | true | 0 | 7 | 72 | 23 | 12 | 11 | null | null |
sopvop/cabal | cabal-install/Distribution/Client/Get.hs | bsd-3-clause | -- | Find which usable branch drivers (selected from 'allBranchers') are
-- available and usable on the local machine.
--
-- Each driver's main command is run with @--help@, and if the child process
-- exits successfully, that brancher is considered usable.
findUsableBranchers :: IO (Data.Map.Map PD.RepoType Brancher)
findUsableBranchers = do
let usable (_, brancher) = flip catchIO (const (return False)) $ do
let cmd = brancherBinary brancher
(exitCode, _, _) <- readProcessWithExitCode cmd ["--help"] ""
return (exitCode == ExitSuccess)
pairs <- filterM usable allBranchers
return (Data.Map.fromList pairs)
-- | Fork a single package from a remote source repository to the local
-- file system. | 739 | findUsableBranchers :: IO (Data.Map.Map PD.RepoType Brancher)
findUsableBranchers = do
let usable (_, brancher) = flip catchIO (const (return False)) $ do
let cmd = brancherBinary brancher
(exitCode, _, _) <- readProcessWithExitCode cmd ["--help"] ""
return (exitCode == ExitSuccess)
pairs <- filterM usable allBranchers
return (Data.Map.fromList pairs)
-- | Fork a single package from a remote source repository to the local
-- file system. | 481 | findUsableBranchers = do
let usable (_, brancher) = flip catchIO (const (return False)) $ do
let cmd = brancherBinary brancher
(exitCode, _, _) <- readProcessWithExitCode cmd ["--help"] ""
return (exitCode == ExitSuccess)
pairs <- filterM usable allBranchers
return (Data.Map.fromList pairs)
-- | Fork a single package from a remote source repository to the local
-- file system. | 419 | true | true | 0 | 16 | 144 | 151 | 77 | 74 | null | null |
AKST/scheme.llvm | src/Scheme/LLVM/Compile.hs | mit | expandAST :: AST -> Generate Operand
expandAST ast = case ast of
Ref (Reference name) -> do
reference <- gets (Map.lookup name)
nameError <- callFn (fnName fnImplPtr "init_err") []
return $ fromMaybe nameError reference
Number (Num n) ->
callFn (fnName initNumT "init_num") [f64 n]
Apply (Application caller args) -> do
fn <- expandAST caller
argL <- mapM expandAST args >>= mkArray
callFn (fnName fnImplPtr "call_fn") [fn, argL]
_ ->
fail $ "unsupported ast" ++ show ast | 518 | expandAST :: AST -> Generate Operand
expandAST ast = case ast of
Ref (Reference name) -> do
reference <- gets (Map.lookup name)
nameError <- callFn (fnName fnImplPtr "init_err") []
return $ fromMaybe nameError reference
Number (Num n) ->
callFn (fnName initNumT "init_num") [f64 n]
Apply (Application caller args) -> do
fn <- expandAST caller
argL <- mapM expandAST args >>= mkArray
callFn (fnName fnImplPtr "call_fn") [fn, argL]
_ ->
fail $ "unsupported ast" ++ show ast | 518 | expandAST ast = case ast of
Ref (Reference name) -> do
reference <- gets (Map.lookup name)
nameError <- callFn (fnName fnImplPtr "init_err") []
return $ fromMaybe nameError reference
Number (Num n) ->
callFn (fnName initNumT "init_num") [f64 n]
Apply (Application caller args) -> do
fn <- expandAST caller
argL <- mapM expandAST args >>= mkArray
callFn (fnName fnImplPtr "call_fn") [fn, argL]
_ ->
fail $ "unsupported ast" ++ show ast | 481 | false | true | 0 | 14 | 122 | 208 | 96 | 112 | null | null |
lancelotsix/hs-tls | core/Network/TLS/Record/State.hs | bsd-3-clause | getRecordVersion :: RecordM Version
getRecordVersion = RecordM $ \ver st -> Right (ver, st) | 91 | getRecordVersion :: RecordM Version
getRecordVersion = RecordM $ \ver st -> Right (ver, st) | 91 | getRecordVersion = RecordM $ \ver st -> Right (ver, st) | 55 | false | true | 2 | 7 | 13 | 40 | 19 | 21 | null | null |
charleso/intellij-haskforce | tests/gold/parser/Layout00005.hs | apache-2.0 | getOAuthTokens = do
let r = u $ initReq
{ method="POST"
, requestHeaders=[]
}
return r | 138 | getOAuthTokens = do
let r = u $ initReq
{ method="POST"
, requestHeaders=[]
}
return r | 138 | getOAuthTokens = do
let r = u $ initReq
{ method="POST"
, requestHeaders=[]
}
return r | 138 | false | false | 0 | 13 | 67 | 41 | 21 | 20 | null | null |
lancelet/approxier | src/lib/VecMath.hs | apache-2.0 | xformCompose :: XForm -- ^ transformation A
-> XForm -- ^ transformation B
-> XForm -- ^ transformation that is equal to applying A and then B
xformCompose (XForm x1 x1') (XForm x2 x2') = XForm (x2 * x1) (x1' * x2') | 244 | xformCompose :: XForm -- ^ transformation A
-> XForm -- ^ transformation B
-> XForm
xformCompose (XForm x1 x1') (XForm x2 x2') = XForm (x2 * x1) (x1' * x2') | 184 | xformCompose (XForm x1 x1') (XForm x2 x2') = XForm (x2 * x1) (x1' * x2') | 72 | true | true | 0 | 7 | 70 | 62 | 33 | 29 | null | null |
ganeti/htools | Ganeti/HTools/QC.hs | gpl-2.0 | testCluster =
[ run prop_Score_Zero
, run prop_CStats_sane
, run prop_ClusterAlloc_sane
, run prop_ClusterCanTieredAlloc
, run prop_ClusterAllocEvac
, run prop_ClusterAllocBalance
, run prop_ClusterCheckConsistency
, run prop_ClusterSplitCluster
] | 283 | testCluster =
[ run prop_Score_Zero
, run prop_CStats_sane
, run prop_ClusterAlloc_sane
, run prop_ClusterCanTieredAlloc
, run prop_ClusterAllocEvac
, run prop_ClusterAllocBalance
, run prop_ClusterCheckConsistency
, run prop_ClusterSplitCluster
] | 283 | testCluster =
[ run prop_Score_Zero
, run prop_CStats_sane
, run prop_ClusterAlloc_sane
, run prop_ClusterCanTieredAlloc
, run prop_ClusterAllocEvac
, run prop_ClusterAllocBalance
, run prop_ClusterCheckConsistency
, run prop_ClusterSplitCluster
] | 283 | false | false | 0 | 6 | 62 | 54 | 27 | 27 | null | null |
enolan/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | displayHelp = let vstr = showVersion getIdrisVersionNoGit in
"\nIdris version " ++ vstr ++ "\n" ++
"--------------" ++ map (\x -> '-') vstr ++ "\n\n" ++
concatMap cmdInfo helphead ++
concatMap cmdInfo help
where cmdInfo (cmds, args, text) = " " ++ col 16 12 (showSep " " cmds) (show args) text
col c1 c2 l m r =
l ++ take (c1 - length l) (repeat ' ') ++
m ++ take (c2 - length m) (repeat ' ') ++ r ++ "\n" | 497 | displayHelp = let vstr = showVersion getIdrisVersionNoGit in
"\nIdris version " ++ vstr ++ "\n" ++
"--------------" ++ map (\x -> '-') vstr ++ "\n\n" ++
concatMap cmdInfo helphead ++
concatMap cmdInfo help
where cmdInfo (cmds, args, text) = " " ++ col 16 12 (showSep " " cmds) (show args) text
col c1 c2 l m r =
l ++ take (c1 - length l) (repeat ' ') ++
m ++ take (c2 - length m) (repeat ' ') ++ r ++ "\n" | 497 | displayHelp = let vstr = showVersion getIdrisVersionNoGit in
"\nIdris version " ++ vstr ++ "\n" ++
"--------------" ++ map (\x -> '-') vstr ++ "\n\n" ++
concatMap cmdInfo helphead ++
concatMap cmdInfo help
where cmdInfo (cmds, args, text) = " " ++ col 16 12 (showSep " " cmds) (show args) text
col c1 c2 l m r =
l ++ take (c1 - length l) (repeat ' ') ++
m ++ take (c2 - length m) (repeat ' ') ++ r ++ "\n" | 497 | false | false | 1 | 13 | 175 | 198 | 97 | 101 | null | null |
antalsz/hs-to-coq | examples/base-src/gen-files/GHC/Stack/CCS.hs | mit | -- | Get the tail of a 'CostCentreStack'.
ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack)
ccsParent p = ((\hsc_ptr -> peekByteOff hsc_ptr 16)) p | 157 | ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack)
ccsParent p = ((\hsc_ptr -> peekByteOff hsc_ptr 16)) p | 115 | ccsParent p = ((\hsc_ptr -> peekByteOff hsc_ptr 16)) p | 54 | true | true | 0 | 9 | 24 | 50 | 25 | 25 | null | null |
othercriteria/blaze | RAE_draft.hs | mit | showEnv :: Env -> String
showEnv EnvEmpty = "(empty env)" | 57 | showEnv :: Env -> String
showEnv EnvEmpty = "(empty env)" | 57 | showEnv EnvEmpty = "(empty env)" | 32 | false | true | 0 | 5 | 9 | 18 | 9 | 9 | null | null |
zanesterling/haskell-compiler | src/NanoParsec/NanoParsec.hs | bsd-3-clause | satisfy = general_satisfy item | 30 | satisfy = general_satisfy item | 30 | satisfy = general_satisfy item | 30 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
uduki/hsQt | Qtc/Enums/Gui/QTableWidgetItem.hs | bsd-2-clause | ieQTableWidgetItemItemType :: Int -> QTableWidgetItemItemType
ieQTableWidgetItemItemType x = QEnum (CQTableWidgetItemItemType x) | 128 | ieQTableWidgetItemItemType :: Int -> QTableWidgetItemItemType
ieQTableWidgetItemItemType x = QEnum (CQTableWidgetItemItemType x) | 128 | ieQTableWidgetItemItemType x = QEnum (CQTableWidgetItemItemType x) | 66 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
ChrisBlom/Signs | src/Signs/Grammar.hs | mit | getIndexG :: SigName -> GrammarEnv (Maybe Int)
getIndexG name = do
grammar <- ask
return (elemIndex name (uncurry (:) $ signatureNames grammar))
-- Adds the types declared in a Grammar to a Term with the given Sig | 219 | getIndexG :: SigName -> GrammarEnv (Maybe Int)
getIndexG name = do
grammar <- ask
return (elemIndex name (uncurry (:) $ signatureNames grammar))
-- Adds the types declared in a Grammar to a Term with the given Sig | 219 | getIndexG name = do
grammar <- ask
return (elemIndex name (uncurry (:) $ signatureNames grammar))
-- Adds the types declared in a Grammar to a Term with the given Sig | 172 | false | true | 0 | 12 | 42 | 64 | 31 | 33 | null | null |
josejuan/IISLog | src/Data/IISLog.hs | mit | field "sc-status" x = mempty { status = readMaybe x } | 67 | field "sc-status" x = mempty { status = readMaybe x } | 67 | field "sc-status" x = mempty { status = readMaybe x } | 67 | false | false | 0 | 7 | 24 | 22 | 11 | 11 | null | null |
maximkulkin/aeson | Data/Aeson/TH.hs | bsd-3-clause | parseArgs tName _ (InfixC _ conName _) (Right valName) =
caseE (varE valName) $ parseProduct tName conName 2 | 112 | parseArgs tName _ (InfixC _ conName _) (Right valName) =
caseE (varE valName) $ parseProduct tName conName 2 | 112 | parseArgs tName _ (InfixC _ conName _) (Right valName) =
caseE (varE valName) $ parseProduct tName conName 2 | 112 | false | false | 3 | 6 | 21 | 55 | 24 | 31 | null | null |
florianpilz/autotool | src/Prolog/Data.hs | gpl-2.0 | varmap :: ( Identifier -> Identifier )
-> ( Term -> Term )
varmap sub t = case t of
Variable v -> Variable $ sub v
Apply f xs -> Apply f ( map ( varmap sub ) xs ) | 177 | varmap :: ( Identifier -> Identifier )
-> ( Term -> Term )
varmap sub t = case t of
Variable v -> Variable $ sub v
Apply f xs -> Apply f ( map ( varmap sub ) xs ) | 177 | varmap sub t = case t of
Variable v -> Variable $ sub v
Apply f xs -> Apply f ( map ( varmap sub ) xs ) | 111 | false | true | 4 | 7 | 55 | 70 | 37 | 33 | null | null |
brendanhay/gogol | gogol-sqladmin/gen/Network/Google/Resource/SQL/Instances/RestoreBackup.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
irbUploadType :: Lens' InstancesRestoreBackup (Maybe Text)
irbUploadType
= lens _irbUploadType
(\ s a -> s{_irbUploadType = a}) | 206 | irbUploadType :: Lens' InstancesRestoreBackup (Maybe Text)
irbUploadType
= lens _irbUploadType
(\ s a -> s{_irbUploadType = a}) | 135 | irbUploadType
= lens _irbUploadType
(\ s a -> s{_irbUploadType = a}) | 76 | true | true | 0 | 9 | 34 | 48 | 25 | 23 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.