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
davdar/maam
src/FP/Monads.hs
bsd-3-clause
errorStateCommute :: (Functor m) => ErrorT e (StateT s m) ~> StateT s (ErrorT e m) errorStateCommute aMRM = StateT $ \ s -> ErrorT $ ff ^$ runStateT s $ unErrorT aMRM where ff (_, Inl e) = Inl e ff (s, Inr a) = Inr (s, a)
231
errorStateCommute :: (Functor m) => ErrorT e (StateT s m) ~> StateT s (ErrorT e m) errorStateCommute aMRM = StateT $ \ s -> ErrorT $ ff ^$ runStateT s $ unErrorT aMRM where ff (_, Inl e) = Inl e ff (s, Inr a) = Inr (s, a)
231
errorStateCommute aMRM = StateT $ \ s -> ErrorT $ ff ^$ runStateT s $ unErrorT aMRM where ff (_, Inl e) = Inl e ff (s, Inr a) = Inr (s, a)
148
false
true
1
9
58
127
64
63
null
null
leptonyu/BrainFuck
src/Language/BrainFuck.hs
bsd-3-clause
optimizeLoop (Loop (a@(AddValue 0 (-1)):vs)) = case go vs of Nothing -> [Loop (a:vs)] Just vs' -> vs' ++ [SetValue 0 0] where go (AddValue i m:vs'') = go vs'' >>= \vs''' -> return (CopyValue i m 0:vs''') go (SetValue i m:vs'') | i /= 0 = go vs'' >>= \vs''' -> return (SetValueIf i m 0:vs''') go [] = Just [] go _ = Nothing
628
optimizeLoop (Loop (a@(AddValue 0 (-1)):vs)) = case go vs of Nothing -> [Loop (a:vs)] Just vs' -> vs' ++ [SetValue 0 0] where go (AddValue i m:vs'') = go vs'' >>= \vs''' -> return (CopyValue i m 0:vs''') go (SetValue i m:vs'') | i /= 0 = go vs'' >>= \vs''' -> return (SetValueIf i m 0:vs''') go [] = Just [] go _ = Nothing
628
optimizeLoop (Loop (a@(AddValue 0 (-1)):vs)) = case go vs of Nothing -> [Loop (a:vs)] Just vs' -> vs' ++ [SetValue 0 0] where go (AddValue i m:vs'') = go vs'' >>= \vs''' -> return (CopyValue i m 0:vs''') go (SetValue i m:vs'') | i /= 0 = go vs'' >>= \vs''' -> return (SetValueIf i m 0:vs''') go [] = Just [] go _ = Nothing
628
false
false
0
14
371
218
107
111
null
null
karamellpelle/grid
source/Game/LevelPuzzle/Helpers.hs
gpl-3.0
levelpuzzleModifyGrid :: LevelPuzzleWorld -> (GridWorld -> GridWorld) -> LevelPuzzleWorld levelpuzzleModifyGrid lvl f = levelpuzzleModifyContent lvl $ \cnt -> contentModifyGrid cnt f
186
levelpuzzleModifyGrid :: LevelPuzzleWorld -> (GridWorld -> GridWorld) -> LevelPuzzleWorld levelpuzzleModifyGrid lvl f = levelpuzzleModifyContent lvl $ \cnt -> contentModifyGrid cnt f
186
levelpuzzleModifyGrid lvl f = levelpuzzleModifyContent lvl $ \cnt -> contentModifyGrid cnt f
96
false
true
0
8
24
48
24
24
null
null
JohnLato/impulse
src/Reactive/Impulse/Internal/Weak.hs
lgpl-3.0
-- | Create a Weak reference keyed off a TVar. mkWeakTVarKey :: TVar b -> a -> Maybe (IO ()) -> IO (Weak a) mkWeakTVarKey (TVar r#) v (Just f) = IO $ \s -> case mkWeak# r# v f s of (# s1, w #) -> (# s1, Weak w #)
218
mkWeakTVarKey :: TVar b -> a -> Maybe (IO ()) -> IO (Weak a) mkWeakTVarKey (TVar r#) v (Just f) = IO $ \s -> case mkWeak# r# v f s of (# s1, w #) -> (# s1, Weak w #)
171
mkWeakTVarKey (TVar r#) v (Just f) = IO $ \s -> case mkWeak# r# v f s of (# s1, w #) -> (# s1, Weak w #)
110
true
true
0
11
57
107
53
54
null
null
djoyner/zigbee-znet25
src/Network/Protocol/ZigBee/ZNet25/Frame.hs
bsd-3-clause
getModemStatus :: Get Frame getModemStatus = ModemStatus <$> get
70
getModemStatus :: Get Frame getModemStatus = ModemStatus <$> get
70
getModemStatus = ModemStatus <$> get
42
false
true
0
5
14
18
9
9
null
null
Fedjmike/ngen
english.hs
gpl-3.0
---- Words ---- the, an :: Modifier English.Case the = modifier (\_ _ _ -> "the")
82
the, an :: Modifier English.Case the = modifier (\_ _ _ -> "the")
65
the = modifier (\_ _ _ -> "the")
32
true
true
2
7
16
40
19
21
null
null
ntc2/haskell-call-trace
src/Data/Function/Decorator/Test.hs
mpl-2.0
insertM :: forall (m :: * -> *). MonadState S m => String -> H Typeable -> m () insertM k v = modify i where i s = s { _hDict = Map.insert k v $ _hDict s }
163
insertM :: forall (m :: * -> *). MonadState S m => String -> H Typeable -> m () insertM k v = modify i where i s = s { _hDict = Map.insert k v $ _hDict s }
163
insertM k v = modify i where i s = s { _hDict = Map.insert k v $ _hDict s }
77
false
true
1
11
47
103
47
56
null
null
thalerjonathan/phd
coding/learning/haskell/grahambook/Code_Solutions/countdown2.hs
gpl-3.0
solutions :: [Int] -> Int -> [Expr] solutions ns n = [e | ns' <- choices ns, e <- exprs ns', eval e == [n]]
107
solutions :: [Int] -> Int -> [Expr] solutions ns n = [e | ns' <- choices ns, e <- exprs ns', eval e == [n]]
107
solutions ns n = [e | ns' <- choices ns, e <- exprs ns', eval e == [n]]
71
false
true
0
8
24
69
35
34
null
null
GaloisInc/halvm-ghc
compiler/types/Coercion.hs
bsd-3-clause
coercionSize (LRCo _ co) = 1 + coercionSize co
54
coercionSize (LRCo _ co) = 1 + coercionSize co
54
coercionSize (LRCo _ co) = 1 + coercionSize co
54
false
false
0
6
16
25
11
14
null
null
hephaestus-pl/hephaestus
willian/hephaestus-integrated/asset-base/bpmn/src/BusinessProcess/Types.hs
mit
parameters :: FlowObject -> [Parameter] parameters (FlowObject _ _ _ p) = p
76
parameters :: FlowObject -> [Parameter] parameters (FlowObject _ _ _ p) = p
75
parameters (FlowObject _ _ _ p) = p
35
false
true
0
7
13
33
17
16
null
null
noughtmare/yi
yi-keymap-vim/src/Yi/Keymap/Vim/Digraph.hs
gpl-2.0
-- DEVICE CONTROL ONE (DC1) switch 'D' '2' = '\x0012'
53
switch 'D' '2' = '\x0012'
25
switch 'D' '2' = '\x0012'
25
true
false
0
5
9
12
6
6
null
null
jeroenk/iTRSsVisualised
ExampleReduction2.hs
agpl-3.0
cReduction :: DynamicReduction cReduction = makeDynamic cReduction'
67
cReduction :: DynamicReduction cReduction = makeDynamic cReduction'
67
cReduction = makeDynamic cReduction'
36
false
true
0
6
6
20
8
12
null
null
alpicola/mel
src/Backend/PrettyPrint.hs
mit
ppTransfur (LMatch n alts default') = do newline write $ "match " ++ show n ++ ", " write $ "[" ++ intercalate ", " (map (\(i, l)-> '#' : show i ++ " " ++ show l) alts) ++ "]"
183
ppTransfur (LMatch n alts default') = do newline write $ "match " ++ show n ++ ", " write $ "[" ++ intercalate ", " (map (\(i, l)-> '#' : show i ++ " " ++ show l) alts) ++ "]"
183
ppTransfur (LMatch n alts default') = do newline write $ "match " ++ show n ++ ", " write $ "[" ++ intercalate ", " (map (\(i, l)-> '#' : show i ++ " " ++ show l) alts) ++ "]"
183
false
false
0
17
48
100
48
52
null
null
paulp/unison
parser-typechecker/src/Unison/TermParser.hs
mit
binding :: Var v => Parser (S v) (v, Term v) binding = traced "binding" . label "binding" $ do typ <- optional typedecl let lhs = attempt ((\arg1 op arg2 -> (op,[arg1,arg2])) <$> prefixVar <*> infixVar <*> prefixVar) <|> ((,) <$> prefixVar <*> many prefixVar) case typ of Nothing -> do -- we haven't seen a type annotation, so lookahead to '=' before commit (name, args) <- attempt (lhs <* eq) body <- block pure $ mkBinding name args body Just (nameT, typ) -> do (name, args) <- lhs when (name /= nameT) $ fail ("The type signature for ‘" ++ show (Var.name nameT) ++ "’ lacks an accompanying binding") body <- eq *> block pure $ fmap (\e -> Term.ann () e typ) (mkBinding name args body) where mkBinding f [] body = (f, body) mkBinding f args body = (f, Term.lam' () args body)
889
binding :: Var v => Parser (S v) (v, Term v) binding = traced "binding" . label "binding" $ do typ <- optional typedecl let lhs = attempt ((\arg1 op arg2 -> (op,[arg1,arg2])) <$> prefixVar <*> infixVar <*> prefixVar) <|> ((,) <$> prefixVar <*> many prefixVar) case typ of Nothing -> do -- we haven't seen a type annotation, so lookahead to '=' before commit (name, args) <- attempt (lhs <* eq) body <- block pure $ mkBinding name args body Just (nameT, typ) -> do (name, args) <- lhs when (name /= nameT) $ fail ("The type signature for ‘" ++ show (Var.name nameT) ++ "’ lacks an accompanying binding") body <- eq *> block pure $ fmap (\e -> Term.ann () e typ) (mkBinding name args body) where mkBinding f [] body = (f, body) mkBinding f args body = (f, Term.lam' () args body)
889
binding = traced "binding" . label "binding" $ do typ <- optional typedecl let lhs = attempt ((\arg1 op arg2 -> (op,[arg1,arg2])) <$> prefixVar <*> infixVar <*> prefixVar) <|> ((,) <$> prefixVar <*> many prefixVar) case typ of Nothing -> do -- we haven't seen a type annotation, so lookahead to '=' before commit (name, args) <- attempt (lhs <* eq) body <- block pure $ mkBinding name args body Just (nameT, typ) -> do (name, args) <- lhs when (name /= nameT) $ fail ("The type signature for ‘" ++ show (Var.name nameT) ++ "’ lacks an accompanying binding") body <- eq *> block pure $ fmap (\e -> Term.ann () e typ) (mkBinding name args body) where mkBinding f [] body = (f, body) mkBinding f args body = (f, Term.lam' () args body)
844
false
true
0
21
258
366
183
183
null
null
stephane-rolland/aastraal
aastraal-client-brick/src/Command.hs
gpl-3.0
parseElems ("ss" : args) = parseTimeLogStart args
49
parseElems ("ss" : args) = parseTimeLogStart args
49
parseElems ("ss" : args) = parseTimeLogStart args
49
false
false
0
6
6
20
9
11
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_2 (151#) = happyShift action_45
38
action_2 (151#) = happyShift action_45
38
action_2 (151#) = happyShift action_45
38
false
false
0
6
4
15
7
8
null
null
tjakway/ghcjvm
compiler/typecheck/TcPatSyn.hs
bsd-3-clause
tcPatToExpr :: [Located Name] -> LPat Name -> Either MsgDoc (LHsExpr Name) -- Given a /pattern/, return an /expression/ that builds a value -- that matches the pattern. E.g. if the pattern is (Just [x]), -- the expression is (Just [x]). They look the same, but the -- input uses constructors from HsPat and the output uses constructors -- from HsExpr. -- -- Returns (Left r) if the pattern is not invertible, for reason r. -- See Note [Builder for a bidirectional pattern synonym] tcPatToExpr args pat = go pat where lhsVars = mkNameSet (map unLoc args) -- Make a prefix con for prefix and infix patterns for simplicity mkPrefixConExpr :: Located Name -> [LPat Name] -> Either MsgDoc (HsExpr Name) mkPrefixConExpr lcon@(L loc _) pats = do { exprs <- mapM go pats ; return (foldl (\x y -> HsApp (L loc x) y) (HsVar lcon) exprs) } mkRecordConExpr :: Located Name -> HsRecFields Name (LPat Name) -> Either MsgDoc (HsExpr Name) mkRecordConExpr con fields = do { exprFields <- mapM go fields ; return (RecordCon con PlaceHolder noPostTcExpr exprFields) } go :: LPat Name -> Either MsgDoc (LHsExpr Name) go (L loc p) = L loc <$> go1 p go1 :: Pat Name -> Either MsgDoc (HsExpr Name) go1 (ConPatIn con info) = case info of PrefixCon ps -> mkPrefixConExpr con ps InfixCon l r -> mkPrefixConExpr con [l,r] RecCon fields -> mkRecordConExpr con fields go1 (SigPatIn pat _) = go1 (unLoc pat) -- See Note [Type signatures and the builder expression] go1 (VarPat (L l var)) | var `elemNameSet` lhsVars = return $ HsVar (L l var) | otherwise = Left (quotes (ppr var) <+> text "is not bound by the LHS of the pattern synonym") go1 (ParPat pat) = fmap HsPar $ go pat go1 (LazyPat pat) = go1 (unLoc pat) go1 (BangPat pat) = go1 (unLoc pat) go1 (PArrPat pats ptt) = do { exprs <- mapM go pats ; return $ ExplicitPArr ptt exprs } go1 (ListPat pats ptt reb) = do { exprs <- mapM go pats ; return $ ExplicitList ptt (fmap snd reb) exprs } go1 (TuplePat pats box _) = do { exprs <- mapM go pats ; return $ ExplicitTuple (map (noLoc . Present) exprs) box } go1 (LitPat lit) = return $ HsLit lit go1 (NPat (L _ n) mb_neg _ _) | Just neg <- mb_neg = return $ unLoc $ nlHsSyntaxApps neg [noLoc (HsOverLit n)] | otherwise = return $ HsOverLit n go1 (ConPatOut{}) = panic "ConPatOut in output of renamer" go1 (SigPatOut{}) = panic "SigPatOut in output of renamer" go1 (CoPat{}) = panic "CoPat in output of renamer" go1 p = Left (text "pattern" <+> quotes (ppr p) <+> text "is not invertible") {- Note [Builder for a bidirectional pattern synonym] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For a bidirectional pattern synonym we need to produce an /expression/ that matches the supplied /pattern/, given values for the arguments of the pattern synoymy. For example pattern F x y = (Just x, [y]) The 'builder' for F looks like $builderF x y = (Just x, [y]) We can't always do this: * Some patterns aren't invertible; e.g. view patterns pattern F x = (reverse -> x:_) * The RHS pattern might bind more variables than the pattern synonym, so again we can't invert it pattern F x = (x,y) * Ditto wildcards pattern F x = (x,_) Note [Redundant constraints for builder] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The builder can have redundant constraints, which are awkard to eliminate. Consider pattern P = Just 34 To match against this pattern we need (Eq a, Num a). But to build (Just 34) we need only (Num a). Fortunately instTcSigFromId sets sig_warn_redundant to False. ************************************************************************ * * Helper functions * * ************************************************************************ Note [As-patterns in pattern synonym definitions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The rationale for rejecting as-patterns in pattern synonym definitions is that an as-pattern would introduce nonindependent pattern synonym arguments, e.g. given a pattern synonym like: pattern K x y = x@(Just y) one could write a nonsensical function like f (K Nothing x) = ... or g (K (Just True) False) = ... Note [Type signatures and the builder expression] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider pattern L x = Left x :: Either [a] [b] In tc{Infer/Check}PatSynDecl we will check that the pattern has the specified type. We check the pattern *as a pattern*, so the type signature is a pattern signature, and so brings 'a' and 'b' into scope. But we don't have a way to bind 'a, b' in the LHS, as we do 'x', say. Nevertheless, the sigature may be useful to constrain the type. When making the binding for the *builder*, though, we don't want $buildL x = Left x :: Either [a] [b] because that wil either mean (forall a b. Either [a] [b]), or we'll get a complaint that 'a' and 'b' are out of scope. (Actually the latter; Trac #9867.) No, the job of the signature is done, so when converting the pattern to an expression (for the builder RHS) we simply discard the signature. Note [Record PatSyn Desugaring] ------------------------------- It is important that prov_theta comes before req_theta as this ordering is used when desugaring record pattern synonym updates. Any change to this ordering should make sure to change deSugar/DsExpr.hs if you want to avoid difficult to decipher core lint errors! -}
6,073
tcPatToExpr :: [Located Name] -> LPat Name -> Either MsgDoc (LHsExpr Name) tcPatToExpr args pat = go pat where lhsVars = mkNameSet (map unLoc args) -- Make a prefix con for prefix and infix patterns for simplicity mkPrefixConExpr :: Located Name -> [LPat Name] -> Either MsgDoc (HsExpr Name) mkPrefixConExpr lcon@(L loc _) pats = do { exprs <- mapM go pats ; return (foldl (\x y -> HsApp (L loc x) y) (HsVar lcon) exprs) } mkRecordConExpr :: Located Name -> HsRecFields Name (LPat Name) -> Either MsgDoc (HsExpr Name) mkRecordConExpr con fields = do { exprFields <- mapM go fields ; return (RecordCon con PlaceHolder noPostTcExpr exprFields) } go :: LPat Name -> Either MsgDoc (LHsExpr Name) go (L loc p) = L loc <$> go1 p go1 :: Pat Name -> Either MsgDoc (HsExpr Name) go1 (ConPatIn con info) = case info of PrefixCon ps -> mkPrefixConExpr con ps InfixCon l r -> mkPrefixConExpr con [l,r] RecCon fields -> mkRecordConExpr con fields go1 (SigPatIn pat _) = go1 (unLoc pat) -- See Note [Type signatures and the builder expression] go1 (VarPat (L l var)) | var `elemNameSet` lhsVars = return $ HsVar (L l var) | otherwise = Left (quotes (ppr var) <+> text "is not bound by the LHS of the pattern synonym") go1 (ParPat pat) = fmap HsPar $ go pat go1 (LazyPat pat) = go1 (unLoc pat) go1 (BangPat pat) = go1 (unLoc pat) go1 (PArrPat pats ptt) = do { exprs <- mapM go pats ; return $ ExplicitPArr ptt exprs } go1 (ListPat pats ptt reb) = do { exprs <- mapM go pats ; return $ ExplicitList ptt (fmap snd reb) exprs } go1 (TuplePat pats box _) = do { exprs <- mapM go pats ; return $ ExplicitTuple (map (noLoc . Present) exprs) box } go1 (LitPat lit) = return $ HsLit lit go1 (NPat (L _ n) mb_neg _ _) | Just neg <- mb_neg = return $ unLoc $ nlHsSyntaxApps neg [noLoc (HsOverLit n)] | otherwise = return $ HsOverLit n go1 (ConPatOut{}) = panic "ConPatOut in output of renamer" go1 (SigPatOut{}) = panic "SigPatOut in output of renamer" go1 (CoPat{}) = panic "CoPat in output of renamer" go1 p = Left (text "pattern" <+> quotes (ppr p) <+> text "is not invertible") {- Note [Builder for a bidirectional pattern synonym] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For a bidirectional pattern synonym we need to produce an /expression/ that matches the supplied /pattern/, given values for the arguments of the pattern synoymy. For example pattern F x y = (Just x, [y]) The 'builder' for F looks like $builderF x y = (Just x, [y]) We can't always do this: * Some patterns aren't invertible; e.g. view patterns pattern F x = (reverse -> x:_) * The RHS pattern might bind more variables than the pattern synonym, so again we can't invert it pattern F x = (x,y) * Ditto wildcards pattern F x = (x,_) Note [Redundant constraints for builder] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The builder can have redundant constraints, which are awkard to eliminate. Consider pattern P = Just 34 To match against this pattern we need (Eq a, Num a). But to build (Just 34) we need only (Num a). Fortunately instTcSigFromId sets sig_warn_redundant to False. ************************************************************************ * * Helper functions * * ************************************************************************ Note [As-patterns in pattern synonym definitions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The rationale for rejecting as-patterns in pattern synonym definitions is that an as-pattern would introduce nonindependent pattern synonym arguments, e.g. given a pattern synonym like: pattern K x y = x@(Just y) one could write a nonsensical function like f (K Nothing x) = ... or g (K (Just True) False) = ... Note [Type signatures and the builder expression] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider pattern L x = Left x :: Either [a] [b] In tc{Infer/Check}PatSynDecl we will check that the pattern has the specified type. We check the pattern *as a pattern*, so the type signature is a pattern signature, and so brings 'a' and 'b' into scope. But we don't have a way to bind 'a, b' in the LHS, as we do 'x', say. Nevertheless, the sigature may be useful to constrain the type. When making the binding for the *builder*, though, we don't want $buildL x = Left x :: Either [a] [b] because that wil either mean (forall a b. Either [a] [b]), or we'll get a complaint that 'a' and 'b' are out of scope. (Actually the latter; Trac #9867.) No, the job of the signature is done, so when converting the pattern to an expression (for the builder RHS) we simply discard the signature. Note [Record PatSyn Desugaring] ------------------------------- It is important that prov_theta comes before req_theta as this ordering is used when desugaring record pattern synonym updates. Any change to this ordering should make sure to change deSugar/DsExpr.hs if you want to avoid difficult to decipher core lint errors! -}
5,665
tcPatToExpr args pat = go pat where lhsVars = mkNameSet (map unLoc args) -- Make a prefix con for prefix and infix patterns for simplicity mkPrefixConExpr :: Located Name -> [LPat Name] -> Either MsgDoc (HsExpr Name) mkPrefixConExpr lcon@(L loc _) pats = do { exprs <- mapM go pats ; return (foldl (\x y -> HsApp (L loc x) y) (HsVar lcon) exprs) } mkRecordConExpr :: Located Name -> HsRecFields Name (LPat Name) -> Either MsgDoc (HsExpr Name) mkRecordConExpr con fields = do { exprFields <- mapM go fields ; return (RecordCon con PlaceHolder noPostTcExpr exprFields) } go :: LPat Name -> Either MsgDoc (LHsExpr Name) go (L loc p) = L loc <$> go1 p go1 :: Pat Name -> Either MsgDoc (HsExpr Name) go1 (ConPatIn con info) = case info of PrefixCon ps -> mkPrefixConExpr con ps InfixCon l r -> mkPrefixConExpr con [l,r] RecCon fields -> mkRecordConExpr con fields go1 (SigPatIn pat _) = go1 (unLoc pat) -- See Note [Type signatures and the builder expression] go1 (VarPat (L l var)) | var `elemNameSet` lhsVars = return $ HsVar (L l var) | otherwise = Left (quotes (ppr var) <+> text "is not bound by the LHS of the pattern synonym") go1 (ParPat pat) = fmap HsPar $ go pat go1 (LazyPat pat) = go1 (unLoc pat) go1 (BangPat pat) = go1 (unLoc pat) go1 (PArrPat pats ptt) = do { exprs <- mapM go pats ; return $ ExplicitPArr ptt exprs } go1 (ListPat pats ptt reb) = do { exprs <- mapM go pats ; return $ ExplicitList ptt (fmap snd reb) exprs } go1 (TuplePat pats box _) = do { exprs <- mapM go pats ; return $ ExplicitTuple (map (noLoc . Present) exprs) box } go1 (LitPat lit) = return $ HsLit lit go1 (NPat (L _ n) mb_neg _ _) | Just neg <- mb_neg = return $ unLoc $ nlHsSyntaxApps neg [noLoc (HsOverLit n)] | otherwise = return $ HsOverLit n go1 (ConPatOut{}) = panic "ConPatOut in output of renamer" go1 (SigPatOut{}) = panic "SigPatOut in output of renamer" go1 (CoPat{}) = panic "CoPat in output of renamer" go1 p = Left (text "pattern" <+> quotes (ppr p) <+> text "is not invertible") {- Note [Builder for a bidirectional pattern synonym] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For a bidirectional pattern synonym we need to produce an /expression/ that matches the supplied /pattern/, given values for the arguments of the pattern synoymy. For example pattern F x y = (Just x, [y]) The 'builder' for F looks like $builderF x y = (Just x, [y]) We can't always do this: * Some patterns aren't invertible; e.g. view patterns pattern F x = (reverse -> x:_) * The RHS pattern might bind more variables than the pattern synonym, so again we can't invert it pattern F x = (x,y) * Ditto wildcards pattern F x = (x,_) Note [Redundant constraints for builder] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The builder can have redundant constraints, which are awkard to eliminate. Consider pattern P = Just 34 To match against this pattern we need (Eq a, Num a). But to build (Just 34) we need only (Num a). Fortunately instTcSigFromId sets sig_warn_redundant to False. ************************************************************************ * * Helper functions * * ************************************************************************ Note [As-patterns in pattern synonym definitions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The rationale for rejecting as-patterns in pattern synonym definitions is that an as-pattern would introduce nonindependent pattern synonym arguments, e.g. given a pattern synonym like: pattern K x y = x@(Just y) one could write a nonsensical function like f (K Nothing x) = ... or g (K (Just True) False) = ... Note [Type signatures and the builder expression] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider pattern L x = Left x :: Either [a] [b] In tc{Infer/Check}PatSynDecl we will check that the pattern has the specified type. We check the pattern *as a pattern*, so the type signature is a pattern signature, and so brings 'a' and 'b' into scope. But we don't have a way to bind 'a, b' in the LHS, as we do 'x', say. Nevertheless, the sigature may be useful to constrain the type. When making the binding for the *builder*, though, we don't want $buildL x = Left x :: Either [a] [b] because that wil either mean (forall a b. Either [a] [b]), or we'll get a complaint that 'a' and 'b' are out of scope. (Actually the latter; Trac #9867.) No, the job of the signature is done, so when converting the pattern to an expression (for the builder RHS) we simply discard the signature. Note [Record PatSyn Desugaring] ------------------------------- It is important that prov_theta comes before req_theta as this ordering is used when desugaring record pattern synonym updates. Any change to this ordering should make sure to change deSugar/DsExpr.hs if you want to avoid difficult to decipher core lint errors! -}
5,590
true
true
3
14
1,715
972
462
510
null
null
nomeata/ghc
compiler/cmm/PprC.hs
bsd-3-clause
machRepCType :: CmmType -> SDoc machRepCType ty | isFloatType ty = machRep_F_CType w | otherwise = machRep_U_CType w where w = typeWidth ty
194
machRepCType :: CmmType -> SDoc machRepCType ty | isFloatType ty = machRep_F_CType w | otherwise = machRep_U_CType w where w = typeWidth ty
194
machRepCType ty | isFloatType ty = machRep_F_CType w | otherwise = machRep_U_CType w where w = typeWidth ty
162
false
true
0
8
77
52
23
29
null
null
mattias-lundell/timber-llvm
src/Type.hs
bsd-3-clause
{- Example 1: ========== -- Initially: let f :: P => S -> T f = \x -> e (f 7) -- After exp inference: \x -> e w (f v 7) ::X->T' \\ w::W, v::V -- After generalization: \w v x -> e w (f v 7) ::W->V->X->T' \\ -- After mu: let f = c (\w v x -> e w (f v 7)) ::P->S->T \\ c::(W->V->X->T')->(P->S->T) -- After improvement (T' = T, X = S, V = P): let f = c (\w v x -> e w (f v 7)) ::P->S->T \\ c::(W->P->S->T)->(P->S->T) -- After reduce: let f = (\c -> c (\w v x -> e w (f v 7))) (\i -> i w0) ::P->S->T \\ w0 :: W -- After generalization: let f = \w0 -> (\f -> ((\c -> c (\w v x -> e w (f v 7))) (\i -> i w0))) (f w0) ::W->P->S->T \\ -- After inlining: let f = \w0 -> \f -> ((\c -> c (\w v x -> e w (f v 7))) (\i -> i w0)) (f w0) ::W->P->S->T \\ let f = \w0 -> (\c -> c (\w v x -> e w (f w0 v 7))) (\i -> i w0) ::W->P->S->T \\ let f = \w0 -> (\i -> i w0) (\w v x -> e w (f w0 v 7)) ::W->P->S->T \\ let f = \w0 -> (\w v x -> e w (f w0 v 7)) w0 ::W->P->S->T \\ let f = \w0 v x -> e w0 (f w0 v 7) ::W->P->S->T \\ --------------- \i -> i w0 :: (W->P->S->T)->P->S->T \\ w0 :: W --------------- -} tiModule (Module _ _ xs' es' ds' ws' [bs']) (Module v ns xs es ds ws bss) = do env0' <- impPreds env0 pe' (env1,ds1,bs1) <- typeDecls env0' ps ds let env1' = addTEnv0 (tenvSelsCons ds') env1 (env2,bs2) <- instancePreds env1' pe -- Here it should be checked that any coercions in weqs follow the -- restricted rules for coercions, and that the equalities collected -- in env2 are actually met by the equations in bs1, bs2 and bss let env3 = insertDefaults (addTEnv0 (extsMap (es' ++ es)) env2) (pe'++pe) (xs'++xs) env4 = addCoercions (weqs1 ++ weqs) env3 weqs1 = eqnsOf bs1 ++ eqnsOf bs2 (ss0,pe0,bs0) <- tiBindsList env4 bss -- tr ("Top-level: \n" ++ render (nest 4 (vpr (tsigsOf bs0) $$ vpr pe0))) bs3 <- topresolve env4 ss0 pe0 bs0 -- tr ("Top-level after resolve: \n" ++ render (nest 4 (vpr (tsigsOf bs3)))) return (Module v ns xs es ds1 (dom weqs1 ++ ws) (groupBinds (concatBinds [bs1,bs2,bs3]))) where bs = concatBinds bss weqs = restrict (eqnsOf bs') ws' ++ restrict (eqnsOf bs) ws pe = restrict (tsigsOf bs) ws pe' = restrict (tsigsOf bs') ws' env0 = addTEnv0 (tsigsOf bs') (impDecls (initEnv v) ds') ps = filter (isGenerated . fst) (tsigsOf bs')
3,230
tiModule (Module _ _ xs' es' ds' ws' [bs']) (Module v ns xs es ds ws bss) = do env0' <- impPreds env0 pe' (env1,ds1,bs1) <- typeDecls env0' ps ds let env1' = addTEnv0 (tenvSelsCons ds') env1 (env2,bs2) <- instancePreds env1' pe -- Here it should be checked that any coercions in weqs follow the -- restricted rules for coercions, and that the equalities collected -- in env2 are actually met by the equations in bs1, bs2 and bss let env3 = insertDefaults (addTEnv0 (extsMap (es' ++ es)) env2) (pe'++pe) (xs'++xs) env4 = addCoercions (weqs1 ++ weqs) env3 weqs1 = eqnsOf bs1 ++ eqnsOf bs2 (ss0,pe0,bs0) <- tiBindsList env4 bss -- tr ("Top-level: \n" ++ render (nest 4 (vpr (tsigsOf bs0) $$ vpr pe0))) bs3 <- topresolve env4 ss0 pe0 bs0 -- tr ("Top-level after resolve: \n" ++ render (nest 4 (vpr (tsigsOf bs3)))) return (Module v ns xs es ds1 (dom weqs1 ++ ws) (groupBinds (concatBinds [bs1,bs2,bs3]))) where bs = concatBinds bss weqs = restrict (eqnsOf bs') ws' ++ restrict (eqnsOf bs) ws pe = restrict (tsigsOf bs) ws pe' = restrict (tsigsOf bs') ws' env0 = addTEnv0 (tsigsOf bs') (impDecls (initEnv v) ds') ps = filter (isGenerated . fst) (tsigsOf bs')
1,875
tiModule (Module _ _ xs' es' ds' ws' [bs']) (Module v ns xs es ds ws bss) = do env0' <- impPreds env0 pe' (env1,ds1,bs1) <- typeDecls env0' ps ds let env1' = addTEnv0 (tenvSelsCons ds') env1 (env2,bs2) <- instancePreds env1' pe -- Here it should be checked that any coercions in weqs follow the -- restricted rules for coercions, and that the equalities collected -- in env2 are actually met by the equations in bs1, bs2 and bss let env3 = insertDefaults (addTEnv0 (extsMap (es' ++ es)) env2) (pe'++pe) (xs'++xs) env4 = addCoercions (weqs1 ++ weqs) env3 weqs1 = eqnsOf bs1 ++ eqnsOf bs2 (ss0,pe0,bs0) <- tiBindsList env4 bss -- tr ("Top-level: \n" ++ render (nest 4 (vpr (tsigsOf bs0) $$ vpr pe0))) bs3 <- topresolve env4 ss0 pe0 bs0 -- tr ("Top-level after resolve: \n" ++ render (nest 4 (vpr (tsigsOf bs3)))) return (Module v ns xs es ds1 (dom weqs1 ++ ws) (groupBinds (concatBinds [bs1,bs2,bs3]))) where bs = concatBinds bss weqs = restrict (eqnsOf bs') ws' ++ restrict (eqnsOf bs) ws pe = restrict (tsigsOf bs) ws pe' = restrict (tsigsOf bs') ws' env0 = addTEnv0 (tsigsOf bs') (impDecls (initEnv v) ds') ps = filter (isGenerated . fst) (tsigsOf bs')
1,875
true
false
5
16
1,470
448
218
230
null
null
tibbe/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
createJumpTable :: DynFlags -> [Maybe BlockId] -> Section -> CLabel -> GenCmmDecl (Alignment, CmmStatics) h g createJumpTable dflags ids section lbl = let jumpTable | gopt Opt_PIC dflags = let jumpTableEntryRel Nothing = CmmStaticLit (CmmInt 0 (wordWidth dflags)) jumpTableEntryRel (Just blockid) = CmmStaticLit (CmmLabelDiffOff blockLabel lbl 0) where blockLabel = mkAsmTempLabel (getUnique blockid) in map jumpTableEntryRel ids | otherwise = map (jumpTableEntry dflags) ids in CmmData section (1, Statics lbl jumpTable)
707
createJumpTable :: DynFlags -> [Maybe BlockId] -> Section -> CLabel -> GenCmmDecl (Alignment, CmmStatics) h g createJumpTable dflags ids section lbl = let jumpTable | gopt Opt_PIC dflags = let jumpTableEntryRel Nothing = CmmStaticLit (CmmInt 0 (wordWidth dflags)) jumpTableEntryRel (Just blockid) = CmmStaticLit (CmmLabelDiffOff blockLabel lbl 0) where blockLabel = mkAsmTempLabel (getUnique blockid) in map jumpTableEntryRel ids | otherwise = map (jumpTableEntry dflags) ids in CmmData section (1, Statics lbl jumpTable)
707
createJumpTable dflags ids section lbl = let jumpTable | gopt Opt_PIC dflags = let jumpTableEntryRel Nothing = CmmStaticLit (CmmInt 0 (wordWidth dflags)) jumpTableEntryRel (Just blockid) = CmmStaticLit (CmmLabelDiffOff blockLabel lbl 0) where blockLabel = mkAsmTempLabel (getUnique blockid) in map jumpTableEntryRel ids | otherwise = map (jumpTableEntry dflags) ids in CmmData section (1, Statics lbl jumpTable)
581
false
true
0
18
256
192
91
101
null
null
esengie/fpl-exploration-tool
src/langGenerator/GeneratorTemplates/LangTemplate.hs
bsd-3-clause
fromScope3 x = fromScope $ fromScope2 x
39
fromScope3 x = fromScope $ fromScope2 x
39
fromScope3 x = fromScope $ fromScope2 x
39
false
false
0
6
6
16
7
9
null
null
kathawala/symdiff
cublas/Foreign/CUDA/Cusparse-bak/Error.hs
gpl-3.0
describe NotInitialized = "library not initialised"
52
describe NotInitialized = "library not initialised"
52
describe NotInitialized = "library not initialised"
52
false
false
0
5
6
9
4
5
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/types/Type.hs
bsd-3-clause
funArgTy :: Type -> Type -- ^ Extract the function argument type and panic if that is not possible funArgTy ty | Just ty' <- coreView ty = funArgTy ty'
151
funArgTy :: Type -> Type funArgTy ty | Just ty' <- coreView ty = funArgTy ty'
77
funArgTy ty | Just ty' <- coreView ty = funArgTy ty'
52
true
true
0
9
29
43
18
25
null
null
sdiehl/ghc
compiler/GHC/Cmm/CLabel.hs
bsd-3-clause
tempLabelPrefixOrUnderscore :: SDoc tempLabelPrefixOrUnderscore = sdocWithPlatform $ \platform -> getPprStyle $ \ sty -> if asmStyle sty then ptext (asmTempLabelPrefix platform) else char '_'
211
tempLabelPrefixOrUnderscore :: SDoc tempLabelPrefixOrUnderscore = sdocWithPlatform $ \platform -> getPprStyle $ \ sty -> if asmStyle sty then ptext (asmTempLabelPrefix platform) else char '_'
211
tempLabelPrefixOrUnderscore = sdocWithPlatform $ \platform -> getPprStyle $ \ sty -> if asmStyle sty then ptext (asmTempLabelPrefix platform) else char '_'
175
false
true
2
9
43
54
27
27
null
null
snoyberg/ghc
compiler/simplCore/CSE.hs
bsd-3-clause
emptyCSEnv :: CSEnv emptyCSEnv = CS { cs_map = emptyCoreMap, cs_subst = emptySubst }
84
emptyCSEnv :: CSEnv emptyCSEnv = CS { cs_map = emptyCoreMap, cs_subst = emptySubst }
84
emptyCSEnv = CS { cs_map = emptyCoreMap, cs_subst = emptySubst }
64
false
true
0
7
13
35
17
18
null
null
elieux/ghc
compiler/hsSyn/HsExpr.hs
bsd-3-clause
hsExprNeedsParens (HsUnboundVar {}) = False
45
hsExprNeedsParens (HsUnboundVar {}) = False
45
hsExprNeedsParens (HsUnboundVar {}) = False
45
false
false
0
6
6
17
8
9
null
null
jbracker/supermonad-plugin
src/Control/Super/Plugin/Constraint.hs
bsd-3-clause
-- ----------------------------------------------------------------------------- -- Constraint Inspection -- ----------------------------------------------------------------------------- -- | Check if the given constraint is a class constraint of the given class. isClassConstraint :: Class -> Ct -> Bool isClassConstraint wantedClass ct = case constraintClassType ct of Just (cls, _args) -> cls == wantedClass _ -> False -- | Checks if the given constraint belongs to any of the given classes.
506
isClassConstraint :: Class -> Ct -> Bool isClassConstraint wantedClass ct = case constraintClassType ct of Just (cls, _args) -> cls == wantedClass _ -> False -- | Checks if the given constraint belongs to any of the given classes.
241
isClassConstraint wantedClass ct = case constraintClassType ct of Just (cls, _args) -> cls == wantedClass _ -> False -- | Checks if the given constraint belongs to any of the given classes.
200
true
true
3
6
72
58
32
26
null
null
schell/odin
src/Odin/Scripts/ArrowControl.hs
mit
directionToCode South = ScancodeDown
36
directionToCode South = ScancodeDown
36
directionToCode South = ScancodeDown
36
false
false
0
5
3
9
4
5
null
null
spirit-fhs/core
Timetabling.hs
bsd-3-clause
{- | 'sortedLectureList' returns a list of OneLectures after sort by students-size and room-economy -} sortedLectureList :: [Lecture] -> [[OneLecture]] sortedLectureList = sortByStudents . sortByRoomEconomy . mkAllOneLecturePossibilities
244
sortedLectureList :: [Lecture] -> [[OneLecture]] sortedLectureList = sortByStudents . sortByRoomEconomy . mkAllOneLecturePossibilities
136
sortedLectureList = sortByStudents . sortByRoomEconomy . mkAllOneLecturePossibilities
87
true
true
0
7
33
33
19
14
null
null
urbanslug/ghc
testsuite/tests/stranal/T10482a.hs
bsd-3-clause
f4 :: T4 Int -> Int f4 (MkT4 x@(Foo v) y) | y>0 = f4 (MkT4 x (y-1)) | otherwise = v
111
f4 :: T4 Int -> Int f4 (MkT4 x@(Foo v) y) | y>0 = f4 (MkT4 x (y-1)) | otherwise = v
111
f4 (MkT4 x@(Foo v) y) | y>0 = f4 (MkT4 x (y-1)) | otherwise = v
91
false
true
2
10
49
82
37
45
null
null
olorin/amazonka
amazonka-storagegateway/test/Test/AWS/Gen/StorageGateway.hs
mpl-2.0
testDescribeTapeRecoveryPointsResponse :: DescribeTapeRecoveryPointsResponse -> TestTree testDescribeTapeRecoveryPointsResponse = res "DescribeTapeRecoveryPointsResponse" "fixture/DescribeTapeRecoveryPointsResponse.proto" storageGateway (Proxy :: Proxy DescribeTapeRecoveryPoints)
296
testDescribeTapeRecoveryPointsResponse :: DescribeTapeRecoveryPointsResponse -> TestTree testDescribeTapeRecoveryPointsResponse = res "DescribeTapeRecoveryPointsResponse" "fixture/DescribeTapeRecoveryPointsResponse.proto" storageGateway (Proxy :: Proxy DescribeTapeRecoveryPoints)
296
testDescribeTapeRecoveryPointsResponse = res "DescribeTapeRecoveryPointsResponse" "fixture/DescribeTapeRecoveryPointsResponse.proto" storageGateway (Proxy :: Proxy DescribeTapeRecoveryPoints)
207
false
true
0
6
30
36
17
19
null
null
liwanwei/pandoc
src/Text/Pandoc/Readers/Markdown.hs
gpl-2.0
isBulletListMarker '-' = True
29
isBulletListMarker '-' = True
29
isBulletListMarker '-' = True
29
false
false
0
5
3
9
4
5
null
null
olsner/ghc
compiler/ghci/ByteCodeGen.hs
bsd-3-clause
findPushSeq (N: rest) = (PUSH_APPLY_N, 1, rest)
49
findPushSeq (N: rest) = (PUSH_APPLY_N, 1, rest)
49
findPushSeq (N: rest) = (PUSH_APPLY_N, 1, rest)
49
false
false
0
7
8
25
14
11
null
null
olsner/ghc
compiler/nativeGen/RegAlloc/Liveness.hs
bsd-3-clause
checkIsReverseDependent :: Instruction instr => [SCC (LiveBasicBlock instr)] -- ^ SCCs of blocks that we're about to run the liveness determinator on. -> Maybe BlockId -- ^ BlockIds that fail the test (if any) checkIsReverseDependent sccs' = go emptyUniqSet sccs' where go _ [] = Nothing go blocksSeen (AcyclicSCC block : sccs) = let dests = slurpJumpDestsOfBlock block blocksSeen' = unionUniqSets blocksSeen $ mkUniqSet [blockId block] badDests = dests `minusUniqSet` blocksSeen' in case nonDetEltsUFM badDests of -- See Note [Unique Determinism and code generation] [] -> go blocksSeen' sccs bad : _ -> Just bad go blocksSeen (CyclicSCC blocks : sccs) = let dests = unionManyUniqSets $ map slurpJumpDestsOfBlock blocks blocksSeen' = unionUniqSets blocksSeen $ mkUniqSet $ map blockId blocks badDests = dests `minusUniqSet` blocksSeen' in case nonDetEltsUFM badDests of -- See Note [Unique Determinism and code generation] [] -> go blocksSeen' sccs bad : _ -> Just bad slurpJumpDestsOfBlock (BasicBlock _ instrs) = unionManyUniqSets $ map (mkUniqSet . jumpDestsOfInstr) [ i | LiveInstr i _ <- instrs] -- | If we've compute liveness info for this code already we have to reverse -- the SCCs in each top to get them back to the right order so we can do it again.
1,709
checkIsReverseDependent :: Instruction instr => [SCC (LiveBasicBlock instr)] -- ^ SCCs of blocks that we're about to run the liveness determinator on. -> Maybe BlockId checkIsReverseDependent sccs' = go emptyUniqSet sccs' where go _ [] = Nothing go blocksSeen (AcyclicSCC block : sccs) = let dests = slurpJumpDestsOfBlock block blocksSeen' = unionUniqSets blocksSeen $ mkUniqSet [blockId block] badDests = dests `minusUniqSet` blocksSeen' in case nonDetEltsUFM badDests of -- See Note [Unique Determinism and code generation] [] -> go blocksSeen' sccs bad : _ -> Just bad go blocksSeen (CyclicSCC blocks : sccs) = let dests = unionManyUniqSets $ map slurpJumpDestsOfBlock blocks blocksSeen' = unionUniqSets blocksSeen $ mkUniqSet $ map blockId blocks badDests = dests `minusUniqSet` blocksSeen' in case nonDetEltsUFM badDests of -- See Note [Unique Determinism and code generation] [] -> go blocksSeen' sccs bad : _ -> Just bad slurpJumpDestsOfBlock (BasicBlock _ instrs) = unionManyUniqSets $ map (mkUniqSet . jumpDestsOfInstr) [ i | LiveInstr i _ <- instrs] -- | If we've compute liveness info for this code already we have to reverse -- the SCCs in each top to get them back to the right order so we can do it again.
1,643
checkIsReverseDependent sccs' = go emptyUniqSet sccs' where go _ [] = Nothing go blocksSeen (AcyclicSCC block : sccs) = let dests = slurpJumpDestsOfBlock block blocksSeen' = unionUniqSets blocksSeen $ mkUniqSet [blockId block] badDests = dests `minusUniqSet` blocksSeen' in case nonDetEltsUFM badDests of -- See Note [Unique Determinism and code generation] [] -> go blocksSeen' sccs bad : _ -> Just bad go blocksSeen (CyclicSCC blocks : sccs) = let dests = unionManyUniqSets $ map slurpJumpDestsOfBlock blocks blocksSeen' = unionUniqSets blocksSeen $ mkUniqSet $ map blockId blocks badDests = dests `minusUniqSet` blocksSeen' in case nonDetEltsUFM badDests of -- See Note [Unique Determinism and code generation] [] -> go blocksSeen' sccs bad : _ -> Just bad slurpJumpDestsOfBlock (BasicBlock _ instrs) = unionManyUniqSets $ map (mkUniqSet . jumpDestsOfInstr) [ i | LiveInstr i _ <- instrs] -- | If we've compute liveness info for this code already we have to reverse -- the SCCs in each top to get them back to the right order so we can do it again.
1,443
true
true
0
12
650
323
158
165
null
null
rsasse/tamarin-prover
lib/term/src/Term/LTerm.hs
gpl-3.0
containsNoPrivateExcept :: [BC.ByteString] -> Term t -> Bool containsNoPrivateExcept funs t = case viewTerm t of Lit _ -> True FApp (NoEq (f,(_,Private))) as -> (elem f funs) && (all (containsNoPrivateExcept funs) as) FApp _ as -> all (containsNoPrivateExcept funs) as -- | A term is *simple* iff there is an instance of this term that can be -- constructed from public names only. i.e., the term does not contain any -- fresh names, fresh variables, or private function symbols.
543
containsNoPrivateExcept :: [BC.ByteString] -> Term t -> Bool containsNoPrivateExcept funs t = case viewTerm t of Lit _ -> True FApp (NoEq (f,(_,Private))) as -> (elem f funs) && (all (containsNoPrivateExcept funs) as) FApp _ as -> all (containsNoPrivateExcept funs) as -- | A term is *simple* iff there is an instance of this term that can be -- constructed from public names only. i.e., the term does not contain any -- fresh names, fresh variables, or private function symbols.
543
containsNoPrivateExcept funs t = case viewTerm t of Lit _ -> True FApp (NoEq (f,(_,Private))) as -> (elem f funs) && (all (containsNoPrivateExcept funs) as) FApp _ as -> all (containsNoPrivateExcept funs) as -- | A term is *simple* iff there is an instance of this term that can be -- constructed from public names only. i.e., the term does not contain any -- fresh names, fresh variables, or private function symbols.
482
false
true
0
12
143
128
65
63
null
null
achirkin/qua-view
src/Commons/Http.hs
mit
doHttp :: forall a b m . ( FromJSON b, IsXhrPayload a , HasJSContext m, MonadJSM m ) => XhrRequest a -> (Either JSError b -> IO ()) -> m () doHttp reqConfig cb = void $ newXMLHttpRequestWithError reqConfig cb' where cb' :: Either XhrException XhrResponse -> IO () cb' = handleErr >=> parseResp >=> cb parseResp = let parseJson (Just t) = parseJSONValue $ toJSString t parseJson Nothing = return $ Left mempty go val = case fromJSON val of JSON.Success v -> Right v JSON.Error str -> Left $ JSError $ pack str in fmap ((>>= go) . join) . sequence . fmap (parseJson . _xhrResponse_responseText) handleErr (Right res) = let status = fromIntegral $ _xhrResponse_status res fromMay (Just err) = textToJSString err fromMay Nothing = toJSString $ show status fromJSONMay x = case fromJSON x of JSON.Success v -> v JSON.Error _ -> Nothing in if status >= 200 && status < (300::Int) then pure $ Right res else do jserr <- maybe (pure $ Left "") (parseJSONValue . toJSString) $ _xhrResponse_responseText res return $ case jserr of Left _ -> Left . JSError . fromMay $ _xhrResponse_responseText res Right v -> Left . JSError . fromMay $ JSON.lookup ("message" :: JSString) v >>= fromJSONMay handleErr (Left XhrException_Error) = pure $ Left "XHR Error" handleErr (Left XhrException_Aborted) = pure $ Left "XHR Aborted"
1,707
doHttp :: forall a b m . ( FromJSON b, IsXhrPayload a , HasJSContext m, MonadJSM m ) => XhrRequest a -> (Either JSError b -> IO ()) -> m () doHttp reqConfig cb = void $ newXMLHttpRequestWithError reqConfig cb' where cb' :: Either XhrException XhrResponse -> IO () cb' = handleErr >=> parseResp >=> cb parseResp = let parseJson (Just t) = parseJSONValue $ toJSString t parseJson Nothing = return $ Left mempty go val = case fromJSON val of JSON.Success v -> Right v JSON.Error str -> Left $ JSError $ pack str in fmap ((>>= go) . join) . sequence . fmap (parseJson . _xhrResponse_responseText) handleErr (Right res) = let status = fromIntegral $ _xhrResponse_status res fromMay (Just err) = textToJSString err fromMay Nothing = toJSString $ show status fromJSONMay x = case fromJSON x of JSON.Success v -> v JSON.Error _ -> Nothing in if status >= 200 && status < (300::Int) then pure $ Right res else do jserr <- maybe (pure $ Left "") (parseJSONValue . toJSString) $ _xhrResponse_responseText res return $ case jserr of Left _ -> Left . JSError . fromMay $ _xhrResponse_responseText res Right v -> Left . JSError . fromMay $ JSON.lookup ("message" :: JSString) v >>= fromJSONMay handleErr (Left XhrException_Error) = pure $ Left "XHR Error" handleErr (Left XhrException_Aborted) = pure $ Left "XHR Aborted"
1,707
doHttp reqConfig cb = void $ newXMLHttpRequestWithError reqConfig cb' where cb' :: Either XhrException XhrResponse -> IO () cb' = handleErr >=> parseResp >=> cb parseResp = let parseJson (Just t) = parseJSONValue $ toJSString t parseJson Nothing = return $ Left mempty go val = case fromJSON val of JSON.Success v -> Right v JSON.Error str -> Left $ JSError $ pack str in fmap ((>>= go) . join) . sequence . fmap (parseJson . _xhrResponse_responseText) handleErr (Right res) = let status = fromIntegral $ _xhrResponse_status res fromMay (Just err) = textToJSString err fromMay Nothing = toJSString $ show status fromJSONMay x = case fromJSON x of JSON.Success v -> v JSON.Error _ -> Nothing in if status >= 200 && status < (300::Int) then pure $ Right res else do jserr <- maybe (pure $ Left "") (parseJSONValue . toJSString) $ _xhrResponse_responseText res return $ case jserr of Left _ -> Left . JSError . fromMay $ _xhrResponse_responseText res Right v -> Left . JSError . fromMay $ JSON.lookup ("message" :: JSString) v >>= fromJSONMay handleErr (Left XhrException_Error) = pure $ Left "XHR Error" handleErr (Left XhrException_Aborted) = pure $ Left "XHR Aborted"
1,542
false
true
6
20
625
559
265
294
null
null
typelead/epm
Cabal/Distribution/Simple/Program/HcPkg.hs
bsd-3-clause
unregisterInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> ProgramInvocation unregisterInvocation hpi verbosity packagedb pkgid = programInvocation (hcPkgProgram hpi) $ ["unregister", packageDbOpts hpi packagedb, display pkgid] ++ verbosityOpts hpi verbosity
309
unregisterInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> ProgramInvocation unregisterInvocation hpi verbosity packagedb pkgid = programInvocation (hcPkgProgram hpi) $ ["unregister", packageDbOpts hpi packagedb, display pkgid] ++ verbosityOpts hpi verbosity
309
unregisterInvocation hpi verbosity packagedb pkgid = programInvocation (hcPkgProgram hpi) $ ["unregister", packageDbOpts hpi packagedb, display pkgid] ++ verbosityOpts hpi verbosity
194
false
true
2
8
64
76
37
39
null
null
ambiata/highlighting-kate
Text/Highlighting/Kate/Syntax/Ocaml.hs
gpl-2.0
list_revised_syntax_keywords = Set.fromList $ words $ "declare value where"
75
list_revised_syntax_keywords = Set.fromList $ words $ "declare value where"
75
list_revised_syntax_keywords = Set.fromList $ words $ "declare value where"
75
false
false
0
7
8
16
8
8
null
null
beni55/cartel
lib/Cartel/Ast.hs
bsd-3-clause
-- | Always false. false :: Condition false = CLeaf CFalse
58
false :: Condition false = CLeaf CFalse
39
false = CLeaf CFalse
20
true
true
0
5
10
15
8
7
null
null
florianpilz/autotool
server/src/Util/Hash.hs
gpl-2.0
hashString :: String -> Digest hashString = S.showDigest . hashBase . BL.pack . map (fromIntegral . fromEnum)
109
hashString :: String -> Digest hashString = S.showDigest . hashBase . BL.pack . map (fromIntegral . fromEnum)
109
hashString = S.showDigest . hashBase . BL.pack . map (fromIntegral . fromEnum)
78
false
true
0
8
16
47
22
25
null
null
MichielDerhaeg/stack
src/Stack/Types/Package.hs
bsd-3-clause
-- | Get the installed Version. installedVersion :: Installed -> Version installedVersion = packageIdentifierVersion . installedPackageIdentifier
145
installedVersion :: Installed -> Version installedVersion = packageIdentifierVersion . installedPackageIdentifier
113
installedVersion = packageIdentifierVersion . installedPackageIdentifier
72
true
true
0
5
15
20
11
9
null
null
erochest/barth-scrape
src/BarthPar/Scrape/Chunks.hs
apache-2.0
rechunkPg :: Int -> Paragraph ContentBlock -> Paragraph Chunk rechunkPg size = over paragraphContent (rechunk size)
115
rechunkPg :: Int -> Paragraph ContentBlock -> Paragraph Chunk rechunkPg size = over paragraphContent (rechunk size)
115
rechunkPg size = over paragraphContent (rechunk size)
53
false
true
0
8
15
45
19
26
null
null
mbakke/ganeti
src/Ganeti/HTools/Program/Hcheck.hs
bsd-2-clause
maybeSimulateRebalance :: Bool -- ^ Whether to simulate rebalance -> Options -- ^ Command line options -> [GroupInfo] -- ^ Group data -> IO [GroupInfo] maybeSimulateRebalance True opts cluster = mapM (maybeSimulateGroupRebalance opts) cluster
341
maybeSimulateRebalance :: Bool -- ^ Whether to simulate rebalance -> Options -- ^ Command line options -> [GroupInfo] -- ^ Group data -> IO [GroupInfo] maybeSimulateRebalance True opts cluster = mapM (maybeSimulateGroupRebalance opts) cluster
341
maybeSimulateRebalance True opts cluster = mapM (maybeSimulateGroupRebalance opts) cluster
94
false
true
0
9
132
53
28
25
null
null
Soostone/bloodhound
src/Database/Bloodhound/Types.hs
bsd-3-clause
emptyAggregations :: Aggregations emptyAggregations = M.empty
61
emptyAggregations :: Aggregations emptyAggregations = M.empty
61
emptyAggregations = M.empty
27
false
true
0
5
5
13
7
6
null
null
infotroph/pandoc
src/Text/Pandoc/Writers/Custom.hs
gpl-2.0
inlineToCustom :: LuaState -> Inline -> IO String inlineToCustom lua (Str str) = callfunc lua "Str" str
104
inlineToCustom :: LuaState -> Inline -> IO String inlineToCustom lua (Str str) = callfunc lua "Str" str
103
inlineToCustom lua (Str str) = callfunc lua "Str" str
53
false
true
0
7
17
40
19
21
null
null
PiotrJustyna/zero
src/Tetrahedron.hs
bsd-3-clause
trianglesVerticesNormalsAndColours :: [(V4 Float, V4 Float, V3 Float)] trianglesVerticesNormalsAndColours = zip3 triangles (calculateNormalVectorsForTriangles triangles) reds
174
trianglesVerticesNormalsAndColours :: [(V4 Float, V4 Float, V3 Float)] trianglesVerticesNormalsAndColours = zip3 triangles (calculateNormalVectorsForTriangles triangles) reds
174
trianglesVerticesNormalsAndColours = zip3 triangles (calculateNormalVectorsForTriangles triangles) reds
103
false
true
0
7
14
45
23
22
null
null
iamkingmaker/HLearn
src/HLearn/Data/SpaceTree/CoverTree.hs
bsd-3-clause
exprat_ :: Field r => r exprat_ = fromRational $ unsafePerformIO $ readIORef expratIORef
88
exprat_ :: Field r => r exprat_ = fromRational $ unsafePerformIO $ readIORef expratIORef
88
exprat_ = fromRational $ unsafePerformIO $ readIORef expratIORef
64
false
true
0
6
13
29
14
15
null
null
ndmitchell/hlint
src/Hint/ListRec.hs
bsd-3-clause
delCons _ _ _ x = pure x
24
delCons _ _ _ x = pure x
24
delCons _ _ _ x = pure x
24
false
false
0
5
7
18
8
10
null
null
hvr/jhc
src/Util/IntBag.hs
mit
assocs :: IntBag -> [(Key,Int)] assocs m = toList m
51
assocs :: IntBag -> [(Key,Int)] assocs m = toList m
51
assocs m = toList m
19
false
true
0
7
9
30
16
14
null
null
mcschroeder/ghc
compiler/prelude/THNames.hs
bsd-3-clause
mkNameG_vName = thFun (fsLit "mkNameG_v") mkNameG_vIdKey
58
mkNameG_vName = thFun (fsLit "mkNameG_v") mkNameG_vIdKey
58
mkNameG_vName = thFun (fsLit "mkNameG_v") mkNameG_vIdKey
58
false
false
0
7
7
17
8
9
null
null
utky/budget
src/Budget/Database/Query.hs
bsd-3-clause
runNewQ x (Core.NewIncome i) = x <$ do (itemId, now) <- liftIO generateKeys insertQueryDB (Item.insertFromIncome itemId now i) ()
139
runNewQ x (Core.NewIncome i) = x <$ do (itemId, now) <- liftIO generateKeys insertQueryDB (Item.insertFromIncome itemId now i) ()
139
runNewQ x (Core.NewIncome i) = x <$ do (itemId, now) <- liftIO generateKeys insertQueryDB (Item.insertFromIncome itemId now i) ()
139
false
false
2
11
28
65
29
36
null
null
rpglover64/Haskell-Turtle-Library
src/Turtle/Prelude.hs
bsd-3-clause
-- | Get the time a file was last modified datefile :: MonadIO io => FilePath -> io UTCTime datefile path = liftIO (Filesystem.getModified path)
144
datefile :: MonadIO io => FilePath -> io UTCTime datefile path = liftIO (Filesystem.getModified path)
101
datefile path = liftIO (Filesystem.getModified path)
52
true
true
0
8
24
40
19
21
null
null
idupree/haskell-time-steward
TestSim.hs
gpl-3.0
showsEntityFieldIdentifier :: (Typeable p) => EntityId -> Proxy p -> ShowS showsEntityFieldIdentifier entityId proxy = showString "\"" . shows entityId . showString "@" . shows (typeRep proxy) . showString "\""
215
showsEntityFieldIdentifier :: (Typeable p) => EntityId -> Proxy p -> ShowS showsEntityFieldIdentifier entityId proxy = showString "\"" . shows entityId . showString "@" . shows (typeRep proxy) . showString "\""
215
showsEntityFieldIdentifier entityId proxy = showString "\"" . shows entityId . showString "@" . shows (typeRep proxy) . showString "\""
140
false
true
0
9
34
73
34
39
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/basicTypes/OccName.hs
bsd-3-clause
mkForeignExportOcc = mk_simple_deriv varName "$f"
51
mkForeignExportOcc = mk_simple_deriv varName "$f"
51
mkForeignExportOcc = mk_simple_deriv varName "$f"
51
false
false
1
5
6
14
5
9
null
null
vikraman/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
mkLHsPatTup :: [LPat id] -> LPat id mkLHsPatTup [] = noLoc $ TuplePat [] Boxed []
85
mkLHsPatTup :: [LPat id] -> LPat id mkLHsPatTup [] = noLoc $ TuplePat [] Boxed []
85
mkLHsPatTup [] = noLoc $ TuplePat [] Boxed []
49
false
true
2
8
19
52
22
30
null
null
jcpetruzza/haskell-ast
src/Language/GhcHaskell/Parser.hs
bsd-3-clause
parseType :: String -> ParseResult (Parsed Type) parseType = P.parse >=> fromHseType
84
parseType :: String -> ParseResult (Parsed Type) parseType = P.parse >=> fromHseType
84
parseType = P.parse >=> fromHseType
35
false
true
0
8
11
30
15
15
null
null
dimara/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
besParameterTypes :: Map String VType besParameterTypes = Map.fromList [(beAlwaysFailover, VTypeBool), (beAutoBalance, VTypeBool), (beMaxmem, VTypeSize), (beMinmem, VTypeSize), (beSpindleUse, VTypeInt), (beVcpus, VTypeInt)]
305
besParameterTypes :: Map String VType besParameterTypes = Map.fromList [(beAlwaysFailover, VTypeBool), (beAutoBalance, VTypeBool), (beMaxmem, VTypeSize), (beMinmem, VTypeSize), (beSpindleUse, VTypeInt), (beVcpus, VTypeInt)]
305
besParameterTypes = Map.fromList [(beAlwaysFailover, VTypeBool), (beAutoBalance, VTypeBool), (beMaxmem, VTypeSize), (beMinmem, VTypeSize), (beSpindleUse, VTypeInt), (beVcpus, VTypeInt)]
267
false
true
1
6
101
78
46
32
null
null
zhiyuanshi/fcore
backend/archive/CoreNew.hs
bsd-2-clause
mapVar _ _ (JClass c) = JClass c
47
mapVar _ _ (JClass c) = JClass c
47
mapVar _ _ (JClass c) = JClass c
47
false
false
0
7
22
22
10
12
null
null
brendanhay/gogol
gogol-admin-directory/gen/Network/Google/Resource/Directory/Members/Get.hs
mpl-2.0
-- | Identifies the group in the API request. The value can be the group\'s -- email address, group alias, or the unique group ID. mgGroupKey :: Lens' MembersGet Text mgGroupKey = lens _mgGroupKey (\ s a -> s{_mgGroupKey = a})
228
mgGroupKey :: Lens' MembersGet Text mgGroupKey = lens _mgGroupKey (\ s a -> s{_mgGroupKey = a})
97
mgGroupKey = lens _mgGroupKey (\ s a -> s{_mgGroupKey = a})
61
true
true
0
9
42
43
23
20
null
null
lukexi/ghc
compiler/cmm/CmmType.hs
bsd-3-clause
-- widening / narrowing narrowU :: Width -> Integer -> Integer narrowU W8 x = fromIntegral (fromIntegral x :: Word8)
118
narrowU :: Width -> Integer -> Integer narrowU W8 x = fromIntegral (fromIntegral x :: Word8)
93
narrowU W8 x = fromIntegral (fromIntegral x :: Word8)
54
true
true
0
8
21
42
20
22
null
null
rumblesan/haskell-experiments
src/Experiments/MonadT/ErrorIO.hs
bsd-3-clause
getRandomNumber :: IO Int getRandomNumber = randomRIO (0, 20)
61
getRandomNumber :: IO Int getRandomNumber = randomRIO (0, 20)
61
getRandomNumber = randomRIO (0, 20)
35
false
true
0
6
8
23
12
11
null
null
mkloczko/derive-storable-plugin
src/Foreign/Storable/Generic/Plugin/Internal/Compile.hs
mit
intListExpr' (l:ls) acc = intListExpr' ls $ App int_cons acc where int_t_cons = App (Var $ dataConWorkId consDataCon) (Type intTy) int_val = App (Var $ dataConWorkId intDataCon ) (intLiteral l) int_cons = App int_t_cons int_val -- | Compile expression to list and then write it back to core expr.
327
intListExpr' (l:ls) acc = intListExpr' ls $ App int_cons acc where int_t_cons = App (Var $ dataConWorkId consDataCon) (Type intTy) int_val = App (Var $ dataConWorkId intDataCon ) (intLiteral l) int_cons = App int_t_cons int_val -- | Compile expression to list and then write it back to core expr.
327
intListExpr' (l:ls) acc = intListExpr' ls $ App int_cons acc where int_t_cons = App (Var $ dataConWorkId consDataCon) (Type intTy) int_val = App (Var $ dataConWorkId intDataCon ) (intLiteral l) int_cons = App int_t_cons int_val -- | Compile expression to list and then write it back to core expr.
327
false
false
2
8
79
96
47
49
null
null
brendanhay/gogol
gogol-resourcemanager/gen/Network/Google/ResourceManager/Types/Product.hs
mpl-2.0
-- | Immutable. The resource name of the new TagKey\'s parent. Must be of the -- form \`organizations\/{org_id}\`. tkParent :: Lens' TagKey (Maybe Text) tkParent = lens _tkParent (\ s a -> s{_tkParent = a})
206
tkParent :: Lens' TagKey (Maybe Text) tkParent = lens _tkParent (\ s a -> s{_tkParent = a})
91
tkParent = lens _tkParent (\ s a -> s{_tkParent = a})
53
true
true
0
9
34
47
26
21
null
null
vikraman/ghc
libraries/base/Data/Data.hs
bsd-3-clause
k1DataType :: DataType k1DataType = mkDataType "GHC.Generics.K1" [k1Constr]
75
k1DataType :: DataType k1DataType = mkDataType "GHC.Generics.K1" [k1Constr]
75
k1DataType = mkDataType "GHC.Generics.K1" [k1Constr]
52
false
true
0
6
7
25
11
14
null
null
moonKimura/vector-0.10.9.1
tests/Utilities.hs
bsd-3-clause
imap :: (Int -> a -> a) -> [a] -> [a] imap f = map (uncurry f) . zip [0..]
74
imap :: (Int -> a -> a) -> [a] -> [a] imap f = map (uncurry f) . zip [0..]
74
imap f = map (uncurry f) . zip [0..]
36
false
true
0
8
19
58
30
28
null
null
geophf/1HaskellADay
exercises/HAD/Y2018/M02/D07/Solution.hs
mit
{-- BONUS ----------------------------------------------------------------- From the triage you did in Y2018.M01.D30.Solution, extract the UPDATED articles, insert them into the database (along with their associated blocks), then create and insert the megapacket, joining the updated articles with that packet. Manage any logged information. Yeah. All that. --} entry :: Severity -> String -> LogEntry entry sev = Entry sev "daily upload" "Y2018.M02.D07.Solution"
467
entry :: Severity -> String -> LogEntry entry sev = Entry sev "daily upload" "Y2018.M02.D07.Solution"
101
entry sev = Entry sev "daily upload" "Y2018.M02.D07.Solution"
61
true
true
0
6
63
30
15
15
null
null
jdreaver/oanda-rest-api
src/OANDA/Internal/Request.hs
bsd-3-clause
formatTimeRFC3339 :: ZonedTime -> String formatTimeRFC3339 zt@(ZonedTime _ z) = formatTime defaultTimeLocale "%FT%T" zt <> printZone where timeZoneStr = timeZoneOffsetString z printZone = if timeZoneStr == timeZoneOffsetString utc then "Z" else take 3 timeZoneStr <> ":" <> drop 3 timeZoneStr
342
formatTimeRFC3339 :: ZonedTime -> String formatTimeRFC3339 zt@(ZonedTime _ z) = formatTime defaultTimeLocale "%FT%T" zt <> printZone where timeZoneStr = timeZoneOffsetString z printZone = if timeZoneStr == timeZoneOffsetString utc then "Z" else take 3 timeZoneStr <> ":" <> drop 3 timeZoneStr
342
formatTimeRFC3339 zt@(ZonedTime _ z) = formatTime defaultTimeLocale "%FT%T" zt <> printZone where timeZoneStr = timeZoneOffsetString z printZone = if timeZoneStr == timeZoneOffsetString utc then "Z" else take 3 timeZoneStr <> ":" <> drop 3 timeZoneStr
301
false
true
1
9
89
90
44
46
null
null
wyager/Example-Distributed-App
Distributed.hs
mit
runServer :: ServerConfig -> ServerState -> Process () runServer config state = do let run handler msg = return $ execRWS (runAction $ handler msg) config state (state', outputMessages) <- receiveWait [ match $ run msgHandler, match $ run tickHandler] say $ "Current state: " ++ show state' mapM (\msg -> send (recipientOf msg) msg) outputMessages runServer config state'
415
runServer :: ServerConfig -> ServerState -> Process () runServer config state = do let run handler msg = return $ execRWS (runAction $ handler msg) config state (state', outputMessages) <- receiveWait [ match $ run msgHandler, match $ run tickHandler] say $ "Current state: " ++ show state' mapM (\msg -> send (recipientOf msg) msg) outputMessages runServer config state'
415
runServer config state = do let run handler msg = return $ execRWS (runAction $ handler msg) config state (state', outputMessages) <- receiveWait [ match $ run msgHandler, match $ run tickHandler] say $ "Current state: " ++ show state' mapM (\msg -> send (recipientOf msg) msg) outputMessages runServer config state'
360
false
true
0
14
102
149
70
79
null
null
melted/idris-lua
src/IRTS/CodegenLua.hs
isc
cgOp LReadStr [_] = pfuncall "io.input(io.stdin):read" []
57
cgOp LReadStr [_] = pfuncall "io.input(io.stdin):read" []
57
cgOp LReadStr [_] = pfuncall "io.input(io.stdin):read" []
57
false
false
0
6
6
23
10
13
null
null
abakst/liquidhaskell
tests/neg/vector0.hs
bsd-3-clause
prop0 = liquidAssertB (x >= 0) where x = Prelude.head xs
64
prop0 = liquidAssertB (x >= 0) where x = Prelude.head xs
64
prop0 = liquidAssertB (x >= 0) where x = Prelude.head xs
64
false
false
1
7
18
32
14
18
null
null
afabian80/coca-hs
ColorizeHtml.hs
apache-2.0
process :: [Set.Set String] -> String -> String process = processRecurse False
78
process :: [Set.Set String] -> String -> String process = processRecurse False
78
process = processRecurse False
30
false
true
0
9
11
36
16
20
null
null
GRACeFUL-project/haskelzinc
src/Interfaces/MZBuiltIns.hs
bsd-3-clause
-- | @-@ (the unary operator) minus_ = U mz_minus
50
minus_ = U mz_minus
20
minus_ = U mz_minus
20
true
false
0
5
10
10
5
5
null
null
rfranek/duckling
Duckling/Ordinal/GA/Corpus.hs
bsd-3-clause
corpus :: Corpus corpus = (testContext {lang = GA}, allExamples)
64
corpus :: Corpus corpus = (testContext {lang = GA}, allExamples)
64
corpus = (testContext {lang = GA}, allExamples)
47
false
true
0
7
9
25
15
10
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 14450 = 3138
32
getValueFromProduct 14450 = 3138
32
getValueFromProduct 14450 = 3138
32
false
false
0
5
3
9
4
5
null
null
bacchanalia/KitchenSink
KitchenSink/Qualified.hs
gpl-3.0
-- |'Set.empty' s_empty = Set.empty
35
s_empty = Set.empty
19
s_empty = Set.empty
19
true
false
0
5
4
9
5
4
null
null
olorin/amazonka
amazonka-config/test/Test/AWS/Gen/Config.hs
mpl-2.0
-- Auto-generated: the actual test selection needs to be manually placed into -- the top-level so that real test data can be incrementally added. -- -- This commented snippet is what the entire set should look like: -- fixtures :: TestTree -- fixtures = -- [ testGroup "request" -- [ testGetResourceConfigHistory $ -- getResourceConfigHistory -- -- , testStopConfigurationRecorder $ -- stopConfigurationRecorder -- -- , testDeliverConfigSnapshot $ -- deliverConfigSnapshot -- -- , testDescribeConfigurationRecorders $ -- describeConfigurationRecorders -- -- , testStartConfigurationRecorder $ -- startConfigurationRecorder -- -- , testDescribeConfigurationRecorderStatus $ -- describeConfigurationRecorderStatus -- -- , testPutConfigurationRecorder $ -- putConfigurationRecorder -- -- , testDescribeDeliveryChannelStatus $ -- describeDeliveryChannelStatus -- -- , testPutDeliveryChannel $ -- putDeliveryChannel -- -- , testDeleteDeliveryChannel $ -- deleteDeliveryChannel -- -- , testListDiscoveredResources $ -- listDiscoveredResources -- -- , testDescribeDeliveryChannels $ -- describeDeliveryChannels -- -- ] -- , testGroup "response" -- [ testGetResourceConfigHistoryResponse $ -- getResourceConfigHistoryResponse -- -- , testStopConfigurationRecorderResponse $ -- stopConfigurationRecorderResponse -- -- , testDeliverConfigSnapshotResponse $ -- deliverConfigSnapshotResponse -- -- , testDescribeConfigurationRecordersResponse $ -- describeConfigurationRecordersResponse -- -- , testStartConfigurationRecorderResponse $ -- startConfigurationRecorderResponse -- -- , testDescribeConfigurationRecorderStatusResponse $ -- describeConfigurationRecorderStatusResponse -- -- , testPutConfigurationRecorderResponse $ -- putConfigurationRecorderResponse -- -- , testDescribeDeliveryChannelStatusResponse $ -- describeDeliveryChannelStatusResponse -- -- , testPutDeliveryChannelResponse $ -- putDeliveryChannelResponse -- -- , testDeleteDeliveryChannelResponse $ -- deleteDeliveryChannelResponse -- -- , testListDiscoveredResourcesResponse $ -- listDiscoveredResourcesResponse -- -- , testDescribeDeliveryChannelsResponse $ -- describeDeliveryChannelsResponse -- -- ] -- ] -- Requests testGetResourceConfigHistory :: GetResourceConfigHistory -> TestTree testGetResourceConfigHistory = req "GetResourceConfigHistory" "fixture/GetResourceConfigHistory.yaml"
2,874
testGetResourceConfigHistory :: GetResourceConfigHistory -> TestTree testGetResourceConfigHistory = req "GetResourceConfigHistory" "fixture/GetResourceConfigHistory.yaml"
178
testGetResourceConfigHistory = req "GetResourceConfigHistory" "fixture/GetResourceConfigHistory.yaml"
109
true
true
0
5
761
105
94
11
null
null
brendanhay/gogol
gogol-cloudasset/gen/Network/Google/CloudAsset/Types/Product.hs
mpl-2.0
-- | A list of resources, currently only projects in the form \`projects\/\`, -- that are allowed to be accessed by sources defined in the corresponding -- EgressFrom. A request matches if it contains a resource in this list. If -- \`*\` is specified for \`resources\`, then this EgressTo rule will -- authorize access to all resources outside the perimeter. giamvetResources :: Lens' GoogleIdentityAccesscontextManagerV1EgressTo [Text] giamvetResources = lens _giamvetResources (\ s a -> s{_giamvetResources = a}) . _Default . _Coerce
555
giamvetResources :: Lens' GoogleIdentityAccesscontextManagerV1EgressTo [Text] giamvetResources = lens _giamvetResources (\ s a -> s{_giamvetResources = a}) . _Default . _Coerce
196
giamvetResources = lens _giamvetResources (\ s a -> s{_giamvetResources = a}) . _Default . _Coerce
118
true
true
2
8
99
61
32
29
null
null
ezyang/ghc
testsuite/tests/pmcheck/should_compile/EmptyCase008.hs
bsd-3-clause
-- Non-exhaustive. (no info about a) f12 :: Foo3 a -> () f12 = \case
68
f12 :: Foo3 a -> () f12 = \case
31
f12 = \case
11
true
true
0
8
14
29
13
16
null
null
thewoolleyman/haskellbook
15/14/maor/ChapterExercises/test/Spec.hs
unlicense
main :: IO () main = do quickCheck (semigroupAssoc :: Trivial -> Trivial -> Trivial -> Bool) quickCheck (semigroupAssoc :: (Identity Trivial) -> (Identity Trivial) -> (Identity Trivial) -> Bool) quickCheck (semigroupAssoc :: (Identity MyInt) -> (Identity MyInt) -> (Identity MyInt) -> Bool) quickCheck (semigroupAssoc :: (Two Trivial MyInt) -> (Two Trivial MyInt) -> (Two Trivial MyInt) -> Bool) quickCheck (semigroupAssoc :: (Three Trivial MyInt MyInt) -> (Three Trivial MyInt MyInt) -> (Three Trivial MyInt MyInt) -> Bool) quickCheck (semigroupAssoc :: (Four Trivial MyInt MyInt Trivial) -> (Four Trivial MyInt MyInt Trivial) -> (Four Trivial MyInt MyInt Trivial) -> Bool) quickCheck (semigroupAssoc :: BoolConj -> BoolConj -> BoolConj -> Bool) quickCheck (semigroupAssoc :: BoolDisj -> BoolDisj -> BoolDisj -> Bool) quickCheck (semigroupAssoc :: (Or Int Bool) -> (Or Int Bool) -> (Or Int Bool) -> Bool) quickCheck (semigroupAssoc :: (Validation MyInt Bool) -> (Validation MyInt Bool) -> (Validation MyInt Bool) -> Bool) -- Monoid quickCheck (monoidLeftIdentity :: Trivial -> Bool) quickCheck (monoidRightIdentity :: Trivial -> Bool) quickCheck (monoidLeftIdentity :: (Identity Trivial) -> Bool) quickCheck (monoidRightIdentity :: (Identity Trivial) -> Bool) quickCheck (monoidLeftIdentity :: (Two Trivial MyInt) -> Bool) quickCheck (monoidRightIdentity :: (Two Trivial MyInt) -> Bool) quickCheck (monoidLeftIdentity :: BoolConj -> Bool) quickCheck (monoidRightIdentity :: BoolConj -> Bool) quickCheck (monoidLeftIdentity :: BoolDisj -> Bool) quickCheck (monoidRightIdentity :: BoolDisj -> Bool)
1,642
main :: IO () main = do quickCheck (semigroupAssoc :: Trivial -> Trivial -> Trivial -> Bool) quickCheck (semigroupAssoc :: (Identity Trivial) -> (Identity Trivial) -> (Identity Trivial) -> Bool) quickCheck (semigroupAssoc :: (Identity MyInt) -> (Identity MyInt) -> (Identity MyInt) -> Bool) quickCheck (semigroupAssoc :: (Two Trivial MyInt) -> (Two Trivial MyInt) -> (Two Trivial MyInt) -> Bool) quickCheck (semigroupAssoc :: (Three Trivial MyInt MyInt) -> (Three Trivial MyInt MyInt) -> (Three Trivial MyInt MyInt) -> Bool) quickCheck (semigroupAssoc :: (Four Trivial MyInt MyInt Trivial) -> (Four Trivial MyInt MyInt Trivial) -> (Four Trivial MyInt MyInt Trivial) -> Bool) quickCheck (semigroupAssoc :: BoolConj -> BoolConj -> BoolConj -> Bool) quickCheck (semigroupAssoc :: BoolDisj -> BoolDisj -> BoolDisj -> Bool) quickCheck (semigroupAssoc :: (Or Int Bool) -> (Or Int Bool) -> (Or Int Bool) -> Bool) quickCheck (semigroupAssoc :: (Validation MyInt Bool) -> (Validation MyInt Bool) -> (Validation MyInt Bool) -> Bool) -- Monoid quickCheck (monoidLeftIdentity :: Trivial -> Bool) quickCheck (monoidRightIdentity :: Trivial -> Bool) quickCheck (monoidLeftIdentity :: (Identity Trivial) -> Bool) quickCheck (monoidRightIdentity :: (Identity Trivial) -> Bool) quickCheck (monoidLeftIdentity :: (Two Trivial MyInt) -> Bool) quickCheck (monoidRightIdentity :: (Two Trivial MyInt) -> Bool) quickCheck (monoidLeftIdentity :: BoolConj -> Bool) quickCheck (monoidRightIdentity :: BoolConj -> Bool) quickCheck (monoidLeftIdentity :: BoolDisj -> Bool) quickCheck (monoidRightIdentity :: BoolDisj -> Bool)
1,642
main = do quickCheck (semigroupAssoc :: Trivial -> Trivial -> Trivial -> Bool) quickCheck (semigroupAssoc :: (Identity Trivial) -> (Identity Trivial) -> (Identity Trivial) -> Bool) quickCheck (semigroupAssoc :: (Identity MyInt) -> (Identity MyInt) -> (Identity MyInt) -> Bool) quickCheck (semigroupAssoc :: (Two Trivial MyInt) -> (Two Trivial MyInt) -> (Two Trivial MyInt) -> Bool) quickCheck (semigroupAssoc :: (Three Trivial MyInt MyInt) -> (Three Trivial MyInt MyInt) -> (Three Trivial MyInt MyInt) -> Bool) quickCheck (semigroupAssoc :: (Four Trivial MyInt MyInt Trivial) -> (Four Trivial MyInt MyInt Trivial) -> (Four Trivial MyInt MyInt Trivial) -> Bool) quickCheck (semigroupAssoc :: BoolConj -> BoolConj -> BoolConj -> Bool) quickCheck (semigroupAssoc :: BoolDisj -> BoolDisj -> BoolDisj -> Bool) quickCheck (semigroupAssoc :: (Or Int Bool) -> (Or Int Bool) -> (Or Int Bool) -> Bool) quickCheck (semigroupAssoc :: (Validation MyInt Bool) -> (Validation MyInt Bool) -> (Validation MyInt Bool) -> Bool) -- Monoid quickCheck (monoidLeftIdentity :: Trivial -> Bool) quickCheck (monoidRightIdentity :: Trivial -> Bool) quickCheck (monoidLeftIdentity :: (Identity Trivial) -> Bool) quickCheck (monoidRightIdentity :: (Identity Trivial) -> Bool) quickCheck (monoidLeftIdentity :: (Two Trivial MyInt) -> Bool) quickCheck (monoidRightIdentity :: (Two Trivial MyInt) -> Bool) quickCheck (monoidLeftIdentity :: BoolConj -> Bool) quickCheck (monoidRightIdentity :: BoolConj -> Bool) quickCheck (monoidLeftIdentity :: BoolDisj -> Bool) quickCheck (monoidRightIdentity :: BoolDisj -> Bool)
1,628
false
true
0
13
264
619
310
309
null
null
binesiyu/ifl
ifpt-master/Template.hs
mit
applyToStats :: (TiStats -> TiStats) -> TiState -> TiState applyToStats stats_fun (stack, dump, heap, sc_defs, stats) = (stack, dump, heap, sc_defs, stats_fun stats)
167
applyToStats :: (TiStats -> TiStats) -> TiState -> TiState applyToStats stats_fun (stack, dump, heap, sc_defs, stats) = (stack, dump, heap, sc_defs, stats_fun stats)
167
applyToStats stats_fun (stack, dump, heap, sc_defs, stats) = (stack, dump, heap, sc_defs, stats_fun stats)
108
false
true
0
7
24
64
37
27
null
null
mratkovic/PUH_project
src/Assignment.hs
mit
testExistAssignment :: Assignment -> IO () testExistAssignment a = do exists <- existsAssigmentDir a unless exists $ throw NoSuchAssigmentException return () -- | Function that determines path on file system for given assignment.
243
testExistAssignment :: Assignment -> IO () testExistAssignment a = do exists <- existsAssigmentDir a unless exists $ throw NoSuchAssigmentException return () -- | Function that determines path on file system for given assignment.
243
testExistAssignment a = do exists <- existsAssigmentDir a unless exists $ throw NoSuchAssigmentException return () -- | Function that determines path on file system for given assignment.
200
false
true
0
9
46
59
25
34
null
null
Gwin73/Schemini
src/one-file-version/Schemini.hs
mit
eval (List [Atom "load", Atom fileName]) = lift $ return $ List []
66
eval (List [Atom "load", Atom fileName]) = lift $ return $ List []
66
eval (List [Atom "load", Atom fileName]) = lift $ return $ List []
66
false
false
0
9
12
40
19
21
null
null
olsner/ghc
compiler/types/Coercion.hs
bsd-3-clause
splitForAllCo_maybe _ = Nothing
51
splitForAllCo_maybe _ = Nothing
51
splitForAllCo_maybe _ = Nothing
51
false
false
0
5
23
9
4
5
null
null
vikraman/ghc
compiler/codeGen/StgCmmClosure.hs
bsd-3-clause
thunkEntryLabel dflags _thunk_id _ (SelectorThunk offset) upd_flag = enterSelectorLabel dflags upd_flag offset
112
thunkEntryLabel dflags _thunk_id _ (SelectorThunk offset) upd_flag = enterSelectorLabel dflags upd_flag offset
112
thunkEntryLabel dflags _thunk_id _ (SelectorThunk offset) upd_flag = enterSelectorLabel dflags upd_flag offset
112
false
false
2
7
13
40
14
26
null
null
gebner/reforest
Demo.hs
mit
-- exampleLang :: [Term] -- exampleLang = [f (g c c) (g c c), g (f c c) (f c c), f (g d d) (g d d), g (f d d) (f d d)] -- where -- f x y = App (Con "f" 2) [x,y] -- g x y = App (Con "g" 2) [x,y] -- c = App (Con "c" 0) [] -- d = App (Con "d" 0) [] exampleLang :: [Term] exampleLang = concatMap (\i -> map (r i) sq) [0..9] where sq = take 50 $ iterate f c f x = App (Con "f" 1) [x] r i x = App (Con ("r" ++ show (i :: Int)) 1) [x] c = App (Con "c" 0) []
487
exampleLang :: [Term] exampleLang = concatMap (\i -> map (r i) sq) [0..9] where sq = take 50 $ iterate f c f x = App (Con "f" 1) [x] r i x = App (Con ("r" ++ show (i :: Int)) 1) [x] c = App (Con "c" 0) []
222
exampleLang = concatMap (\i -> map (r i) sq) [0..9] where sq = take 50 $ iterate f c f x = App (Con "f" 1) [x] r i x = App (Con ("r" ++ show (i :: Int)) 1) [x] c = App (Con "c" 0) []
200
true
true
0
11
160
156
83
73
null
null
lukexi/ghc-7.8-arm64
compiler/main/DynFlags.hs
bsd-3-clause
splitPathList :: String -> [String] splitPathList s = filter notNull (splitUp s) -- empty paths are ignored: there might be a trailing -- ':' in the initial list, for example. Empty paths can -- cause confusion when they are translated into -I options -- for passing to gcc. where #ifndef mingw32_TARGET_OS splitUp xs = split split_marker xs #else -- Windows: 'hybrid' support for DOS-style paths in directory lists. -- -- That is, if "foo:bar:baz" is used, this interpreted as -- consisting of three entries, 'foo', 'bar', 'baz'. -- However, with "c:/foo:c:\\foo;x:/bar", this is interpreted -- as 3 elts, "c:/foo", "c:\\foo", "x:/bar" -- -- Notice that no attempt is made to fully replace the 'standard' -- split marker ':' with the Windows / DOS one, ';'. The reason being -- that this will cause too much breakage for users & ':' will -- work fine even with DOS paths, if you're not insisting on being silly. -- So, use either. splitUp [] = [] splitUp (x:':':div:xs) | div `elem` dir_markers = ((x:':':div:p): splitUp rs) where (p,rs) = findNextPath xs -- we used to check for existence of the path here, but that -- required the IO monad to be threaded through the command-line -- parser which is quite inconvenient. The splitUp xs = cons p (splitUp rs) where (p,rs) = findNextPath xs cons "" xs = xs cons x xs = x:xs -- will be called either when we've consumed nought or the -- "<Drive>:/" part of a DOS path, so splitting is just a Q of -- finding the next split marker. findNextPath xs = case break (`elem` split_markers) xs of (p, _:ds) -> (p, ds) (p, xs) -> (p, xs) split_markers :: [Char] split_markers = [':', ';'] dir_markers :: [Char] dir_markers = ['/', '\\'] #endif -- ----------------------------------------------------------------------------- -- tmpDir, where we store temporary files.
2,212
splitPathList :: String -> [String] splitPathList s = filter notNull (splitUp s) -- empty paths are ignored: there might be a trailing -- ':' in the initial list, for example. Empty paths can -- cause confusion when they are translated into -I options -- for passing to gcc. where #ifndef mingw32_TARGET_OS splitUp xs = split split_marker xs #else -- Windows: 'hybrid' support for DOS-style paths in directory lists. -- -- That is, if "foo:bar:baz" is used, this interpreted as -- consisting of three entries, 'foo', 'bar', 'baz'. -- However, with "c:/foo:c:\\foo;x:/bar", this is interpreted -- as 3 elts, "c:/foo", "c:\\foo", "x:/bar" -- -- Notice that no attempt is made to fully replace the 'standard' -- split marker ':' with the Windows / DOS one, ';'. The reason being -- that this will cause too much breakage for users & ':' will -- work fine even with DOS paths, if you're not insisting on being silly. -- So, use either. splitUp [] = [] splitUp (x:':':div:xs) | div `elem` dir_markers = ((x:':':div:p): splitUp rs) where (p,rs) = findNextPath xs -- we used to check for existence of the path here, but that -- required the IO monad to be threaded through the command-line -- parser which is quite inconvenient. The splitUp xs = cons p (splitUp rs) where (p,rs) = findNextPath xs cons "" xs = xs cons x xs = x:xs -- will be called either when we've consumed nought or the -- "<Drive>:/" part of a DOS path, so splitting is just a Q of -- finding the next split marker. findNextPath xs = case break (`elem` split_markers) xs of (p, _:ds) -> (p, ds) (p, xs) -> (p, xs) split_markers :: [Char] split_markers = [':', ';'] dir_markers :: [Char] dir_markers = ['/', '\\'] #endif -- ----------------------------------------------------------------------------- -- tmpDir, where we store temporary files.
2,212
splitPathList s = filter notNull (splitUp s) -- empty paths are ignored: there might be a trailing -- ':' in the initial list, for example. Empty paths can -- cause confusion when they are translated into -I options -- for passing to gcc. where #ifndef mingw32_TARGET_OS splitUp xs = split split_marker xs #else -- Windows: 'hybrid' support for DOS-style paths in directory lists. -- -- That is, if "foo:bar:baz" is used, this interpreted as -- consisting of three entries, 'foo', 'bar', 'baz'. -- However, with "c:/foo:c:\\foo;x:/bar", this is interpreted -- as 3 elts, "c:/foo", "c:\\foo", "x:/bar" -- -- Notice that no attempt is made to fully replace the 'standard' -- split marker ':' with the Windows / DOS one, ';'. The reason being -- that this will cause too much breakage for users & ':' will -- work fine even with DOS paths, if you're not insisting on being silly. -- So, use either. splitUp [] = [] splitUp (x:':':div:xs) | div `elem` dir_markers = ((x:':':div:p): splitUp rs) where (p,rs) = findNextPath xs -- we used to check for existence of the path here, but that -- required the IO monad to be threaded through the command-line -- parser which is quite inconvenient. The splitUp xs = cons p (splitUp rs) where (p,rs) = findNextPath xs cons "" xs = xs cons x xs = x:xs -- will be called either when we've consumed nought or the -- "<Drive>:/" part of a DOS path, so splitting is just a Q of -- finding the next split marker. findNextPath xs = case break (`elem` split_markers) xs of (p, _:ds) -> (p, ds) (p, xs) -> (p, xs) split_markers :: [Char] split_markers = [':', ';'] dir_markers :: [Char] dir_markers = ['/', '\\'] #endif -- ----------------------------------------------------------------------------- -- tmpDir, where we store temporary files.
2,176
false
true
1
8
710
66
33
33
null
null
nevrenato/HetsAlloy
OWL2/ProveFact.hs
gpl-2.0
runTimedFact :: FilePath -- ^ basename of problem file -> String -- ^ problem content -> Maybe String -- ^ entail content -> Int -- ^ time limit in seconds -> IO (Maybe (Bool, ExitCode, String, TimeOfDay)) runTimedFact tmpFileName prob mEnt tLimit = do let hasEnt = isJust mEnt jar = if hasEnt then "OWLFactProver.jar" else "OWLFact.jar" jlibName = "libFaCTPlusPlusJNI.so" (progTh, toolPath) <- check4HetsOWLjar jar hasJniLib <- doesFileExist $ "/lib/" ++ jlibName (_, arch, _) <- executeProcess "uname" ["-m"] "" if progTh then withinDirectory toolPath $ do mJni <- fmap (lookup "HETS_JNI_LIBS") getEnvironment let jni = fromMaybe ("lib/native/" ++ trim arch) mJni hasJni <- doesFileExist $ jni </> jlibName if hasJni || hasJniLib then do timeTmpFile <- getTempFile prob tmpFileName let entailsFile = timeTmpFile ++ ".entail.owl" jargs = ["-Djava.library.path=" ++ jni | not hasJniLib || isJust mJni ] ++ ["-jar", jar, "file://" ++ timeTmpFile] ++ ["file://" ++ entailsFile | hasEnt ] case mEnt of Just entail -> writeFile entailsFile entail _ -> return () t_start <- getHetsTime mExit <- timeoutCommand tLimit "java" jargs t_end <- getHetsTime removeFile timeTmpFile when hasEnt $ removeFile entailsFile return $ fmap (\ (ex, out, err) -> (True, ex, out ++ err, diffHetsTime t_end t_start)) mExit else return $ Just (False, ExitSuccess, "no " ++ jlibName, midnight) else return $ Just (False, ExitSuccess, jar ++ " not found.", midnight) {- | Invocation of the Fact Prover. -}
1,843
runTimedFact :: FilePath -- ^ basename of problem file -> String -- ^ problem content -> Maybe String -- ^ entail content -> Int -- ^ time limit in seconds -> IO (Maybe (Bool, ExitCode, String, TimeOfDay)) runTimedFact tmpFileName prob mEnt tLimit = do let hasEnt = isJust mEnt jar = if hasEnt then "OWLFactProver.jar" else "OWLFact.jar" jlibName = "libFaCTPlusPlusJNI.so" (progTh, toolPath) <- check4HetsOWLjar jar hasJniLib <- doesFileExist $ "/lib/" ++ jlibName (_, arch, _) <- executeProcess "uname" ["-m"] "" if progTh then withinDirectory toolPath $ do mJni <- fmap (lookup "HETS_JNI_LIBS") getEnvironment let jni = fromMaybe ("lib/native/" ++ trim arch) mJni hasJni <- doesFileExist $ jni </> jlibName if hasJni || hasJniLib then do timeTmpFile <- getTempFile prob tmpFileName let entailsFile = timeTmpFile ++ ".entail.owl" jargs = ["-Djava.library.path=" ++ jni | not hasJniLib || isJust mJni ] ++ ["-jar", jar, "file://" ++ timeTmpFile] ++ ["file://" ++ entailsFile | hasEnt ] case mEnt of Just entail -> writeFile entailsFile entail _ -> return () t_start <- getHetsTime mExit <- timeoutCommand tLimit "java" jargs t_end <- getHetsTime removeFile timeTmpFile when hasEnt $ removeFile entailsFile return $ fmap (\ (ex, out, err) -> (True, ex, out ++ err, diffHetsTime t_end t_start)) mExit else return $ Just (False, ExitSuccess, "no " ++ jlibName, midnight) else return $ Just (False, ExitSuccess, jar ++ " not found.", midnight) {- | Invocation of the Fact Prover. -}
1,843
runTimedFact tmpFileName prob mEnt tLimit = do let hasEnt = isJust mEnt jar = if hasEnt then "OWLFactProver.jar" else "OWLFact.jar" jlibName = "libFaCTPlusPlusJNI.so" (progTh, toolPath) <- check4HetsOWLjar jar hasJniLib <- doesFileExist $ "/lib/" ++ jlibName (_, arch, _) <- executeProcess "uname" ["-m"] "" if progTh then withinDirectory toolPath $ do mJni <- fmap (lookup "HETS_JNI_LIBS") getEnvironment let jni = fromMaybe ("lib/native/" ++ trim arch) mJni hasJni <- doesFileExist $ jni </> jlibName if hasJni || hasJniLib then do timeTmpFile <- getTempFile prob tmpFileName let entailsFile = timeTmpFile ++ ".entail.owl" jargs = ["-Djava.library.path=" ++ jni | not hasJniLib || isJust mJni ] ++ ["-jar", jar, "file://" ++ timeTmpFile] ++ ["file://" ++ entailsFile | hasEnt ] case mEnt of Just entail -> writeFile entailsFile entail _ -> return () t_start <- getHetsTime mExit <- timeoutCommand tLimit "java" jargs t_end <- getHetsTime removeFile timeTmpFile when hasEnt $ removeFile entailsFile return $ fmap (\ (ex, out, err) -> (True, ex, out ++ err, diffHetsTime t_end t_start)) mExit else return $ Just (False, ExitSuccess, "no " ++ jlibName, midnight) else return $ Just (False, ExitSuccess, jar ++ " not found.", midnight) {- | Invocation of the Fact Prover. -}
1,593
false
true
0
22
595
501
253
248
null
null
gnn/Hets
OWL2/XMLConversion.hs
gpl-2.0
xmlAssertion :: IRI -> Annotations -> [Element] xmlAssertion iri = map (\ (Annotation as ap av) -> makeElement annotationAssertionK $ xmlAnnotations as ++ [mwNameIRI annotationPropertyK ap] ++ [xmlSubject iri, case av of AnnValue avalue -> xmlSubject avalue AnnValLit l -> xmlLiteral l])
339
xmlAssertion :: IRI -> Annotations -> [Element] xmlAssertion iri = map (\ (Annotation as ap av) -> makeElement annotationAssertionK $ xmlAnnotations as ++ [mwNameIRI annotationPropertyK ap] ++ [xmlSubject iri, case av of AnnValue avalue -> xmlSubject avalue AnnValLit l -> xmlLiteral l])
339
xmlAssertion iri = map (\ (Annotation as ap av) -> makeElement annotationAssertionK $ xmlAnnotations as ++ [mwNameIRI annotationPropertyK ap] ++ [xmlSubject iri, case av of AnnValue avalue -> xmlSubject avalue AnnValLit l -> xmlLiteral l])
291
false
true
0
13
93
109
53
56
null
null
rodrigogribeiro/mptc
src/Tc/Kc/KcDriver.hs
bsd-3-clause
kcDecl d@(TypeDecl _ _ _ _) = kcType d
38
kcDecl d@(TypeDecl _ _ _ _) = kcType d
38
kcDecl d@(TypeDecl _ _ _ _) = kcType d
38
false
false
0
8
8
27
13
14
null
null
ezyang/ghc
compiler/typecheck/TcType.hs
bsd-3-clause
tcSplitForAllTy_maybe :: Type -> Maybe (TyVarBinder, Type) tcSplitForAllTy_maybe ty | Just ty' <- tcView ty = tcSplitForAllTy_maybe ty'
135
tcSplitForAllTy_maybe :: Type -> Maybe (TyVarBinder, Type) tcSplitForAllTy_maybe ty | Just ty' <- tcView ty = tcSplitForAllTy_maybe ty'
135
tcSplitForAllTy_maybe ty | Just ty' <- tcView ty = tcSplitForAllTy_maybe ty'
76
false
true
0
9
17
50
22
28
null
null
deweyvm/pone
src/Pone/Parser/Expr.hs
gpl-3.0
parseIdentifier :: Parser (Expr (Type Kind)) parseIdentifier = Identifier <$> (identifier <|> parseTypeCtor) <*> return UnknownT
128
parseIdentifier :: Parser (Expr (Type Kind)) parseIdentifier = Identifier <$> (identifier <|> parseTypeCtor) <*> return UnknownT
128
parseIdentifier = Identifier <$> (identifier <|> parseTypeCtor) <*> return UnknownT
83
false
true
0
9
15
44
22
22
null
null
stephenpascoe/mongo-sql
src/Transfuser/Mongo/Parser.hs
bsd-3-clause
bsonifyValue :: A.Value -> Parser B.Value bsonifyValue (Object obj) = B.Doc <$> toBson obj
90
bsonifyValue :: A.Value -> Parser B.Value bsonifyValue (Object obj) = B.Doc <$> toBson obj
90
bsonifyValue (Object obj) = B.Doc <$> toBson obj
48
false
true
0
7
13
40
19
21
null
null
olsner/sedition
Sed.hs
mit
addScript s o = o { scripts = Left (C.pack s) : scripts o }
59
addScript s o = o { scripts = Left (C.pack s) : scripts o }
59
addScript s o = o { scripts = Left (C.pack s) : scripts o }
59
false
false
0
11
14
37
18
19
null
null
silkapp/tagsoup
Text/HTML/TagSoup/Render.hs
bsd-3-clause
-- | Show a list of tags using settings supplied by the 'RenderOptions' parameter, -- eg. to avoid escaping any characters one could do: -- -- > renderTagsOptions renderOptions{optEscape = id} [TagText "my&"] == "my&" renderTagsOptions :: StringLike str => RenderOptions str -> [Tag str] -> str renderTagsOptions opts = strConcat . tags where s = fromString ss x = [s x] tags (TagOpen name atts:TagClose name2:xs) | name == name2 && optMinimize opts name = open name atts (s " /") ++ tags xs tags (TagOpen name atts:xs) | Just ('?',_) <- uncons name = open name atts (s " ?") ++ tags xs | optRawTag opts name = let (a,b) = break (== TagClose name) (TagOpen name atts:xs) in concatMap (\x -> case x of TagText s -> [s]; _ -> tag x) a ++ tags b tags (x:xs) = tag x ++ tags xs tags [] = [] tag (TagOpen name atts) = open name atts (s "") tag (TagClose name) = [s "</", name, s ">"] tag (TagText text) = [txt text] tag (TagComment text) = ss "<!--" ++ com text ++ ss "-->" tag _ = ss "" txt = optEscape opts open name atts shut = [s "<",name] ++ concatMap (if optEmptyAttr opts then att else attX) atts ++ [shut,s ">"] att (x,y) | xnull && ynull = [s " \"\""] | ynull = [s " ", x] | xnull = [s " \"",txt y,s "\""] | otherwise = [s " ",x,s "=\"",txt y,s "\""] where (xnull, ynull) = (strNull x, strNull y) attX (x,y) = [s " ",x,s "=\"",txt y,s "\""] com xs | Just ('-',xs) <- uncons xs, Just ('-',xs) <- uncons xs, Just ('>',xs) <- uncons xs = s "-- >" : com xs com xs = case uncons xs of Nothing -> [] Just (x,xs) -> fromChar x : com xs
1,841
renderTagsOptions :: StringLike str => RenderOptions str -> [Tag str] -> str renderTagsOptions opts = strConcat . tags where s = fromString ss x = [s x] tags (TagOpen name atts:TagClose name2:xs) | name == name2 && optMinimize opts name = open name atts (s " /") ++ tags xs tags (TagOpen name atts:xs) | Just ('?',_) <- uncons name = open name atts (s " ?") ++ tags xs | optRawTag opts name = let (a,b) = break (== TagClose name) (TagOpen name atts:xs) in concatMap (\x -> case x of TagText s -> [s]; _ -> tag x) a ++ tags b tags (x:xs) = tag x ++ tags xs tags [] = [] tag (TagOpen name atts) = open name atts (s "") tag (TagClose name) = [s "</", name, s ">"] tag (TagText text) = [txt text] tag (TagComment text) = ss "<!--" ++ com text ++ ss "-->" tag _ = ss "" txt = optEscape opts open name atts shut = [s "<",name] ++ concatMap (if optEmptyAttr opts then att else attX) atts ++ [shut,s ">"] att (x,y) | xnull && ynull = [s " \"\""] | ynull = [s " ", x] | xnull = [s " \"",txt y,s "\""] | otherwise = [s " ",x,s "=\"",txt y,s "\""] where (xnull, ynull) = (strNull x, strNull y) attX (x,y) = [s " ",x,s "=\"",txt y,s "\""] com xs | Just ('-',xs) <- uncons xs, Just ('-',xs) <- uncons xs, Just ('>',xs) <- uncons xs = s "-- >" : com xs com xs = case uncons xs of Nothing -> [] Just (x,xs) -> fromChar x : com xs
1,621
renderTagsOptions opts = strConcat . tags where s = fromString ss x = [s x] tags (TagOpen name atts:TagClose name2:xs) | name == name2 && optMinimize opts name = open name atts (s " /") ++ tags xs tags (TagOpen name atts:xs) | Just ('?',_) <- uncons name = open name atts (s " ?") ++ tags xs | optRawTag opts name = let (a,b) = break (== TagClose name) (TagOpen name atts:xs) in concatMap (\x -> case x of TagText s -> [s]; _ -> tag x) a ++ tags b tags (x:xs) = tag x ++ tags xs tags [] = [] tag (TagOpen name atts) = open name atts (s "") tag (TagClose name) = [s "</", name, s ">"] tag (TagText text) = [txt text] tag (TagComment text) = ss "<!--" ++ com text ++ ss "-->" tag _ = ss "" txt = optEscape opts open name atts shut = [s "<",name] ++ concatMap (if optEmptyAttr opts then att else attX) atts ++ [shut,s ">"] att (x,y) | xnull && ynull = [s " \"\""] | ynull = [s " ", x] | xnull = [s " \"",txt y,s "\""] | otherwise = [s " ",x,s "=\"",txt y,s "\""] where (xnull, ynull) = (strNull x, strNull y) attX (x,y) = [s " ",x,s "=\"",txt y,s "\""] com xs | Just ('-',xs) <- uncons xs, Just ('-',xs) <- uncons xs, Just ('>',xs) <- uncons xs = s "-- >" : com xs com xs = case uncons xs of Nothing -> [] Just (x,xs) -> fromChar x : com xs
1,544
true
true
1
15
619
829
406
423
null
null
michaelt/streaming-bytestring
Data/ByteString/Streaming.hs
bsd-3-clause
intercalate s (Effect m) = Go $ liftM (intercalate s) m
55
intercalate s (Effect m) = Go $ liftM (intercalate s) m
55
intercalate s (Effect m) = Go $ liftM (intercalate s) m
55
false
false
0
8
10
34
15
19
null
null
sapek/pandoc
src/Text/Pandoc/Writers/HTML.hs
gpl-2.0
toListItems :: WriterOptions -> [Html] -> [Html] toListItems opts items = map (toListItem opts) items ++ [nl opts]
114
toListItems :: WriterOptions -> [Html] -> [Html] toListItems opts items = map (toListItem opts) items ++ [nl opts]
114
toListItems opts items = map (toListItem opts) items ++ [nl opts]
65
false
true
0
8
17
51
26
25
null
null
mathk/arm-isa
Arm/ArmDecode.hs
mit
parseRegisterShiftShiftArgument :: ArmStreamState ArgumentsInstruction parseRegisterShiftShiftArgument = do regd <- parseRegister 12 regm <- parseRegister 8 regn <- parseRegister 0 return $ RegisterShiftShiftedArgs regd regm regn
250
parseRegisterShiftShiftArgument :: ArmStreamState ArgumentsInstruction parseRegisterShiftShiftArgument = do regd <- parseRegister 12 regm <- parseRegister 8 regn <- parseRegister 0 return $ RegisterShiftShiftedArgs regd regm regn
249
parseRegisterShiftShiftArgument = do regd <- parseRegister 12 regm <- parseRegister 8 regn <- parseRegister 0 return $ RegisterShiftShiftedArgs regd regm regn
178
false
true
0
8
45
58
25
33
null
null
olsner/ghc
libraries/base/Data/Bitraversable.hs
bsd-3-clause
-- | Sequences all the actions in a structure, building a new structure with -- the same shape using the results of the actions. For a version that ignores -- the results, see 'bisequence_'. -- -- @'bisequence' ≡ 'bitraverse' 'id' 'id'@ -- -- @since 4.10.0.0 bisequence :: (Bitraversable t, Applicative f) => t (f a) (f b) -> f (t a b) bisequence = bitraverse id id
365
bisequence :: (Bitraversable t, Applicative f) => t (f a) (f b) -> f (t a b) bisequence = bitraverse id id
106
bisequence = bitraverse id id
29
true
true
0
10
66
77
39
38
null
null
iconnect/aws-sign4
Aws/Sign4.hs
bsd-3-clause
s4_hmac' :: B.ByteString -> B.ByteString -> B.ByteString s4_hmac' = flip s4_hmac
80
s4_hmac' :: B.ByteString -> B.ByteString -> B.ByteString s4_hmac' = flip s4_hmac
80
s4_hmac' = flip s4_hmac
23
false
true
0
9
10
35
15
20
null
null
HJvT/com
System/Win32/Com/Automation.hs
bsd-3-clause
function6 :: Member -> [VarIn] -> ArgOut a1 -> ArgOut a2 -> ArgOut a3 -> ArgOut a4 -> ArgOut a5 -> ArgOut a6 -> IDispatch i -> IO (a1,a2,a3,a4,a5,a6) function6 member args argout1 argout2 argout3 argout4 argout5 argout6 obj = do dispid <- obj # getMemberID member catchMethError member $ functionID6 dispid args argout1 argout2 argout3 argout4 argout5 argout6 obj
447
function6 :: Member -> [VarIn] -> ArgOut a1 -> ArgOut a2 -> ArgOut a3 -> ArgOut a4 -> ArgOut a5 -> ArgOut a6 -> IDispatch i -> IO (a1,a2,a3,a4,a5,a6) function6 member args argout1 argout2 argout3 argout4 argout5 argout6 obj = do dispid <- obj # getMemberID member catchMethError member $ functionID6 dispid args argout1 argout2 argout3 argout4 argout5 argout6 obj
447
function6 member args argout1 argout2 argout3 argout4 argout5 argout6 obj = do dispid <- obj # getMemberID member catchMethError member $ functionID6 dispid args argout1 argout2 argout3 argout4 argout5 argout6 obj
247
false
true
0
15
143
154
74
80
null
null