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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
semaj/hademlia
|
test/RoutingDataSpec.hs
|
bsd-3-clause
|
defghi = [nodeD, nodeE, nodeF, nodeG, nodeH, nodeI]
| 51
|
defghi = [nodeD, nodeE, nodeF, nodeG, nodeH, nodeI]
| 51
|
defghi = [nodeD, nodeE, nodeF, nodeG, nodeH, nodeI]
| 51
| false
| false
| 0
| 5
| 7
| 24
| 15
| 9
| null | null |
dillonhuff/FCalc
|
test/ExprTests.hs
|
bsd-3-clause
|
toRPNCases =
[(num 12, [push 12]),
(add (num 3) (Expr.div (num (-12)) (num 4)), [push 3, push (-12), push 4, op "/", op "+"])]
| 131
|
toRPNCases =
[(num 12, [push 12]),
(add (num 3) (Expr.div (num (-12)) (num 4)), [push 3, push (-12), push 4, op "/", op "+"])]
| 131
|
toRPNCases =
[(num 12, [push 12]),
(add (num 3) (Expr.div (num (-12)) (num 4)), [push 3, push (-12), push 4, op "/", op "+"])]
| 131
| false
| false
| 1
| 14
| 28
| 110
| 56
| 54
| null | null |
kmilner/tamarin-prover
|
lib/theory/src/Theory/Constraint/System.hs
|
gpl-3.0
|
getMirrorDG :: DiffProofContext -> Side -> System -> [System]
getMirrorDG ctxt side sys = {-trace (show (evalFreshAvoiding newNodes (freshAndPubConstrRules, sys))) $-} fmap (normDG $ eitherProofContext ctxt side) $ unifyInstances $ evalFreshAvoiding newNodes (freshAndPubConstrRules, sys)
where
(freshAndPubConstrRules, notFreshNorPub) = (M.partition (\rule -> (isFreshRule rule) || (isPubConstrRule rule)) (L.get sNodes sys))
(newProtoRules, otherRules) = (M.partition (\rule -> (containsNewVars rule) && (isProtocolRule rule)) notFreshNorPub)
newNodes = (M.foldrWithKey (transformRuleInstance) (M.foldrWithKey (transformRuleInstance) (return [freshAndPubConstrRules]) newProtoRules) otherRules)
-- We keep instantiations of fresh and public variables. Currently new public variables in protocol rule instances
-- are instantiated correctly in someRuleACInstAvoiding, but if this is changed we need to fix this part.
transformRuleInstance :: MonadFresh m => NodeId -> RuleACInst -> m ([M.Map NodeId RuleACInst]) -> m ([M.Map NodeId RuleACInst])
transformRuleInstance idx rule nodes = genNodeMapsForAllRuleVariants <$> nodes <*> (getOtherRulesAndVariants rule)
where
genNodeMapsForAllRuleVariants :: [M.Map NodeId RuleACInst] -> [RuleACInst] -> [M.Map NodeId RuleACInst]
genNodeMapsForAllRuleVariants nodes' rules = (\x y -> M.insert idx y x) <$> nodes' <*> rules
getOtherRulesAndVariants :: MonadFresh m => RuleACInst -> m ([RuleACInst])
getOtherRulesAndVariants r = mapGetVariants r (getOppositeRules ctxt side r)
where
mapGetVariants :: MonadFresh m => RuleACInst -> [RuleAC] -> m ([RuleACInst])
mapGetVariants _ [] = return []
mapGetVariants o (x:xs) = do
instances <- someRuleACInst x
variants <- getVariants instances
rest <- mapGetVariants o xs
if isProtocolRule r
then return ((mapMaybe (\ru -> ((flip apply) ru) <$> (getSubstitutionsFixingNewVars o ru)) variants) ++ rest)
else return (variants++rest)
getVariants :: MonadFresh m => (RuleACInst, Maybe RuleACConstrs) -> m ([RuleACInst])
getVariants (r, Nothing) = return [r]
getVariants (r, Just (Disj v)) = appSubst v
where
appSubst :: MonadFresh m => [LNSubstVFresh] -> m ([RuleACInst])
appSubst [] = return []
appSubst (x:xs) = do
subst <- freshToFree x
inst <- rename (apply subst r)
rest <- appSubst xs
return (inst:rest)
unifyInstances :: [M.Map NodeId RuleACInst] -> [System]
unifyInstances newrules =
foldl jumpNotUnifiable [] newrules
where
jumpNotUnifiable ret x = if (null foundUnifiers)
then ret
else (L.set sNodes (foldl (\y z -> apply z y) x (freeUnifiers x)) sys):ret
where
(foundUnifiers, constSubsts) = unifiers $ equalities True x
finalSubst :: [LNSubst] -> [LNSubst]
finalSubst subst = map replaceConstants subst
where
replaceConstants :: LNSubst -> LNSubst
replaceConstants s = mapRange applyInverseSubst s
where
applyInverseSubst :: LNTerm -> LNTerm
applyInverseSubst t = case viewTerm t of
(Lit _) | t `M.member` inversSubst -> varTerm $ inversSubst M.! t
| otherwise -> t
(FApp s' ts) -> fApp s' $ map applyInverseSubst ts
inversSubst = M.fromList $ map swap constSubsts
freeUnifiers :: M.Map NodeId RuleACInst -> [LNSubst]
freeUnifiers newnodes = finalSubst $ map (\y -> freshToFreeAvoiding y (newnodes, sys)) foundUnifiers
unifiers :: (Maybe [(Equal LNFact, (LVar, LNTerm))],[Equal LNFact]) -> ([SubstVFresh Name LVar], [(LVar, LNTerm)])
unifiers (Nothing, _) = ([], [])
unifiers (Just equalfacts, equaledges) = (runReader (unifyLNFactEqs $ (map fst equalfacts) ++ equaledges) (getMaudeHandle ctxt side), map snd equalfacts)
equalities :: Bool -> M.Map NodeId RuleACInst -> (Maybe [(Equal LNFact, (LVar, LNTerm))],[Equal LNFact])
equalities fixNewPublicVars newrules = (getNewVarEqualities fixNewPublicVars newrules, (getGraphEqualities newrules) ++ (getKUGraphEqualities newrules))
getGraphEqualities :: M.Map NodeId RuleACInst -> [Equal LNFact]
getGraphEqualities nodes = map (\(Edge x y) -> Equal (nodePremFactMap y nodes) (nodeConcFactMap x nodes)) $ S.toList (L.get sEdges sys)
getKUGraphEqualities :: M.Map NodeId RuleACInst -> [Equal LNFact]
getKUGraphEqualities nodes = toEquality [] $ getEdgesFromLessRelation sys
where
toEquality _ [] = []
toEquality goals ((Left (Edge y x)):xs) = (Equal (nodePremFactMap x nodes) (nodeConcFactMap y nodes)):(toEquality goals xs)
toEquality goals ((Right (prem, nid)):xs) = eqs ++ (toEquality ((prem, nid):goals) xs)
where
eqs = map (\(x, _) -> (Equal (nodePremFactMap prem nodes) (nodePremFactMap x nodes))) $ filter (\(_, y) -> nid == y) goals
getNewVarEqualities :: Bool -> M.Map NodeId RuleACInst -> Maybe ([(Equal LNFact, (LVar, LNTerm))])
getNewVarEqualities fixNewPublicVars nodes = (++) <$> genTrivialEqualities <*> (Just (concat $ map (\(_, r) -> genEqualities $ map (\x -> (kuFact (varTerm x), x, x)) $ getNewVariables fixNewPublicVars r) $ M.toList nodes))
where
genEqualities :: [(LNFact, LVar, LVar)] -> [(Equal LNFact, (LVar, LNTerm))]
genEqualities = map (\(x, y, z) -> (Equal x (replaceNewVarWithConstant x y z), (y, constant y z)))
genTrivialEqualities :: Maybe ([(Equal LNFact, (LVar, LNTerm))])
genTrivialEqualities = genEqualities <$> getTrivialFacts nodes sys
replaceNewVarWithConstant :: LNFact -> LVar -> LVar -> LNFact
replaceNewVarWithConstant fact v cvar = apply subst fact
where
subst = Subst (M.fromList [(v, constant v cvar)])
constant :: LVar -> LVar -> LNTerm
constant v cvar = constTerm (Name (pubOrFresh v) (NameId ("constVar_" ++ toConstName cvar)))
where
toConstName (LVar name vsort idx) = (show vsort) ++ "_" ++ (show idx) ++ "_" ++ name
pubOrFresh (LVar _ LSortFresh _) = FreshName
pubOrFresh (LVar _ _ _) = PubName
-- | Returns the set of edges of a system saturated with all edges deducible from the nodes and the less relation
-- This does not cover edges to open goals.
| 6,986
|
getMirrorDG :: DiffProofContext -> Side -> System -> [System]
getMirrorDG ctxt side sys = {-trace (show (evalFreshAvoiding newNodes (freshAndPubConstrRules, sys))) $-} fmap (normDG $ eitherProofContext ctxt side) $ unifyInstances $ evalFreshAvoiding newNodes (freshAndPubConstrRules, sys)
where
(freshAndPubConstrRules, notFreshNorPub) = (M.partition (\rule -> (isFreshRule rule) || (isPubConstrRule rule)) (L.get sNodes sys))
(newProtoRules, otherRules) = (M.partition (\rule -> (containsNewVars rule) && (isProtocolRule rule)) notFreshNorPub)
newNodes = (M.foldrWithKey (transformRuleInstance) (M.foldrWithKey (transformRuleInstance) (return [freshAndPubConstrRules]) newProtoRules) otherRules)
-- We keep instantiations of fresh and public variables. Currently new public variables in protocol rule instances
-- are instantiated correctly in someRuleACInstAvoiding, but if this is changed we need to fix this part.
transformRuleInstance :: MonadFresh m => NodeId -> RuleACInst -> m ([M.Map NodeId RuleACInst]) -> m ([M.Map NodeId RuleACInst])
transformRuleInstance idx rule nodes = genNodeMapsForAllRuleVariants <$> nodes <*> (getOtherRulesAndVariants rule)
where
genNodeMapsForAllRuleVariants :: [M.Map NodeId RuleACInst] -> [RuleACInst] -> [M.Map NodeId RuleACInst]
genNodeMapsForAllRuleVariants nodes' rules = (\x y -> M.insert idx y x) <$> nodes' <*> rules
getOtherRulesAndVariants :: MonadFresh m => RuleACInst -> m ([RuleACInst])
getOtherRulesAndVariants r = mapGetVariants r (getOppositeRules ctxt side r)
where
mapGetVariants :: MonadFresh m => RuleACInst -> [RuleAC] -> m ([RuleACInst])
mapGetVariants _ [] = return []
mapGetVariants o (x:xs) = do
instances <- someRuleACInst x
variants <- getVariants instances
rest <- mapGetVariants o xs
if isProtocolRule r
then return ((mapMaybe (\ru -> ((flip apply) ru) <$> (getSubstitutionsFixingNewVars o ru)) variants) ++ rest)
else return (variants++rest)
getVariants :: MonadFresh m => (RuleACInst, Maybe RuleACConstrs) -> m ([RuleACInst])
getVariants (r, Nothing) = return [r]
getVariants (r, Just (Disj v)) = appSubst v
where
appSubst :: MonadFresh m => [LNSubstVFresh] -> m ([RuleACInst])
appSubst [] = return []
appSubst (x:xs) = do
subst <- freshToFree x
inst <- rename (apply subst r)
rest <- appSubst xs
return (inst:rest)
unifyInstances :: [M.Map NodeId RuleACInst] -> [System]
unifyInstances newrules =
foldl jumpNotUnifiable [] newrules
where
jumpNotUnifiable ret x = if (null foundUnifiers)
then ret
else (L.set sNodes (foldl (\y z -> apply z y) x (freeUnifiers x)) sys):ret
where
(foundUnifiers, constSubsts) = unifiers $ equalities True x
finalSubst :: [LNSubst] -> [LNSubst]
finalSubst subst = map replaceConstants subst
where
replaceConstants :: LNSubst -> LNSubst
replaceConstants s = mapRange applyInverseSubst s
where
applyInverseSubst :: LNTerm -> LNTerm
applyInverseSubst t = case viewTerm t of
(Lit _) | t `M.member` inversSubst -> varTerm $ inversSubst M.! t
| otherwise -> t
(FApp s' ts) -> fApp s' $ map applyInverseSubst ts
inversSubst = M.fromList $ map swap constSubsts
freeUnifiers :: M.Map NodeId RuleACInst -> [LNSubst]
freeUnifiers newnodes = finalSubst $ map (\y -> freshToFreeAvoiding y (newnodes, sys)) foundUnifiers
unifiers :: (Maybe [(Equal LNFact, (LVar, LNTerm))],[Equal LNFact]) -> ([SubstVFresh Name LVar], [(LVar, LNTerm)])
unifiers (Nothing, _) = ([], [])
unifiers (Just equalfacts, equaledges) = (runReader (unifyLNFactEqs $ (map fst equalfacts) ++ equaledges) (getMaudeHandle ctxt side), map snd equalfacts)
equalities :: Bool -> M.Map NodeId RuleACInst -> (Maybe [(Equal LNFact, (LVar, LNTerm))],[Equal LNFact])
equalities fixNewPublicVars newrules = (getNewVarEqualities fixNewPublicVars newrules, (getGraphEqualities newrules) ++ (getKUGraphEqualities newrules))
getGraphEqualities :: M.Map NodeId RuleACInst -> [Equal LNFact]
getGraphEqualities nodes = map (\(Edge x y) -> Equal (nodePremFactMap y nodes) (nodeConcFactMap x nodes)) $ S.toList (L.get sEdges sys)
getKUGraphEqualities :: M.Map NodeId RuleACInst -> [Equal LNFact]
getKUGraphEqualities nodes = toEquality [] $ getEdgesFromLessRelation sys
where
toEquality _ [] = []
toEquality goals ((Left (Edge y x)):xs) = (Equal (nodePremFactMap x nodes) (nodeConcFactMap y nodes)):(toEquality goals xs)
toEquality goals ((Right (prem, nid)):xs) = eqs ++ (toEquality ((prem, nid):goals) xs)
where
eqs = map (\(x, _) -> (Equal (nodePremFactMap prem nodes) (nodePremFactMap x nodes))) $ filter (\(_, y) -> nid == y) goals
getNewVarEqualities :: Bool -> M.Map NodeId RuleACInst -> Maybe ([(Equal LNFact, (LVar, LNTerm))])
getNewVarEqualities fixNewPublicVars nodes = (++) <$> genTrivialEqualities <*> (Just (concat $ map (\(_, r) -> genEqualities $ map (\x -> (kuFact (varTerm x), x, x)) $ getNewVariables fixNewPublicVars r) $ M.toList nodes))
where
genEqualities :: [(LNFact, LVar, LVar)] -> [(Equal LNFact, (LVar, LNTerm))]
genEqualities = map (\(x, y, z) -> (Equal x (replaceNewVarWithConstant x y z), (y, constant y z)))
genTrivialEqualities :: Maybe ([(Equal LNFact, (LVar, LNTerm))])
genTrivialEqualities = genEqualities <$> getTrivialFacts nodes sys
replaceNewVarWithConstant :: LNFact -> LVar -> LVar -> LNFact
replaceNewVarWithConstant fact v cvar = apply subst fact
where
subst = Subst (M.fromList [(v, constant v cvar)])
constant :: LVar -> LVar -> LNTerm
constant v cvar = constTerm (Name (pubOrFresh v) (NameId ("constVar_" ++ toConstName cvar)))
where
toConstName (LVar name vsort idx) = (show vsort) ++ "_" ++ (show idx) ++ "_" ++ name
pubOrFresh (LVar _ LSortFresh _) = FreshName
pubOrFresh (LVar _ _ _) = PubName
-- | Returns the set of edges of a system saturated with all edges deducible from the nodes and the less relation
-- This does not cover edges to open goals.
| 6,986
|
getMirrorDG ctxt side sys = {-trace (show (evalFreshAvoiding newNodes (freshAndPubConstrRules, sys))) $-} fmap (normDG $ eitherProofContext ctxt side) $ unifyInstances $ evalFreshAvoiding newNodes (freshAndPubConstrRules, sys)
where
(freshAndPubConstrRules, notFreshNorPub) = (M.partition (\rule -> (isFreshRule rule) || (isPubConstrRule rule)) (L.get sNodes sys))
(newProtoRules, otherRules) = (M.partition (\rule -> (containsNewVars rule) && (isProtocolRule rule)) notFreshNorPub)
newNodes = (M.foldrWithKey (transformRuleInstance) (M.foldrWithKey (transformRuleInstance) (return [freshAndPubConstrRules]) newProtoRules) otherRules)
-- We keep instantiations of fresh and public variables. Currently new public variables in protocol rule instances
-- are instantiated correctly in someRuleACInstAvoiding, but if this is changed we need to fix this part.
transformRuleInstance :: MonadFresh m => NodeId -> RuleACInst -> m ([M.Map NodeId RuleACInst]) -> m ([M.Map NodeId RuleACInst])
transformRuleInstance idx rule nodes = genNodeMapsForAllRuleVariants <$> nodes <*> (getOtherRulesAndVariants rule)
where
genNodeMapsForAllRuleVariants :: [M.Map NodeId RuleACInst] -> [RuleACInst] -> [M.Map NodeId RuleACInst]
genNodeMapsForAllRuleVariants nodes' rules = (\x y -> M.insert idx y x) <$> nodes' <*> rules
getOtherRulesAndVariants :: MonadFresh m => RuleACInst -> m ([RuleACInst])
getOtherRulesAndVariants r = mapGetVariants r (getOppositeRules ctxt side r)
where
mapGetVariants :: MonadFresh m => RuleACInst -> [RuleAC] -> m ([RuleACInst])
mapGetVariants _ [] = return []
mapGetVariants o (x:xs) = do
instances <- someRuleACInst x
variants <- getVariants instances
rest <- mapGetVariants o xs
if isProtocolRule r
then return ((mapMaybe (\ru -> ((flip apply) ru) <$> (getSubstitutionsFixingNewVars o ru)) variants) ++ rest)
else return (variants++rest)
getVariants :: MonadFresh m => (RuleACInst, Maybe RuleACConstrs) -> m ([RuleACInst])
getVariants (r, Nothing) = return [r]
getVariants (r, Just (Disj v)) = appSubst v
where
appSubst :: MonadFresh m => [LNSubstVFresh] -> m ([RuleACInst])
appSubst [] = return []
appSubst (x:xs) = do
subst <- freshToFree x
inst <- rename (apply subst r)
rest <- appSubst xs
return (inst:rest)
unifyInstances :: [M.Map NodeId RuleACInst] -> [System]
unifyInstances newrules =
foldl jumpNotUnifiable [] newrules
where
jumpNotUnifiable ret x = if (null foundUnifiers)
then ret
else (L.set sNodes (foldl (\y z -> apply z y) x (freeUnifiers x)) sys):ret
where
(foundUnifiers, constSubsts) = unifiers $ equalities True x
finalSubst :: [LNSubst] -> [LNSubst]
finalSubst subst = map replaceConstants subst
where
replaceConstants :: LNSubst -> LNSubst
replaceConstants s = mapRange applyInverseSubst s
where
applyInverseSubst :: LNTerm -> LNTerm
applyInverseSubst t = case viewTerm t of
(Lit _) | t `M.member` inversSubst -> varTerm $ inversSubst M.! t
| otherwise -> t
(FApp s' ts) -> fApp s' $ map applyInverseSubst ts
inversSubst = M.fromList $ map swap constSubsts
freeUnifiers :: M.Map NodeId RuleACInst -> [LNSubst]
freeUnifiers newnodes = finalSubst $ map (\y -> freshToFreeAvoiding y (newnodes, sys)) foundUnifiers
unifiers :: (Maybe [(Equal LNFact, (LVar, LNTerm))],[Equal LNFact]) -> ([SubstVFresh Name LVar], [(LVar, LNTerm)])
unifiers (Nothing, _) = ([], [])
unifiers (Just equalfacts, equaledges) = (runReader (unifyLNFactEqs $ (map fst equalfacts) ++ equaledges) (getMaudeHandle ctxt side), map snd equalfacts)
equalities :: Bool -> M.Map NodeId RuleACInst -> (Maybe [(Equal LNFact, (LVar, LNTerm))],[Equal LNFact])
equalities fixNewPublicVars newrules = (getNewVarEqualities fixNewPublicVars newrules, (getGraphEqualities newrules) ++ (getKUGraphEqualities newrules))
getGraphEqualities :: M.Map NodeId RuleACInst -> [Equal LNFact]
getGraphEqualities nodes = map (\(Edge x y) -> Equal (nodePremFactMap y nodes) (nodeConcFactMap x nodes)) $ S.toList (L.get sEdges sys)
getKUGraphEqualities :: M.Map NodeId RuleACInst -> [Equal LNFact]
getKUGraphEqualities nodes = toEquality [] $ getEdgesFromLessRelation sys
where
toEquality _ [] = []
toEquality goals ((Left (Edge y x)):xs) = (Equal (nodePremFactMap x nodes) (nodeConcFactMap y nodes)):(toEquality goals xs)
toEquality goals ((Right (prem, nid)):xs) = eqs ++ (toEquality ((prem, nid):goals) xs)
where
eqs = map (\(x, _) -> (Equal (nodePremFactMap prem nodes) (nodePremFactMap x nodes))) $ filter (\(_, y) -> nid == y) goals
getNewVarEqualities :: Bool -> M.Map NodeId RuleACInst -> Maybe ([(Equal LNFact, (LVar, LNTerm))])
getNewVarEqualities fixNewPublicVars nodes = (++) <$> genTrivialEqualities <*> (Just (concat $ map (\(_, r) -> genEqualities $ map (\x -> (kuFact (varTerm x), x, x)) $ getNewVariables fixNewPublicVars r) $ M.toList nodes))
where
genEqualities :: [(LNFact, LVar, LVar)] -> [(Equal LNFact, (LVar, LNTerm))]
genEqualities = map (\(x, y, z) -> (Equal x (replaceNewVarWithConstant x y z), (y, constant y z)))
genTrivialEqualities :: Maybe ([(Equal LNFact, (LVar, LNTerm))])
genTrivialEqualities = genEqualities <$> getTrivialFacts nodes sys
replaceNewVarWithConstant :: LNFact -> LVar -> LVar -> LNFact
replaceNewVarWithConstant fact v cvar = apply subst fact
where
subst = Subst (M.fromList [(v, constant v cvar)])
constant :: LVar -> LVar -> LNTerm
constant v cvar = constTerm (Name (pubOrFresh v) (NameId ("constVar_" ++ toConstName cvar)))
where
toConstName (LVar name vsort idx) = (show vsort) ++ "_" ++ (show idx) ++ "_" ++ name
pubOrFresh (LVar _ LSortFresh _) = FreshName
pubOrFresh (LVar _ _ _) = PubName
-- | Returns the set of edges of a system saturated with all edges deducible from the nodes and the less relation
-- This does not cover edges to open goals.
| 6,924
| false
| true
| 4
| 22
| 2,040
| 2,317
| 1,171
| 1,146
| null | null |
stevezhee/pec
|
Language/Pds/Abs.hs
|
bsd-3-clause
|
ppCountD x = case x of
CountD v1 -> text "count" <+> ppNumber v1
| 67
|
ppCountD x = case x of
CountD v1 -> text "count" <+> ppNumber v1
| 67
|
ppCountD x = case x of
CountD v1 -> text "count" <+> ppNumber v1
| 67
| false
| false
| 1
| 9
| 16
| 35
| 14
| 21
| null | null |
elbrujohalcon/hPage
|
src/HPage/Control.hs
|
bsd-3-clause
|
setPageText :: String -> Int -> HPage Bool
setPageText s ip =
do
let (exprs, ix) = exprFromString' s ip
page <- getPage
if exprs /= expressions page || ix /= currentExpr page
then
do
modifyWithUndo (\p -> p{expressions = exprs,
currentExpr = ix})
return True
else
return False
| 445
|
setPageText :: String -> Int -> HPage Bool
setPageText s ip =
do
let (exprs, ix) = exprFromString' s ip
page <- getPage
if exprs /= expressions page || ix /= currentExpr page
then
do
modifyWithUndo (\p -> p{expressions = exprs,
currentExpr = ix})
return True
else
return False
| 445
|
setPageText s ip =
do
let (exprs, ix) = exprFromString' s ip
page <- getPage
if exprs /= expressions page || ix /= currentExpr page
then
do
modifyWithUndo (\p -> p{expressions = exprs,
currentExpr = ix})
return True
else
return False
| 402
| false
| true
| 1
| 12
| 217
| 122
| 59
| 63
| null | null |
snoyberg/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
repTyConName = tcQual gHC_GENERICS (fsLit "Rep") repTyConKey
| 62
|
repTyConName = tcQual gHC_GENERICS (fsLit "Rep") repTyConKey
| 62
|
repTyConName = tcQual gHC_GENERICS (fsLit "Rep") repTyConKey
| 62
| false
| false
| 0
| 7
| 8
| 19
| 9
| 10
| null | null |
ciderpunx/project_euler_in_haskell
|
euler005.hs
|
gpl-2.0
|
-- 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without
-- any remainder.
-- What is the smallest positive number that is evenly divisible by all of the numbers from 1
-- to 20?
-- lcm is what we need for this
listLCM xs = foldr (lcm) 2 xs
| 283
|
listLCM xs = foldr (lcm) 2 xs
| 30
|
listLCM xs = foldr (lcm) 2 xs
| 30
| true
| false
| 1
| 5
| 63
| 30
| 14
| 16
| null | null |
stevejb71/Idris-dev
|
src/IRTS/CodegenJavaScript.hs
|
bsd-3-clause
|
translateConstant StrType = JSType JSStringTy
| 62
|
translateConstant StrType = JSType JSStringTy
| 62
|
translateConstant StrType = JSType JSStringTy
| 62
| false
| false
| 0
| 5
| 21
| 13
| 5
| 8
| null | null |
grnet/snf-ganeti
|
src/Ganeti/HTools/Backend/Luxi.hs
|
bsd-2-clause
|
-- | Parses a given group information.
parseGroup :: [(JSValue, JSValue)] -> Result (String, Group.Group)
parseGroup [uuid, name, apol, ipol, tags] = do
xname <- annotateResult "Parsing new group" (fromJValWithStatus name)
let convert a = genericConvert "Group" xname a
xuuid <- convert "uuid" uuid
xapol <- convert "alloc_policy" apol
xipol <- convert "ipolicy" ipol
xtags <- convert "tags" tags
-- TODO: parse networks to which this group is connected
return (xuuid, Group.create xname xuuid xapol [] xipol xtags)
| 531
|
parseGroup :: [(JSValue, JSValue)] -> Result (String, Group.Group)
parseGroup [uuid, name, apol, ipol, tags] = do
xname <- annotateResult "Parsing new group" (fromJValWithStatus name)
let convert a = genericConvert "Group" xname a
xuuid <- convert "uuid" uuid
xapol <- convert "alloc_policy" apol
xipol <- convert "ipolicy" ipol
xtags <- convert "tags" tags
-- TODO: parse networks to which this group is connected
return (xuuid, Group.create xname xuuid xapol [] xipol xtags)
| 492
|
parseGroup [uuid, name, apol, ipol, tags] = do
xname <- annotateResult "Parsing new group" (fromJValWithStatus name)
let convert a = genericConvert "Group" xname a
xuuid <- convert "uuid" uuid
xapol <- convert "alloc_policy" apol
xipol <- convert "ipolicy" ipol
xtags <- convert "tags" tags
-- TODO: parse networks to which this group is connected
return (xuuid, Group.create xname xuuid xapol [] xipol xtags)
| 425
| true
| true
| 0
| 10
| 93
| 169
| 83
| 86
| null | null |
IreneKnapp/Faction
|
faction/Distribution/Client/PackageIndex.hs
|
bsd-3-clause
|
dependencyGraph :: PackageFixedDeps pkg
=> PackageIndex pkg
-> (Graph.Graph,
Graph.Vertex -> pkg,
PackageIdentifier -> Maybe Graph.Vertex)
dependencyGraph index = (graph, vertexToPkg, pkgIdToVertex)
where
graph = Array.listArray bounds
[ [ v | Just v <- map pkgIdToVertex (depends pkg) ]
| pkg <- pkgs ]
vertexToPkg vertex = pkgTable ! vertex
pkgIdToVertex = binarySearch 0 topBound
pkgTable = Array.listArray bounds pkgs
pkgIdTable = Array.listArray bounds (map packageId pkgs)
pkgs = sortBy (comparing packageId) (allPackages index)
topBound = length pkgs - 1
bounds = (0, topBound)
binarySearch a b key
| a > b = Nothing
| otherwise = case compare key (pkgIdTable ! mid) of
LT -> binarySearch a (mid-1) key
EQ -> Just mid
GT -> binarySearch (mid+1) b key
where mid = (a + b) `div` 2
| 979
|
dependencyGraph :: PackageFixedDeps pkg
=> PackageIndex pkg
-> (Graph.Graph,
Graph.Vertex -> pkg,
PackageIdentifier -> Maybe Graph.Vertex)
dependencyGraph index = (graph, vertexToPkg, pkgIdToVertex)
where
graph = Array.listArray bounds
[ [ v | Just v <- map pkgIdToVertex (depends pkg) ]
| pkg <- pkgs ]
vertexToPkg vertex = pkgTable ! vertex
pkgIdToVertex = binarySearch 0 topBound
pkgTable = Array.listArray bounds pkgs
pkgIdTable = Array.listArray bounds (map packageId pkgs)
pkgs = sortBy (comparing packageId) (allPackages index)
topBound = length pkgs - 1
bounds = (0, topBound)
binarySearch a b key
| a > b = Nothing
| otherwise = case compare key (pkgIdTable ! mid) of
LT -> binarySearch a (mid-1) key
EQ -> Just mid
GT -> binarySearch (mid+1) b key
where mid = (a + b) `div` 2
| 979
|
dependencyGraph index = (graph, vertexToPkg, pkgIdToVertex)
where
graph = Array.listArray bounds
[ [ v | Just v <- map pkgIdToVertex (depends pkg) ]
| pkg <- pkgs ]
vertexToPkg vertex = pkgTable ! vertex
pkgIdToVertex = binarySearch 0 topBound
pkgTable = Array.listArray bounds pkgs
pkgIdTable = Array.listArray bounds (map packageId pkgs)
pkgs = sortBy (comparing packageId) (allPackages index)
topBound = length pkgs - 1
bounds = (0, topBound)
binarySearch a b key
| a > b = Nothing
| otherwise = case compare key (pkgIdTable ! mid) of
LT -> binarySearch a (mid-1) key
EQ -> Just mid
GT -> binarySearch (mid+1) b key
where mid = (a + b) `div` 2
| 768
| false
| true
| 1
| 12
| 321
| 329
| 167
| 162
| null | null |
jkozlowski/better-bot
|
src/Network/Better/Aeson.hs
|
mit
|
decapitalizeJsonOptions
= defaultOptions { fieldLabelModifier = decapitalize . removePrefix }
| 95
|
decapitalizeJsonOptions
= defaultOptions { fieldLabelModifier = decapitalize . removePrefix }
| 95
|
decapitalizeJsonOptions
= defaultOptions { fieldLabelModifier = decapitalize . removePrefix }
| 95
| false
| false
| 1
| 8
| 11
| 22
| 10
| 12
| null | null |
alexander-at-github/eta
|
compiler/ETA/Utils/Encoding.hs
|
bsd-3-clause
|
utf8PrevChar :: Ptr Word8 -> IO (Ptr Word8)
utf8PrevChar p = utf8CharStart (p `plusPtr` (-1))
| 93
|
utf8PrevChar :: Ptr Word8 -> IO (Ptr Word8)
utf8PrevChar p = utf8CharStart (p `plusPtr` (-1))
| 93
|
utf8PrevChar p = utf8CharStart (p `plusPtr` (-1))
| 49
| false
| true
| 0
| 9
| 14
| 47
| 24
| 23
| null | null |
feuerbach/bert
|
src/Data/BERT/Term.hs
|
bsd-3-clause
|
showTerm (BigintTerm x) = show x
| 32
|
showTerm (BigintTerm x) = show x
| 32
|
showTerm (BigintTerm x) = show x
| 32
| false
| false
| 0
| 7
| 5
| 18
| 8
| 10
| null | null |
ghc/packages-filepath
|
System/FilePath/Internal.hs
|
bsd-3-clause
|
-- | Get the file name.
--
-- > takeFileName "/directory/file.ext" == "file.ext"
-- > takeFileName "test/" == ""
-- > takeFileName x `isSuffixOf` x
-- > takeFileName x == snd (splitFileName x)
-- > Valid x => takeFileName (replaceFileName x "fred") == "fred"
-- > Valid x => takeFileName (x </> "fred") == "fred"
-- > Valid x => isRelative (takeFileName x)
takeFileName :: FilePath -> FilePath
takeFileName = snd . splitFileName
| 428
|
takeFileName :: FilePath -> FilePath
takeFileName = snd . splitFileName
| 71
|
takeFileName = snd . splitFileName
| 34
| true
| true
| 0
| 5
| 72
| 28
| 19
| 9
| null | null |
xanxys/mmterm
|
Main.hs
|
bsd-3-clause
|
handleConn ch h parse_cont = BS.hGet h 1024 >>= resolveFull parse_cont
where
resolveFull parse_cont x = do
case parse_cont x of
Fail _ ctx err -> putStrLn "wrong packet"
Partial f -> handleConn ch h f
Done rest packet -> do
case translateMessage packet of
Nothing -> return () -- ignore
Just msg -> writeChan ch msg
resolveFull (Atto.parse MP.get) rest
| 512
|
handleConn ch h parse_cont = BS.hGet h 1024 >>= resolveFull parse_cont
where
resolveFull parse_cont x = do
case parse_cont x of
Fail _ ctx err -> putStrLn "wrong packet"
Partial f -> handleConn ch h f
Done rest packet -> do
case translateMessage packet of
Nothing -> return () -- ignore
Just msg -> writeChan ch msg
resolveFull (Atto.parse MP.get) rest
| 512
|
handleConn ch h parse_cont = BS.hGet h 1024 >>= resolveFull parse_cont
where
resolveFull parse_cont x = do
case parse_cont x of
Fail _ ctx err -> putStrLn "wrong packet"
Partial f -> handleConn ch h f
Done rest packet -> do
case translateMessage packet of
Nothing -> return () -- ignore
Just msg -> writeChan ch msg
resolveFull (Atto.parse MP.get) rest
| 512
| false
| false
| 0
| 16
| 220
| 147
| 65
| 82
| null | null |
rfranek/duckling
|
Duckling/Dimensions/AR.hs
|
bsd-3-clause
|
allDimensions :: [Some Dimension]
allDimensions =
[ This Numeral
, This Ordinal
]
| 87
|
allDimensions :: [Some Dimension]
allDimensions =
[ This Numeral
, This Ordinal
]
| 87
|
allDimensions =
[ This Numeral
, This Ordinal
]
| 53
| false
| true
| 0
| 6
| 18
| 29
| 15
| 14
| null | null |
trskop/skeletos
|
src/Main.hs
|
bsd-3-clause
|
defineOption :: Parser [E OptionsConfig]
defineOption = many . option define $ mconcat
[ short 'D'
, metavar "VARIABLE[=[TYPE:]VALUE]"
, help "Define a variable with optional (typed) value."
]
where
define = addDefine <$> eitherReader parseDefine
addDefine d = variableDefines %~ (d :)
| 311
|
defineOption :: Parser [E OptionsConfig]
defineOption = many . option define $ mconcat
[ short 'D'
, metavar "VARIABLE[=[TYPE:]VALUE]"
, help "Define a variable with optional (typed) value."
]
where
define = addDefine <$> eitherReader parseDefine
addDefine d = variableDefines %~ (d :)
| 311
|
defineOption = many . option define $ mconcat
[ short 'D'
, metavar "VARIABLE[=[TYPE:]VALUE]"
, help "Define a variable with optional (typed) value."
]
where
define = addDefine <$> eitherReader parseDefine
addDefine d = variableDefines %~ (d :)
| 270
| false
| true
| 0
| 7
| 68
| 83
| 41
| 42
| null | null |
nickspinale/htorrent
|
src/HTorrent/State.hs
|
mit
|
clump x (y, xs) = (y, x:xs)
| 27
|
clump x (y, xs) = (y, x:xs)
| 27
|
clump x (y, xs) = (y, x:xs)
| 27
| false
| false
| 0
| 6
| 6
| 27
| 15
| 12
| null | null |
olsner/ghc
|
compiler/basicTypes/Avail.hs
|
bsd-3-clause
|
availsToNameSetWithSelectors :: [AvailInfo] -> NameSet
availsToNameSetWithSelectors avails = foldr add emptyNameSet avails
where add avail set = extendNameSetList set (availNamesWithSelectors avail)
| 204
|
availsToNameSetWithSelectors :: [AvailInfo] -> NameSet
availsToNameSetWithSelectors avails = foldr add emptyNameSet avails
where add avail set = extendNameSetList set (availNamesWithSelectors avail)
| 204
|
availsToNameSetWithSelectors avails = foldr add emptyNameSet avails
where add avail set = extendNameSetList set (availNamesWithSelectors avail)
| 149
| false
| true
| 0
| 9
| 26
| 51
| 25
| 26
| null | null |
vikraman/ghc
|
compiler/main/ErrUtils.hs
|
bsd-3-clause
|
errorsFound :: DynFlags -> Messages -> Bool
errorsFound _dflags (_warns, errs) = not (isEmptyBag errs)
| 102
|
errorsFound :: DynFlags -> Messages -> Bool
errorsFound _dflags (_warns, errs) = not (isEmptyBag errs)
| 102
|
errorsFound _dflags (_warns, errs) = not (isEmptyBag errs)
| 58
| false
| true
| 0
| 9
| 14
| 44
| 21
| 23
| null | null |
ekr/tamarin-prover
|
lib/theory/src/Theory/Constraint/System/Dot.hs
|
gpl-3.0
|
dropEntailedOrdConstraints :: System -> System
dropEntailedOrdConstraints se =
modify sLessAtoms (S.filter (not . entailed)) se
where
edges = rawEdgeRel se
entailed (from, to) = to `S.member` D.reachableSet [from] edges
-- | Unsound compression of the sequent that drops fully connected learns and
-- knows nodes.
| 342
|
dropEntailedOrdConstraints :: System -> System
dropEntailedOrdConstraints se =
modify sLessAtoms (S.filter (not . entailed)) se
where
edges = rawEdgeRel se
entailed (from, to) = to `S.member` D.reachableSet [from] edges
-- | Unsound compression of the sequent that drops fully connected learns and
-- knows nodes.
| 342
|
dropEntailedOrdConstraints se =
modify sLessAtoms (S.filter (not . entailed)) se
where
edges = rawEdgeRel se
entailed (from, to) = to `S.member` D.reachableSet [from] edges
-- | Unsound compression of the sequent that drops fully connected learns and
-- knows nodes.
| 295
| false
| true
| 0
| 9
| 73
| 85
| 45
| 40
| null | null |
massysett/penny
|
penny/lib/Penny/BalanceCheck.hs
|
bsd-3-clause
|
-- | Checks the balance of a particular account.
checkAccount
:: Seq (Transaction a)
-> (Account, Seq (Day, Seq (Commodity, Pole, DecPositive)))
-> (Seq (Chunk Text), Bool)
checkAccount txns (tgtAcct, days) = (reports, cumulative)
where
reports = thisAcct <> join (fmap fst results)
thisAcct =
[ resultChunk cumulative
, Rainbow.chunk $ " in account " <> pack (show tgtAcct) <> "\n"
]
cumulative = all snd results
daysAndAmts = join . fmap (filterAccount tgtAcct) $ txns
results = fmap (checkDay daysAndAmts) days
-- | Checks the balance of a particular day, along with its
-- commodities, poles, and DecPositive.
| 660
|
checkAccount
:: Seq (Transaction a)
-> (Account, Seq (Day, Seq (Commodity, Pole, DecPositive)))
-> (Seq (Chunk Text), Bool)
checkAccount txns (tgtAcct, days) = (reports, cumulative)
where
reports = thisAcct <> join (fmap fst results)
thisAcct =
[ resultChunk cumulative
, Rainbow.chunk $ " in account " <> pack (show tgtAcct) <> "\n"
]
cumulative = all snd results
daysAndAmts = join . fmap (filterAccount tgtAcct) $ txns
results = fmap (checkDay daysAndAmts) days
-- | Checks the balance of a particular day, along with its
-- commodities, poles, and DecPositive.
| 611
|
checkAccount txns (tgtAcct, days) = (reports, cumulative)
where
reports = thisAcct <> join (fmap fst results)
thisAcct =
[ resultChunk cumulative
, Rainbow.chunk $ " in account " <> pack (show tgtAcct) <> "\n"
]
cumulative = all snd results
daysAndAmts = join . fmap (filterAccount tgtAcct) $ txns
results = fmap (checkDay daysAndAmts) days
-- | Checks the balance of a particular day, along with its
-- commodities, poles, and DecPositive.
| 481
| true
| true
| 0
| 12
| 145
| 203
| 106
| 97
| null | null |
timthelion/fenfire
|
Fenfire/RDF.hs
|
gpl-2.0
|
addNamespace :: String -> String -> Endo Graph
addNamespace prefix uri g =
g { graphNamespaces = Map.insert prefix uri $ graphNamespaces g }
| 144
|
addNamespace :: String -> String -> Endo Graph
addNamespace prefix uri g =
g { graphNamespaces = Map.insert prefix uri $ graphNamespaces g }
| 144
|
addNamespace prefix uri g =
g { graphNamespaces = Map.insert prefix uri $ graphNamespaces g }
| 97
| false
| true
| 0
| 10
| 27
| 59
| 27
| 32
| null | null |
DavidAlphaFox/darcs
|
src/Darcs/Patch/Depends.hs
|
gpl-2.0
|
splitOnTag :: (Patchy p, NameHack p) => PatchInfo -> PatchSet p wStart wX
-> Maybe ((PatchSet p :> RL (PatchInfoAnd p)) wStart wX)
-- If the tag we are looking for is the first Tagged tag of the patchset, just
-- separate out the patchset's patches.
splitOnTag t (PatchSet ps ts@(Tagged hp _ _ :<: _)) | info hp == t =
Just $ PatchSet NilRL ts :> ps
| 364
|
splitOnTag :: (Patchy p, NameHack p) => PatchInfo -> PatchSet p wStart wX
-> Maybe ((PatchSet p :> RL (PatchInfoAnd p)) wStart wX)
splitOnTag t (PatchSet ps ts@(Tagged hp _ _ :<: _)) | info hp == t =
Just $ PatchSet NilRL ts :> ps
| 245
|
splitOnTag t (PatchSet ps ts@(Tagged hp _ _ :<: _)) | info hp == t =
Just $ PatchSet NilRL ts :> ps
| 103
| true
| true
| 6
| 16
| 83
| 138
| 64
| 74
| null | null |
pparkkin/eta
|
compiler/ETA/Prelude/PrimOp.hs
|
bsd-3-clause
|
primOpCanFail WriteOffAddrOp_Float = True
| 41
|
primOpCanFail WriteOffAddrOp_Float = True
| 41
|
primOpCanFail WriteOffAddrOp_Float = True
| 41
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
nikivazou/hscolour
|
Language/Haskell/HsColour/HTML.hs
|
gpl-2.0
|
pre :: String -> String
pre = ("<pre>"++) . (++"</pre>")
| 56
|
pre :: String -> String
pre = ("<pre>"++) . (++"</pre>")
| 56
|
pre = ("<pre>"++) . (++"</pre>")
| 32
| false
| true
| 0
| 7
| 9
| 34
| 17
| 17
| null | null |
linusyang/barrelfish
|
tools/mackerel/Fields.hs
|
mit
|
--
-- Generate masks and shifts for isolating this field. These functions
-- are polymorphic so that they don't need to know how large the total
-- load unit is (32 bits? 8 bits?) etc.
--
extract_mask :: (Num a, Bits a) => Rec -> Integer -> a
extract_mask f sz =
foldl setBit 0 (enumFromTo (fromInteger $ offset f)
(fromInteger $ (offset f) + (size f) - 1))
| 395
|
extract_mask :: (Num a, Bits a) => Rec -> Integer -> a
extract_mask f sz =
foldl setBit 0 (enumFromTo (fromInteger $ offset f)
(fromInteger $ (offset f) + (size f) - 1))
| 206
|
extract_mask f sz =
foldl setBit 0 (enumFromTo (fromInteger $ offset f)
(fromInteger $ (offset f) + (size f) - 1))
| 151
| true
| true
| 0
| 13
| 106
| 97
| 51
| 46
| null | null |
josefs/sbv
|
SBVTestSuite/TestSuite/Basics/Index.hs
|
bsd-3-clause
|
tests :: TestTree
tests =
testGroup "Basics.Index"
(zipWith
mkTest
[f x | f <- [test1, test2, test3], x <- [0..13]]
[(0::Int)..])
| 153
|
tests :: TestTree
tests =
testGroup "Basics.Index"
(zipWith
mkTest
[f x | f <- [test1, test2, test3], x <- [0..13]]
[(0::Int)..])
| 153
|
tests =
testGroup "Basics.Index"
(zipWith
mkTest
[f x | f <- [test1, test2, test3], x <- [0..13]]
[(0::Int)..])
| 135
| false
| true
| 0
| 10
| 44
| 72
| 39
| 33
| null | null |
sboehler/haskell-valuation
|
src/AAPL/Leases.hs
|
bsd-3-clause
|
preTaxCostOfDebt :: Val
preTaxCostOfDebt _ = 0.0327
| 51
|
preTaxCostOfDebt :: Val
preTaxCostOfDebt _ = 0.0327
| 51
|
preTaxCostOfDebt _ = 0.0327
| 27
| false
| true
| 0
| 5
| 6
| 14
| 7
| 7
| null | null |
tmhedberg/hsenv
|
src/HsenvMonad.hs
|
bsd-3-clause
|
warning :: String -> Hsenv ()
warning str = do
text <- privateLog str
liftIO $ hPutStrLn stderr text
| 104
|
warning :: String -> Hsenv ()
warning str = do
text <- privateLog str
liftIO $ hPutStrLn stderr text
| 104
|
warning str = do
text <- privateLog str
liftIO $ hPutStrLn stderr text
| 74
| false
| true
| 0
| 8
| 22
| 45
| 20
| 25
| null | null |
Airtnp/Freshman_Simple_Haskell_Lib
|
Utils/calculator.hs
|
mit
|
-- repeat last operation
(~~) :: (Double -> Double) -> State Double (Double -> Double)
(~~) f = State $ \s -> (f, f s)
| 118
|
(~~) :: (Double -> Double) -> State Double (Double -> Double)
(~~) f = State $ \s -> (f, f s)
| 93
|
(~~) f = State $ \s -> (f, f s)
| 31
| true
| true
| 0
| 8
| 24
| 60
| 34
| 26
| null | null |
jdreaver/sum-type-boilerplate
|
library/SumTypes/TH.hs
|
mit
|
matchConstructor :: [(Type, Name)] -> (Type, Name) -> Q BothConstructors
matchConstructor targetConstructors (type', sourceConstructor) = do
targetConstructor <-
maybe
(fail $ "Can't find constructor in target type corresponding to " ++ nameBase sourceConstructor)
return
(lookup type' targetConstructors)
return $ BothConstructors type' sourceConstructor targetConstructor
-- | Utility type to hold the source and target constructors for a given type.
| 473
|
matchConstructor :: [(Type, Name)] -> (Type, Name) -> Q BothConstructors
matchConstructor targetConstructors (type', sourceConstructor) = do
targetConstructor <-
maybe
(fail $ "Can't find constructor in target type corresponding to " ++ nameBase sourceConstructor)
return
(lookup type' targetConstructors)
return $ BothConstructors type' sourceConstructor targetConstructor
-- | Utility type to hold the source and target constructors for a given type.
| 473
|
matchConstructor targetConstructors (type', sourceConstructor) = do
targetConstructor <-
maybe
(fail $ "Can't find constructor in target type corresponding to " ++ nameBase sourceConstructor)
return
(lookup type' targetConstructors)
return $ BothConstructors type' sourceConstructor targetConstructor
-- | Utility type to hold the source and target constructors for a given type.
| 400
| false
| true
| 0
| 11
| 78
| 99
| 51
| 48
| null | null |
spechub/Hets
|
HasCASL/Sublogic.hs
|
gpl-2.0
|
sl_Rawkind :: RawKind -> Sublogic
sl_Rawkind = sl_AnyKind (const bottom)
| 72
|
sl_Rawkind :: RawKind -> Sublogic
sl_Rawkind = sl_AnyKind (const bottom)
| 72
|
sl_Rawkind = sl_AnyKind (const bottom)
| 38
| false
| true
| 0
| 7
| 9
| 30
| 13
| 17
| null | null |
pepeiborra/muterm-framework
|
MuTerm/Framework/GraphViz.hs
|
bsd-3-clause
|
mkClusterNode c other = error ("mkClusterNode: " ++ show other)
| 63
|
mkClusterNode c other = error ("mkClusterNode: " ++ show other)
| 63
|
mkClusterNode c other = error ("mkClusterNode: " ++ show other)
| 63
| false
| false
| 1
| 8
| 9
| 29
| 11
| 18
| null | null |
jamesdarcy/Hastur
|
src/Hastur.hs
|
bsd-3-clause
|
showSeries :: IConnection conn => conn -> Int64 -> Var (ListDbMap) -> ListCtrl l -> IO ()
showSeries dbConn studyPk varMap wgSeriesList = do
wxcBeginBusyCursor
itemsDelete wgSeriesList
series <- searchSeries dbConn studyPk
let seriesPks = map seriesPk series
let seriesIdMap = Map.fromList (zip [0..] seriesPks) :: ListDbMap
varSet varMap seriesIdMap
mapM_ (showSingleSeries wgSeriesList) $ zip (Map.keys seriesIdMap) series
wxcEndBusyCursor
--
| 461
|
showSeries :: IConnection conn => conn -> Int64 -> Var (ListDbMap) -> ListCtrl l -> IO ()
showSeries dbConn studyPk varMap wgSeriesList = do
wxcBeginBusyCursor
itemsDelete wgSeriesList
series <- searchSeries dbConn studyPk
let seriesPks = map seriesPk series
let seriesIdMap = Map.fromList (zip [0..] seriesPks) :: ListDbMap
varSet varMap seriesIdMap
mapM_ (showSingleSeries wgSeriesList) $ zip (Map.keys seriesIdMap) series
wxcEndBusyCursor
--
| 461
|
showSeries dbConn studyPk varMap wgSeriesList = do
wxcBeginBusyCursor
itemsDelete wgSeriesList
series <- searchSeries dbConn studyPk
let seriesPks = map seriesPk series
let seriesIdMap = Map.fromList (zip [0..] seriesPks) :: ListDbMap
varSet varMap seriesIdMap
mapM_ (showSingleSeries wgSeriesList) $ zip (Map.keys seriesIdMap) series
wxcEndBusyCursor
--
| 371
| false
| true
| 0
| 13
| 76
| 166
| 74
| 92
| null | null |
rueshyna/gogol
|
gogol-analytics/gen/Network/Google/Analytics/Types/Product.hs
|
mpl-2.0
|
-- | Time this unsampled report was created.
uCreated :: Lens' UnSampledReport (Maybe UTCTime)
uCreated
= lens _uCreated (\ s a -> s{_uCreated = a}) .
mapping _DateTime
| 176
|
uCreated :: Lens' UnSampledReport (Maybe UTCTime)
uCreated
= lens _uCreated (\ s a -> s{_uCreated = a}) .
mapping _DateTime
| 131
|
uCreated
= lens _uCreated (\ s a -> s{_uCreated = a}) .
mapping _DateTime
| 81
| true
| true
| 0
| 10
| 35
| 55
| 28
| 27
| null | null |
michaelochurch/heat
|
Heat/RDD.hs
|
mit
|
(&&.) f g x = f x && g x
| 24
|
(&&.) f g x = f x && g x
| 24
|
(&&.) f g x = f x && g x
| 24
| false
| false
| 3
| 5
| 9
| 32
| 12
| 20
| null | null |
benekastah/tj
|
lib/TJ/Parser.hs
|
mit
|
commaSep1 = P.commaSep1 lexer
| 29
|
commaSep1 = P.commaSep1 lexer
| 29
|
commaSep1 = P.commaSep1 lexer
| 29
| false
| false
| 0
| 6
| 3
| 11
| 5
| 6
| null | null |
semka/gimme-models
|
src/GimmeModels/Lang/ObjectiveC/Types.hs
|
mit
|
typeAttrs :: BT.Type -> [PropAttribute]
typeAttrs _ = [Strong, Nonatomic]
| 73
|
typeAttrs :: BT.Type -> [PropAttribute]
typeAttrs _ = [Strong, Nonatomic]
| 73
|
typeAttrs _ = [Strong, Nonatomic]
| 33
| false
| true
| 0
| 8
| 9
| 35
| 17
| 18
| null | null |
pacak/hdevtools
|
src/Info.hs
|
mit
|
getSrcSpan _ = Nothing
| 22
|
getSrcSpan _ = Nothing
| 22
|
getSrcSpan _ = Nothing
| 22
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
kishoredbn/barrelfish
|
hake/HakeTypes.hs
|
mit
|
isPredependency (Abs rule _) = isPredependency rule
| 51
|
isPredependency (Abs rule _) = isPredependency rule
| 51
|
isPredependency (Abs rule _) = isPredependency rule
| 51
| false
| false
| 0
| 6
| 6
| 21
| 9
| 12
| null | null |
bhamrick/htwitch
|
Twitch/APIRequests.hs
|
mit
|
-- Channels
getChannel name = baseAPIRequest
{ path = "/channels/" ++ (B.urlEncode name)
, method = "GET"
}
| 113
|
getChannel name = baseAPIRequest
{ path = "/channels/" ++ (B.urlEncode name)
, method = "GET"
}
| 101
|
getChannel name = baseAPIRequest
{ path = "/channels/" ++ (B.urlEncode name)
, method = "GET"
}
| 101
| true
| false
| 0
| 11
| 23
| 40
| 21
| 19
| null | null |
DavidAlphaFox/ghc
|
libraries/Cabal/Cabal/Distribution/PackageDescription/Parse.hs
|
bsd-3-clause
|
--TODO: make this use section syntax
-- add equivalent for GenericPackageDescription
showPackageDescription :: PackageDescription -> String
showPackageDescription pkg = render $
ppPackage pkg
$$ ppCustomFields (customFieldsPD pkg)
$$ (case library pkg of
Nothing -> empty
Just lib -> ppLibrary lib)
$$ vcat [ space $$ ppExecutable exe | exe <- executables pkg ]
where
ppPackage = ppFields pkgDescrFieldDescrs
ppLibrary = ppFields libFieldDescrs
ppExecutable = ppFields executableFieldDescrs
| 538
|
showPackageDescription :: PackageDescription -> String
showPackageDescription pkg = render $
ppPackage pkg
$$ ppCustomFields (customFieldsPD pkg)
$$ (case library pkg of
Nothing -> empty
Just lib -> ppLibrary lib)
$$ vcat [ space $$ ppExecutable exe | exe <- executables pkg ]
where
ppPackage = ppFields pkgDescrFieldDescrs
ppLibrary = ppFields libFieldDescrs
ppExecutable = ppFields executableFieldDescrs
| 453
|
showPackageDescription pkg = render $
ppPackage pkg
$$ ppCustomFields (customFieldsPD pkg)
$$ (case library pkg of
Nothing -> empty
Just lib -> ppLibrary lib)
$$ vcat [ space $$ ppExecutable exe | exe <- executables pkg ]
where
ppPackage = ppFields pkgDescrFieldDescrs
ppLibrary = ppFields libFieldDescrs
ppExecutable = ppFields executableFieldDescrs
| 398
| true
| true
| 8
| 9
| 113
| 130
| 61
| 69
| null | null |
tjunier/mlgsc
|
src/CladeModel.hs
|
mit
|
modLength (PepCladeModel spm) = pepModLength spm
| 48
|
modLength (PepCladeModel spm) = pepModLength spm
| 48
|
modLength (PepCladeModel spm) = pepModLength spm
| 48
| false
| false
| 0
| 6
| 5
| 19
| 8
| 11
| null | null |
apunktbau/co4
|
src/CO4/Frontend/THCheck.hs
|
gpl-3.0
|
checks :: GenericQ Check
checks a = concat [ and' noGuardedBody a
, and' noBoundPatternsInValueDeclaration a
, and' validDeclaration a
, and' noOverlappingDefaultMatches a
]
| 251
|
checks :: GenericQ Check
checks a = concat [ and' noGuardedBody a
, and' noBoundPatternsInValueDeclaration a
, and' validDeclaration a
, and' noOverlappingDefaultMatches a
]
| 251
|
checks a = concat [ and' noGuardedBody a
, and' noBoundPatternsInValueDeclaration a
, and' validDeclaration a
, and' noOverlappingDefaultMatches a
]
| 226
| false
| true
| 0
| 7
| 102
| 57
| 26
| 31
| null | null |
martin-kolinek/stack
|
src/Stack/Types/Config.hs
|
bsd-3-clause
|
hoogleRoot :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)
hoogleRoot = do
workDir <- getProjectWorkDir
psc <- useShaPathOnWindows =<< platformSnapAndCompilerRel
return $ workDir </> $(mkRelDir "hoogle") </> psc
-- | Get the hoogle database path.
| 286
|
hoogleRoot :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)
hoogleRoot = do
workDir <- getProjectWorkDir
psc <- useShaPathOnWindows =<< platformSnapAndCompilerRel
return $ workDir </> $(mkRelDir "hoogle") </> psc
-- | Get the hoogle database path.
| 286
|
hoogleRoot = do
workDir <- getProjectWorkDir
psc <- useShaPathOnWindows =<< platformSnapAndCompilerRel
return $ workDir </> $(mkRelDir "hoogle") </> psc
-- | Get the hoogle database path.
| 200
| false
| true
| 0
| 11
| 52
| 86
| 42
| 44
| null | null |
Khady/Functional-Programming
|
codes/vector.hs
|
unlicense
|
mapArray f lst = lst |>> scalar |>> f |>> sValue |> array
| 59
|
mapArray f lst = lst |>> scalar |>> f |>> sValue |> array
| 59
|
mapArray f lst = lst |>> scalar |>> f |>> sValue |> array
| 59
| false
| false
| 4
| 8
| 14
| 38
| 15
| 23
| null | null |
changlinli/nikki
|
src/Game/Scene.hs
|
lgpl-3.0
|
renderSwitchesOSD ptr app configuration windowSize scene = do
let (pressed :!: total) = scene ^. switches
text = pv $ printf (switchChar : zeroSpaceChar : "%02i/%02i") pressed total
renderOSD ptr app configuration windowSize text $
const $ Position osdPadding osdPadding
| 294
|
renderSwitchesOSD ptr app configuration windowSize scene = do
let (pressed :!: total) = scene ^. switches
text = pv $ printf (switchChar : zeroSpaceChar : "%02i/%02i") pressed total
renderOSD ptr app configuration windowSize text $
const $ Position osdPadding osdPadding
| 294
|
renderSwitchesOSD ptr app configuration windowSize scene = do
let (pressed :!: total) = scene ^. switches
text = pv $ printf (switchChar : zeroSpaceChar : "%02i/%02i") pressed total
renderOSD ptr app configuration windowSize text $
const $ Position osdPadding osdPadding
| 294
| false
| false
| 0
| 14
| 63
| 92
| 44
| 48
| null | null |
bravit/Idris-dev
|
src/Idris/Prover.hs
|
bsd-3-clause
|
receiveInput :: Handle -> ElabState EState -> Idris (Maybe String)
receiveInput h e =
do i <- getIState
let inh = if h == stdout then stdin else h
len' <- runIO $ IdeMode.getLen inh
len <- case len' of
Left err -> ierror err
Right n -> return n
l <- runIO $ IdeMode.getNChar inh len ""
(sexp, id) <- case IdeMode.parseMessage l of
Left err -> ierror err
Right (sexp, id) -> return (sexp, id)
putIState $ i { idris_outputmode = IdeMode id h }
case IdeMode.sexpToCommand sexp of
Just (IdeMode.REPLCompletions prefix) ->
do (unused, compls) <- proverCompletion (assumptionNames e) (reverse prefix, "")
let good = IdeMode.SexpList [IdeMode.SymbolAtom "ok", IdeMode.toSExp (map replacement compls, reverse unused)]
idemodePutSExp "return" good
receiveInput h e
Just (IdeMode.Interpret cmd) -> return (Just cmd)
Just (IdeMode.TypeOf str) -> return (Just (":t " ++ str))
Just (IdeMode.DocsFor str _) -> return (Just (":doc " ++ str))
_ -> return Nothing
| 1,120
|
receiveInput :: Handle -> ElabState EState -> Idris (Maybe String)
receiveInput h e =
do i <- getIState
let inh = if h == stdout then stdin else h
len' <- runIO $ IdeMode.getLen inh
len <- case len' of
Left err -> ierror err
Right n -> return n
l <- runIO $ IdeMode.getNChar inh len ""
(sexp, id) <- case IdeMode.parseMessage l of
Left err -> ierror err
Right (sexp, id) -> return (sexp, id)
putIState $ i { idris_outputmode = IdeMode id h }
case IdeMode.sexpToCommand sexp of
Just (IdeMode.REPLCompletions prefix) ->
do (unused, compls) <- proverCompletion (assumptionNames e) (reverse prefix, "")
let good = IdeMode.SexpList [IdeMode.SymbolAtom "ok", IdeMode.toSExp (map replacement compls, reverse unused)]
idemodePutSExp "return" good
receiveInput h e
Just (IdeMode.Interpret cmd) -> return (Just cmd)
Just (IdeMode.TypeOf str) -> return (Just (":t " ++ str))
Just (IdeMode.DocsFor str _) -> return (Just (":doc " ++ str))
_ -> return Nothing
| 1,120
|
receiveInput h e =
do i <- getIState
let inh = if h == stdout then stdin else h
len' <- runIO $ IdeMode.getLen inh
len <- case len' of
Left err -> ierror err
Right n -> return n
l <- runIO $ IdeMode.getNChar inh len ""
(sexp, id) <- case IdeMode.parseMessage l of
Left err -> ierror err
Right (sexp, id) -> return (sexp, id)
putIState $ i { idris_outputmode = IdeMode id h }
case IdeMode.sexpToCommand sexp of
Just (IdeMode.REPLCompletions prefix) ->
do (unused, compls) <- proverCompletion (assumptionNames e) (reverse prefix, "")
let good = IdeMode.SexpList [IdeMode.SymbolAtom "ok", IdeMode.toSExp (map replacement compls, reverse unused)]
idemodePutSExp "return" good
receiveInput h e
Just (IdeMode.Interpret cmd) -> return (Just cmd)
Just (IdeMode.TypeOf str) -> return (Just (":t " ++ str))
Just (IdeMode.DocsFor str _) -> return (Just (":doc " ++ str))
_ -> return Nothing
| 1,053
| false
| true
| 0
| 19
| 328
| 438
| 207
| 231
| null | null |
cchalmers/geometry
|
src/Geometry/Combinators.hs
|
bsd-3-clause
|
------------------------------------------------------------------------
-- Aligning
------------------------------------------------------------------------
-- | @alignBy v d a@ moves the origin of @a@ along the vector @v@. If @d
-- = 1@, the origin is moved to the edge of the boundary in the
-- direction of @v@; if @d = -1@, it moves to the edge of the boundary
-- in the direction of the negation of @v@. Other values of @d@
-- interpolate linearly (so for example, @d = 0@ centers the origin
-- along the direction of @v@).
alignBy'
:: (InSpace v n t, Fractional n, HasOrigin t)
=> (v n -> t -> Maybe (n, n)) -> v n -> n -> t -> t
alignBy' f v d t = fromMaybe t $ do
(a,b) <- f v t
Just $ moveOriginTo (P $ lerp' ((d + 1) / 2) b a *^ v) t
where
lerp' alpha a b = alpha * a + (1 - alpha) * b
-- case f v of
-- Just (a,b) -> moveOriginTo (lerp ((d + 1) / 2) a b) t
-- Nothing -> t
| 924
|
alignBy'
:: (InSpace v n t, Fractional n, HasOrigin t)
=> (v n -> t -> Maybe (n, n)) -> v n -> n -> t -> t
alignBy' f v d t = fromMaybe t $ do
(a,b) <- f v t
Just $ moveOriginTo (P $ lerp' ((d + 1) / 2) b a *^ v) t
where
lerp' alpha a b = alpha * a + (1 - alpha) * b
-- case f v of
-- Just (a,b) -> moveOriginTo (lerp ((d + 1) / 2) a b) t
-- Nothing -> t
| 382
|
alignBy' f v d t = fromMaybe t $ do
(a,b) <- f v t
Just $ moveOriginTo (P $ lerp' ((d + 1) / 2) b a *^ v) t
where
lerp' alpha a b = alpha * a + (1 - alpha) * b
-- case f v of
-- Just (a,b) -> moveOriginTo (lerp ((d + 1) / 2) a b) t
-- Nothing -> t
| 271
| true
| true
| 0
| 17
| 219
| 205
| 108
| 97
| null | null |
imalsogreg/tetrode-ephys
|
samples/watchfield.hs
|
gpl-3.0
|
fanoutSpikeToCells :: World -> Consumer TrodeSpike IO r
fanoutSpikeToCells w = forever $ do
spike <- await
posF <- lift (atomically $ readTVar (w^.trackPos))
lift $ forM_ (w^.placeCells)
(\pc -> incorporateSpike pc posF spike)
| 236
|
fanoutSpikeToCells :: World -> Consumer TrodeSpike IO r
fanoutSpikeToCells w = forever $ do
spike <- await
posF <- lift (atomically $ readTVar (w^.trackPos))
lift $ forM_ (w^.placeCells)
(\pc -> incorporateSpike pc posF spike)
| 236
|
fanoutSpikeToCells w = forever $ do
spike <- await
posF <- lift (atomically $ readTVar (w^.trackPos))
lift $ forM_ (w^.placeCells)
(\pc -> incorporateSpike pc posF spike)
| 180
| false
| true
| 0
| 14
| 43
| 97
| 47
| 50
| null | null |
alexander-at-github/eta
|
compiler/ETA/SimplCore/SetLevels.hs
|
bsd-3-clause
|
-- We clone let- and case-bound variables so that they are still
-- distinct when floated out; hence the le_subst/le_env.
-- (see point 3 of the module overview comment).
-- We also use these envs when making a variable polymorphic
-- because we want to float it out past a big lambda.
--
-- The le_subst and le_env always implement the same mapping, but the
-- le_subst maps to CoreExpr and the le_env to LevelledExpr
-- Since the range is always a variable or type application,
-- there is never any difference between the two, but sadly
-- the types differ. The le_subst is used when substituting in
-- a variable's IdInfo; the le_env when we find a Var.
--
-- In addition the le_env records a list of tyvars free in the
-- type application, just so we don't have to call freeVars on
-- the type application repeatedly.
--
-- The domain of the both envs is *pre-cloned* Ids, though
--
-- The domain of the le_lvl_env is the *post-cloned* Ids
initialEnv :: FloatOutSwitches -> LevelEnv
initialEnv float_lams
= LE { le_switches = float_lams
, le_ctxt_lvl = tOP_LEVEL
, le_lvl_env = emptyVarEnv
, le_subst = emptySubst
, le_env = emptyVarEnv }
| 1,327
|
initialEnv :: FloatOutSwitches -> LevelEnv
initialEnv float_lams
= LE { le_switches = float_lams
, le_ctxt_lvl = tOP_LEVEL
, le_lvl_env = emptyVarEnv
, le_subst = emptySubst
, le_env = emptyVarEnv }
| 228
|
initialEnv float_lams
= LE { le_switches = float_lams
, le_ctxt_lvl = tOP_LEVEL
, le_lvl_env = emptyVarEnv
, le_subst = emptySubst
, le_env = emptyVarEnv }
| 185
| true
| true
| 0
| 7
| 386
| 79
| 52
| 27
| null | null |
tdoris/StockExchange
|
Quant/MatchingEngine/Book.hs
|
bsd-3-clause
|
stepBuy :: (Maybe OrderBuy, [Trade]) -> OrderSell -> ((Maybe OrderBuy, [Trade]), Maybe OrderSell)
stepBuy (Nothing, ts) s = ((Nothing, ts), Just s)
| 147
|
stepBuy :: (Maybe OrderBuy, [Trade]) -> OrderSell -> ((Maybe OrderBuy, [Trade]), Maybe OrderSell)
stepBuy (Nothing, ts) s = ((Nothing, ts), Just s)
| 147
|
stepBuy (Nothing, ts) s = ((Nothing, ts), Just s)
| 49
| false
| true
| 0
| 9
| 21
| 83
| 45
| 38
| null | null |
aburnett88/HSat
|
src/HSat/Problem/Instances/Common/Sign.hs
|
mit
|
{-|
Returns 'True' if the 'Sign' is positive.
-}
isPos :: Sign -> Bool
isPos = getBool
| 87
|
isPos :: Sign -> Bool
isPos = getBool
| 37
|
isPos = getBool
| 15
| true
| true
| 0
| 7
| 17
| 23
| 10
| 13
| null | null |
jtobin/prompt-pcap
|
Kospi/Parser.hs
|
bsd-3-clause
|
throwAway :: Int -> Parser ByteString
throwAway = A.take
| 56
|
throwAway :: Int -> Parser ByteString
throwAway = A.take
| 56
|
throwAway = A.take
| 18
| false
| true
| 0
| 7
| 8
| 26
| 11
| 15
| null | null |
gcampax/ghc
|
compiler/typecheck/TcEvidence.hs
|
bsd-3-clause
|
evVarsOfTerm :: EvTerm -> VarSet
evVarsOfTerm (EvId v) = unitVarSet v
| 81
|
evVarsOfTerm :: EvTerm -> VarSet
evVarsOfTerm (EvId v) = unitVarSet v
| 81
|
evVarsOfTerm (EvId v) = unitVarSet v
| 48
| false
| true
| 0
| 7
| 22
| 27
| 13
| 14
| null | null |
vladimir-ipatov/ganeti
|
src/Ganeti/Storage/Drbd/Parser.hs
|
gpl-2.0
|
statusBarParser :: Parser ()
statusBarParser =
skipSpaces
*> A.char '['
*> A.skipWhile (== '=')
*> A.skipWhile (== '>')
*> A.skipWhile (== '.')
*> A.char ']'
*> pure ()
| 182
|
statusBarParser :: Parser ()
statusBarParser =
skipSpaces
*> A.char '['
*> A.skipWhile (== '=')
*> A.skipWhile (== '>')
*> A.skipWhile (== '.')
*> A.char ']'
*> pure ()
| 182
|
statusBarParser =
skipSpaces
*> A.char '['
*> A.skipWhile (== '=')
*> A.skipWhile (== '>')
*> A.skipWhile (== '.')
*> A.char ']'
*> pure ()
| 153
| false
| true
| 12
| 6
| 41
| 94
| 47
| 47
| null | null |
sw17ch/hsgcrypt
|
src/GCrypt/AsymmetricCrypto/Keys.hs
|
lgpl-3.0
|
keyGetGrip :: ACHandle -> ACKey -> IO (Either GCry_Error ByteString)
keyGetGrip h k = do
fp <- mallocForeignPtrBytes numBytes
r <- withForeignPtr fp $ \p -> gcry_ac_key_get_grip h k p
case (toIntEnum r) of
GPG_ERR_NO_ERROR -> return . Right $ mkBS fp
_ -> return $ Left r
where
mkBS p = fromForeignPtr (castForeignPtr p) 0 numBytes
numBytes = 20
| 408
|
keyGetGrip :: ACHandle -> ACKey -> IO (Either GCry_Error ByteString)
keyGetGrip h k = do
fp <- mallocForeignPtrBytes numBytes
r <- withForeignPtr fp $ \p -> gcry_ac_key_get_grip h k p
case (toIntEnum r) of
GPG_ERR_NO_ERROR -> return . Right $ mkBS fp
_ -> return $ Left r
where
mkBS p = fromForeignPtr (castForeignPtr p) 0 numBytes
numBytes = 20
| 408
|
keyGetGrip h k = do
fp <- mallocForeignPtrBytes numBytes
r <- withForeignPtr fp $ \p -> gcry_ac_key_get_grip h k p
case (toIntEnum r) of
GPG_ERR_NO_ERROR -> return . Right $ mkBS fp
_ -> return $ Left r
where
mkBS p = fromForeignPtr (castForeignPtr p) 0 numBytes
numBytes = 20
| 339
| false
| true
| 1
| 11
| 122
| 143
| 67
| 76
| null | null |
tphyahoo/haskoin-wallet
|
Network/Haskoin/Wallet/Client/Commands.hs
|
unlicense
|
cmdGetTx :: String -> String -> Handler ()
cmdGetTx name tidStr = case tidM of
Just tid -> do
k <- R.asks configKeyRing
sendZmq (GetTxR k (pack name) tid) $
\(JsonWithAccount _ _ tx) -> putStr $ printTx tx
_ -> error "Could not parse txid"
where
tidM = decodeTxHashLE tidStr
| 316
|
cmdGetTx :: String -> String -> Handler ()
cmdGetTx name tidStr = case tidM of
Just tid -> do
k <- R.asks configKeyRing
sendZmq (GetTxR k (pack name) tid) $
\(JsonWithAccount _ _ tx) -> putStr $ printTx tx
_ -> error "Could not parse txid"
where
tidM = decodeTxHashLE tidStr
| 316
|
cmdGetTx name tidStr = case tidM of
Just tid -> do
k <- R.asks configKeyRing
sendZmq (GetTxR k (pack name) tid) $
\(JsonWithAccount _ _ tx) -> putStr $ printTx tx
_ -> error "Could not parse txid"
where
tidM = decodeTxHashLE tidStr
| 273
| false
| true
| 1
| 15
| 92
| 130
| 58
| 72
| null | null |
mfpi/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/Core31/Tokens.hs
|
bsd-3-clause
|
gl_STENCIL :: GLenum
gl_STENCIL = 0x1802
| 40
|
gl_STENCIL :: GLenum
gl_STENCIL = 0x1802
| 40
|
gl_STENCIL = 0x1802
| 19
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
asilvestre/haskell-neo4j-rest-client
|
src/Database/Neo4j/Transactional/Cypher.hs
|
mit
|
-- | True if the operation succeeded
isSuccess :: Either TransError Result -> Bool
isSuccess (Left _) = False
| 109
|
isSuccess :: Either TransError Result -> Bool
isSuccess (Left _) = False
| 72
|
isSuccess (Left _) = False
| 26
| true
| true
| 0
| 7
| 18
| 30
| 15
| 15
| null | null |
brendanhay/gogol
|
gogol-servicenetworking/gen/Network/Google/Resource/ServiceNetworking/Operations/Delete.hs
|
mpl-2.0
|
-- | JSONP
odCallback :: Lens' OperationsDelete (Maybe Text)
odCallback
= lens _odCallback (\ s a -> s{_odCallback = a})
| 122
|
odCallback :: Lens' OperationsDelete (Maybe Text)
odCallback
= lens _odCallback (\ s a -> s{_odCallback = a})
| 111
|
odCallback
= lens _odCallback (\ s a -> s{_odCallback = a})
| 61
| true
| true
| 0
| 9
| 21
| 48
| 25
| 23
| null | null |
qrilka/xlsx
|
src/Codec/Xlsx/Types/ConditionalFormatting.hs
|
mit
|
defaultIconSet :: IconSetType
defaultIconSet = IconSet3TrafficLights1
| 70
|
defaultIconSet :: IconSetType
defaultIconSet = IconSet3TrafficLights1
| 70
|
defaultIconSet = IconSet3TrafficLights1
| 40
| false
| true
| 0
| 6
| 6
| 18
| 7
| 11
| null | null |
CulpaBS/wbBach
|
src/Language/Futhark/Attributes.hs
|
bsd-3-clause
|
aliases (Tuple et) = mconcat $ map aliases et
| 45
|
aliases (Tuple et) = mconcat $ map aliases et
| 45
|
aliases (Tuple et) = mconcat $ map aliases et
| 45
| false
| false
| 0
| 6
| 8
| 25
| 11
| 14
| null | null |
Fuuzetsu/yi-emacs-colours
|
src/Yi/Style/EmacsColours.hs
|
gpl-2.0
|
-- | Names: @["thistle4"]@
--
-- R139 G123 B139, 0x8b7b8b
thistle4 :: Color
thistle4 = RGB 139 123 139
| 102
|
thistle4 :: Color
thistle4 = RGB 139 123 139
| 44
|
thistle4 = RGB 139 123 139
| 26
| true
| true
| 0
| 6
| 18
| 27
| 13
| 14
| null | null |
bernstein/ircfs
|
Ircfs/Ctl.hs
|
bsd-3-clause
|
toMessage (Pong s) = Just $ I.Message Nothing I.PONG (I.Params [s] Nothing)
| 75
|
toMessage (Pong s) = Just $ I.Message Nothing I.PONG (I.Params [s] Nothing)
| 75
|
toMessage (Pong s) = Just $ I.Message Nothing I.PONG (I.Params [s] Nothing)
| 75
| false
| false
| 0
| 9
| 11
| 43
| 21
| 22
| null | null |
qnikst/distributed-process-client-server
|
src/Control/Distributed/Process/ManagedProcess/Server.hs
|
bsd-3-clause
|
-- | Create a 'Condition' from a function that takes a process state @a@ and
-- returns a 'Bool' indicating whether the associated handler should run.
--
state :: forall s m. (Serializable m) => (s -> Bool) -> Condition s m
state = State
| 237
|
state :: forall s m. (Serializable m) => (s -> Bool) -> Condition s m
state = State
| 83
|
state = State
| 13
| true
| true
| 0
| 10
| 44
| 51
| 27
| 24
| null | null |
grnet/snf-ganeti
|
src/Ganeti/JQueue.hs
|
bsd-2-clause
|
-- | Tries to extract the opcode summary from an 'InputOpCode'. This
-- duplicates some functionality from the 'opSummary' function in
-- "Ganeti.OpCodes".
extractOpSummary :: InputOpCode -> String
extractOpSummary (ValidOpCode metaop) = opSummary $ metaOpCode metaop
| 267
|
extractOpSummary :: InputOpCode -> String
extractOpSummary (ValidOpCode metaop) = opSummary $ metaOpCode metaop
| 111
|
extractOpSummary (ValidOpCode metaop) = opSummary $ metaOpCode metaop
| 69
| true
| true
| 0
| 7
| 35
| 34
| 18
| 16
| null | null |
supermario/stack
|
src/Stack/Setup.hs
|
bsd-3-clause
|
checkDependency :: String -> CheckDependency String
checkDependency tool = CheckDependency $ \menv -> do
exists <- doesExecutableExist menv tool
return $ if exists then Right tool else Left [tool]
| 204
|
checkDependency :: String -> CheckDependency String
checkDependency tool = CheckDependency $ \menv -> do
exists <- doesExecutableExist menv tool
return $ if exists then Right tool else Left [tool]
| 204
|
checkDependency tool = CheckDependency $ \menv -> do
exists <- doesExecutableExist menv tool
return $ if exists then Right tool else Left [tool]
| 152
| false
| true
| 0
| 12
| 36
| 66
| 32
| 34
| null | null |
bennofs/cabal2nix
|
src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs
|
bsd-3-clause
|
fromDB :: Maybe String -> String -> IO Cabal.GenericPackageDescription
fromDB optHackageDB pkg = do
pkgDesc <- (lookupVersion <=< DB.lookup name) <$> maybe DB.readHashedHackage DB.readHashedHackage' optHackageDB
case pkgDesc of
Just r -> return r
Nothing -> hPutStrLn stderr "*** no such package in the cabal database (did you run cabal update?). " >> exitFailure
where
pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParse pkg)
Cabal.PackageName name = Cabal.pkgName pkgId
version = Cabal.pkgVersion pkgId
lookupVersion :: DB.Map DB.Version Cabal.GenericPackageDescription -> Maybe Cabal.GenericPackageDescription
lookupVersion
| null (versionBranch version) = fmap snd . listToMaybe . reverse . DB.toAscList
| otherwise = DB.lookup version
| 821
|
fromDB :: Maybe String -> String -> IO Cabal.GenericPackageDescription
fromDB optHackageDB pkg = do
pkgDesc <- (lookupVersion <=< DB.lookup name) <$> maybe DB.readHashedHackage DB.readHashedHackage' optHackageDB
case pkgDesc of
Just r -> return r
Nothing -> hPutStrLn stderr "*** no such package in the cabal database (did you run cabal update?). " >> exitFailure
where
pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParse pkg)
Cabal.PackageName name = Cabal.pkgName pkgId
version = Cabal.pkgVersion pkgId
lookupVersion :: DB.Map DB.Version Cabal.GenericPackageDescription -> Maybe Cabal.GenericPackageDescription
lookupVersion
| null (versionBranch version) = fmap snd . listToMaybe . reverse . DB.toAscList
| otherwise = DB.lookup version
| 821
|
fromDB optHackageDB pkg = do
pkgDesc <- (lookupVersion <=< DB.lookup name) <$> maybe DB.readHashedHackage DB.readHashedHackage' optHackageDB
case pkgDesc of
Just r -> return r
Nothing -> hPutStrLn stderr "*** no such package in the cabal database (did you run cabal update?). " >> exitFailure
where
pkgId = fromMaybe (error ("invalid Haskell package id " ++ show pkg)) (simpleParse pkg)
Cabal.PackageName name = Cabal.pkgName pkgId
version = Cabal.pkgVersion pkgId
lookupVersion :: DB.Map DB.Version Cabal.GenericPackageDescription -> Maybe Cabal.GenericPackageDescription
lookupVersion
| null (versionBranch version) = fmap snd . listToMaybe . reverse . DB.toAscList
| otherwise = DB.lookup version
| 750
| false
| true
| 3
| 12
| 154
| 250
| 112
| 138
| null | null |
frontrowed/stratosphere
|
library-gen/Stratosphere/ResourceProperties/ECSServicePlacementConstraint.hs
|
mit
|
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-placementconstraint.html#cfn-ecs-service-placementconstraint-expression
ecsspcExpression :: Lens' ECSServicePlacementConstraint (Maybe (Val Text))
ecsspcExpression = lens _eCSServicePlacementConstraintExpression (\s a -> s { _eCSServicePlacementConstraintExpression = a })
| 366
|
ecsspcExpression :: Lens' ECSServicePlacementConstraint (Maybe (Val Text))
ecsspcExpression = lens _eCSServicePlacementConstraintExpression (\s a -> s { _eCSServicePlacementConstraintExpression = a })
| 200
|
ecsspcExpression = lens _eCSServicePlacementConstraintExpression (\s a -> s { _eCSServicePlacementConstraintExpression = a })
| 125
| true
| true
| 0
| 9
| 22
| 52
| 28
| 24
| null | null |
nevrenato/HetsAlloy
|
Maude/Symbol.hs
|
gpl-2.0
|
toType :: Symbol -> Type
toType = fromJust . toTypeMaybe
| 56
|
toType :: Symbol -> Type
toType = fromJust . toTypeMaybe
| 56
|
toType = fromJust . toTypeMaybe
| 31
| false
| true
| 0
| 5
| 9
| 19
| 10
| 9
| null | null |
comonoidial/ALFIN
|
Alfin/CoreConvert.hs
|
mit
|
-- todo other coercions
convertTypeAp :: Ty -> [SCType] -> SCType
convertTypeAp (Tcon (p,m,c)) xs = SCTypeCon (TypeCon (ModName (L.unpack p) (L.unpack m)) (L.unpack c)) xs
| 172
|
convertTypeAp :: Ty -> [SCType] -> SCType
convertTypeAp (Tcon (p,m,c)) xs = SCTypeCon (TypeCon (ModName (L.unpack p) (L.unpack m)) (L.unpack c)) xs
| 147
|
convertTypeAp (Tcon (p,m,c)) xs = SCTypeCon (TypeCon (ModName (L.unpack p) (L.unpack m)) (L.unpack c)) xs
| 105
| true
| true
| 0
| 12
| 26
| 88
| 46
| 42
| null | null |
alokpndy/haskell-learn
|
src/extensions/gadt&typeclass.hs
|
mit
|
wrap :: (forall n. Num n => n -> n) -> X -> X
wrap f (Y i) = Y $ f i
| 68
|
wrap :: (forall n. Num n => n -> n) -> X -> X
wrap f (Y i) = Y $ f i
| 68
|
wrap f (Y i) = Y $ f i
| 22
| false
| true
| 0
| 9
| 22
| 60
| 29
| 31
| null | null |
brendanhay/gogol
|
gogol-compute/gen/Network/Google/Resource/Compute/SSLPolicies/Patch.hs
|
mpl-2.0
|
-- | Multipart request metadata.
sppPayload :: Lens' SSLPoliciesPatch SSLPolicy
sppPayload
= lens _sppPayload (\ s a -> s{_sppPayload = a})
| 141
|
sppPayload :: Lens' SSLPoliciesPatch SSLPolicy
sppPayload
= lens _sppPayload (\ s a -> s{_sppPayload = a})
| 108
|
sppPayload
= lens _sppPayload (\ s a -> s{_sppPayload = a})
| 61
| true
| true
| 0
| 9
| 22
| 42
| 22
| 20
| null | null |
alphaHeavy/kontiki
|
src/Network/Kontiki/Raft/Follower.hs
|
bsd-3-clause
|
checkTerm :: (Monad m, MonadLog m a)
=> Entry a
-> m Bool
checkTerm e = do
e' <- logEntry $ eIndex e
return $ case e' of
Nothing -> False
Just e'' -> eTerm e'' == eTerm e
-- | Monadic version of `dropWhile'.
| 252
|
checkTerm :: (Monad m, MonadLog m a)
=> Entry a
-> m Bool
checkTerm e = do
e' <- logEntry $ eIndex e
return $ case e' of
Nothing -> False
Just e'' -> eTerm e'' == eTerm e
-- | Monadic version of `dropWhile'.
| 252
|
checkTerm e = do
e' <- logEntry $ eIndex e
return $ case e' of
Nothing -> False
Just e'' -> eTerm e'' == eTerm e
-- | Monadic version of `dropWhile'.
| 174
| false
| true
| 0
| 13
| 89
| 97
| 44
| 53
| null | null |
LeifW/rdf4h
|
testsuite/tests/W3C/Manifest.hs
|
bsd-3-clause
|
mkTestNTriplesNegativeSyntax :: Triples -> TestEntry
mkTestNTriplesNegativeSyntax ts = TestNTriplesPositiveSyntax {
name = lnodeText $ objectByPredicate mfName ts,
comment = lnodeText $ objectByPredicate rdfsComment ts,
approval = objectByPredicate rdftApproval ts,
action = objectByPredicate mfAction ts
}
| 484
|
mkTestNTriplesNegativeSyntax :: Triples -> TestEntry
mkTestNTriplesNegativeSyntax ts = TestNTriplesPositiveSyntax {
name = lnodeText $ objectByPredicate mfName ts,
comment = lnodeText $ objectByPredicate rdfsComment ts,
approval = objectByPredicate rdftApproval ts,
action = objectByPredicate mfAction ts
}
| 484
|
mkTestNTriplesNegativeSyntax ts = TestNTriplesPositiveSyntax {
name = lnodeText $ objectByPredicate mfName ts,
comment = lnodeText $ objectByPredicate rdfsComment ts,
approval = objectByPredicate rdftApproval ts,
action = objectByPredicate mfAction ts
}
| 431
| false
| true
| 0
| 8
| 212
| 72
| 38
| 34
| null | null |
ghc-android/ghc
|
compiler/nativeGen/AsmCodeGen.hs
|
bsd-3-clause
|
shortcutBranches
:: DynFlags
-> NcgImpl statics instr jumpDest
-> [NatCmmDecl statics instr]
-> [NatCmmDecl statics instr]
shortcutBranches dflags ncgImpl tops
| optLevel dflags < 1 = tops -- only with -O or higher
| otherwise = map (apply_mapping ncgImpl mapping) tops'
where
(tops', mappings) = mapAndUnzip (build_mapping ncgImpl) tops
mapping = foldr plusUFM emptyUFM mappings
| 435
|
shortcutBranches
:: DynFlags
-> NcgImpl statics instr jumpDest
-> [NatCmmDecl statics instr]
-> [NatCmmDecl statics instr]
shortcutBranches dflags ncgImpl tops
| optLevel dflags < 1 = tops -- only with -O or higher
| otherwise = map (apply_mapping ncgImpl mapping) tops'
where
(tops', mappings) = mapAndUnzip (build_mapping ncgImpl) tops
mapping = foldr plusUFM emptyUFM mappings
| 434
|
shortcutBranches dflags ncgImpl tops
| optLevel dflags < 1 = tops -- only with -O or higher
| otherwise = map (apply_mapping ncgImpl mapping) tops'
where
(tops', mappings) = mapAndUnzip (build_mapping ncgImpl) tops
mapping = foldr plusUFM emptyUFM mappings
| 283
| false
| true
| 1
| 11
| 110
| 127
| 61
| 66
| null | null |
AlexanderPankiv/ghc
|
compiler/basicTypes/Name.hs
|
bsd-3-clause
|
isHoleName :: Name -> Bool
isHoleName = isHoleModule . nameModule
| 65
|
isHoleName :: Name -> Bool
isHoleName = isHoleModule . nameModule
| 65
|
isHoleName = isHoleModule . nameModule
| 38
| false
| true
| 0
| 5
| 9
| 19
| 10
| 9
| null | null |
TomMD/ghc
|
compiler/utils/Outputable.hs
|
bsd-3-clause
|
qualPackage _other _m = True
| 35
|
qualPackage _other _m = True
| 35
|
qualPackage _other _m = True
| 35
| false
| false
| 0
| 5
| 11
| 11
| 5
| 6
| null | null |
brendanhay/gogol
|
gogol-ml/gen/Network/Google/Resource/Ml/Projects/Locations/Studies/Trials/AddMeasurement.hs
|
mpl-2.0
|
-- | Required. The trial name.
plstamName :: Lens' ProjectsLocationsStudiesTrialsAddMeasurement Text
plstamName
= lens _plstamName (\ s a -> s{_plstamName = a})
| 162
|
plstamName :: Lens' ProjectsLocationsStudiesTrialsAddMeasurement Text
plstamName
= lens _plstamName (\ s a -> s{_plstamName = a})
| 131
|
plstamName
= lens _plstamName (\ s a -> s{_plstamName = a})
| 61
| true
| true
| 0
| 9
| 23
| 42
| 22
| 20
| null | null |
silkapp/heist
|
test/suite/Heist/Tests.hs
|
bsd-3-clause
|
fooSplice :: I.Splice (StateT Int IO)
fooSplice = do
val <- get
put val
I.textSplice $ T.pack $ show val
| 116
|
fooSplice :: I.Splice (StateT Int IO)
fooSplice = do
val <- get
put val
I.textSplice $ T.pack $ show val
| 116
|
fooSplice = do
val <- get
put val
I.textSplice $ T.pack $ show val
| 78
| false
| true
| 0
| 9
| 31
| 55
| 25
| 30
| null | null |
JacquesCarette/literate-scientific-software
|
code/drasil-lang/Language/Drasil/Symbol.hs
|
bsd-2-clause
|
compsy _ (Label _) = GT
| 26
|
compsy _ (Label _) = GT
| 26
|
compsy _ (Label _) = GT
| 26
| false
| false
| 0
| 7
| 8
| 17
| 8
| 9
| null | null |
trofi/BlogLiterately
|
src/BlogLiterately.hs
|
gpl-3.0
|
colouriseCodeBlock :: HsHighlight -> Bool -> P.Block -> P.Block
colouriseCodeBlock hsHilite otherHilite (P.CodeBlock attr@(_,classes,_) s) =
if tag == "haskell" || haskell
then case hsHilite of
HsColourInline style ->
P.RawBlock (P.Format "html") $ bakeStyles style $ colourIt lit src
HsColourCSS -> P.RawBlock (P.Format "html") $ colourIt lit src
HsNoHighlight -> P.RawBlock (P.Format "html") $ simpleHTML hsrc
HsKate -> if null tag
then myHiliteK attr hsrc
else myHiliteK ("",tag:classes,[]) hsrc
else if otherHilite
then case tag of
"" -> myHiliteK attr src
t -> myHiliteK ("",[t],[]) src
else P.RawBlock (P.Format "html") $ simpleHTML src
where (tag,src) = if null classes then unTag s else ("",s)
hsrc = if lit then prepend src else src
lit = False -- "sourceCode" `elem` classes (avoid ugly '>')
haskell = "haskell" `elem` classes
simpleHTML s' = "<pre><code>" ++ s' ++ "</code></pre>"
myHiliteK attr' s' = P.CodeBlock attr' s'
| 1,161
|
colouriseCodeBlock :: HsHighlight -> Bool -> P.Block -> P.Block
colouriseCodeBlock hsHilite otherHilite (P.CodeBlock attr@(_,classes,_) s) =
if tag == "haskell" || haskell
then case hsHilite of
HsColourInline style ->
P.RawBlock (P.Format "html") $ bakeStyles style $ colourIt lit src
HsColourCSS -> P.RawBlock (P.Format "html") $ colourIt lit src
HsNoHighlight -> P.RawBlock (P.Format "html") $ simpleHTML hsrc
HsKate -> if null tag
then myHiliteK attr hsrc
else myHiliteK ("",tag:classes,[]) hsrc
else if otherHilite
then case tag of
"" -> myHiliteK attr src
t -> myHiliteK ("",[t],[]) src
else P.RawBlock (P.Format "html") $ simpleHTML src
where (tag,src) = if null classes then unTag s else ("",s)
hsrc = if lit then prepend src else src
lit = False -- "sourceCode" `elem` classes (avoid ugly '>')
haskell = "haskell" `elem` classes
simpleHTML s' = "<pre><code>" ++ s' ++ "</code></pre>"
myHiliteK attr' s' = P.CodeBlock attr' s'
| 1,161
|
colouriseCodeBlock hsHilite otherHilite (P.CodeBlock attr@(_,classes,_) s) =
if tag == "haskell" || haskell
then case hsHilite of
HsColourInline style ->
P.RawBlock (P.Format "html") $ bakeStyles style $ colourIt lit src
HsColourCSS -> P.RawBlock (P.Format "html") $ colourIt lit src
HsNoHighlight -> P.RawBlock (P.Format "html") $ simpleHTML hsrc
HsKate -> if null tag
then myHiliteK attr hsrc
else myHiliteK ("",tag:classes,[]) hsrc
else if otherHilite
then case tag of
"" -> myHiliteK attr src
t -> myHiliteK ("",[t],[]) src
else P.RawBlock (P.Format "html") $ simpleHTML src
where (tag,src) = if null classes then unTag s else ("",s)
hsrc = if lit then prepend src else src
lit = False -- "sourceCode" `elem` classes (avoid ugly '>')
haskell = "haskell" `elem` classes
simpleHTML s' = "<pre><code>" ++ s' ++ "</code></pre>"
myHiliteK attr' s' = P.CodeBlock attr' s'
| 1,097
| false
| true
| 5
| 14
| 370
| 384
| 195
| 189
| null | null |
sru-systems/protobuf-simple
|
src/Parser/FieldDesc.hs
|
mit
|
setType :: Parser.Type -> FieldDesc -> FieldDesc
setType val self = self{fieldType = Just val}
| 94
|
setType :: Parser.Type -> FieldDesc -> FieldDesc
setType val self = self{fieldType = Just val}
| 94
|
setType val self = self{fieldType = Just val}
| 45
| false
| true
| 0
| 7
| 14
| 37
| 19
| 18
| null | null |
deech/fltkhs
|
scripts/header-to-function-definition.hs
|
mit
|
isSelf _ = False
| 16
|
isSelf _ = False
| 16
|
isSelf _ = False
| 16
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
Bogdanp/ff
|
src/FS.hs
|
mit
|
-- | Recursively collects every file under `base` into the TMVar.
collect :: TMVar (Vector Text) -> Text -> IO ()
collect cs base = do
fs <- qualify =<< contentsOf base
atomically $ modifyTMVar cs $ flip (<>) fs
directories fs
where qualify = mapM $ return . ((base <> "/") <>)
directories = filterM (doesDirectoryExist . T.unpack) >=> mapM_ (collect cs)
| 372
|
collect :: TMVar (Vector Text) -> Text -> IO ()
collect cs base = do
fs <- qualify =<< contentsOf base
atomically $ modifyTMVar cs $ flip (<>) fs
directories fs
where qualify = mapM $ return . ((base <> "/") <>)
directories = filterM (doesDirectoryExist . T.unpack) >=> mapM_ (collect cs)
| 306
|
collect cs base = do
fs <- qualify =<< contentsOf base
atomically $ modifyTMVar cs $ flip (<>) fs
directories fs
where qualify = mapM $ return . ((base <> "/") <>)
directories = filterM (doesDirectoryExist . T.unpack) >=> mapM_ (collect cs)
| 258
| true
| true
| 1
| 10
| 80
| 138
| 67
| 71
| null | null |
maoe/Haskell-Turtle-Library
|
src/Turtle/Prelude.hs
|
bsd-3-clause
|
stream
:: Process.CreateProcess
-- ^ Command
-> Shell Text
-- ^ Lines of standard input
-> Shell Text
-- ^ Lines of standard output
stream p s = do
let p' = p
{ Process.std_in = Process.CreatePipe
, Process.std_out = Process.CreatePipe
, Process.std_err = Process.Inherit
}
(Just hIn, Just hOut, Nothing, _) <- liftIO (Process.createProcess p')
let feedIn = sh (do
txt <- s
liftIO (Text.hPutStrLn hIn txt) )
_ <- using (fork feedIn)
inhandle hOut
-- | Print to @stdout@
| 587
|
stream
:: Process.CreateProcess
-- ^ Command
-> Shell Text
-- ^ Lines of standard input
-> Shell Text
stream p s = do
let p' = p
{ Process.std_in = Process.CreatePipe
, Process.std_out = Process.CreatePipe
, Process.std_err = Process.Inherit
}
(Just hIn, Just hOut, Nothing, _) <- liftIO (Process.createProcess p')
let feedIn = sh (do
txt <- s
liftIO (Text.hPutStrLn hIn txt) )
_ <- using (fork feedIn)
inhandle hOut
-- | Print to @stdout@
| 553
|
stream p s = do
let p' = p
{ Process.std_in = Process.CreatePipe
, Process.std_out = Process.CreatePipe
, Process.std_err = Process.Inherit
}
(Just hIn, Just hOut, Nothing, _) <- liftIO (Process.createProcess p')
let feedIn = sh (do
txt <- s
liftIO (Text.hPutStrLn hIn txt) )
_ <- using (fork feedIn)
inhandle hOut
-- | Print to @stdout@
| 431
| true
| true
| 0
| 18
| 198
| 178
| 87
| 91
| null | null |
Proclivis/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxSTC_MMIXAL_OPCODE_PRE :: Int
wxSTC_MMIXAL_OPCODE_PRE = 4
| 58
|
wxSTC_MMIXAL_OPCODE_PRE :: Int
wxSTC_MMIXAL_OPCODE_PRE = 4
| 58
|
wxSTC_MMIXAL_OPCODE_PRE = 4
| 27
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
brendanhay/gogol
|
gogol-monitoring/gen/Network/Google/Resource/Monitoring/Projects/NotificationChannels/Delete.hs
|
mpl-2.0
|
-- | OAuth access token.
pncdAccessToken :: Lens' ProjectsNotificationChannelsDelete (Maybe Text)
pncdAccessToken
= lens _pncdAccessToken
(\ s a -> s{_pncdAccessToken = a})
| 180
|
pncdAccessToken :: Lens' ProjectsNotificationChannelsDelete (Maybe Text)
pncdAccessToken
= lens _pncdAccessToken
(\ s a -> s{_pncdAccessToken = a})
| 155
|
pncdAccessToken
= lens _pncdAccessToken
(\ s a -> s{_pncdAccessToken = a})
| 82
| true
| true
| 0
| 9
| 29
| 48
| 25
| 23
| null | null |
vincenthz/cryptonite
|
Crypto/MAC/Poly1305.hs
|
bsd-3-clause
|
- | update a context with a bytestring
update :: ByteArrayAccess ba => State -> ba -> State
update (State prevCtx) d = State $ B.copyAndFreeze prevCtx $ \ctxPtr ->
B.withByteArray d $ \dataPtr ->
c_poly1305_update (castPtr ctxPtr) dataPtr (fromIntegral $ B.length d)
| 279
|
update :: ByteArrayAccess ba => State -> ba -> State
update (State prevCtx) d = State $ B.copyAndFreeze prevCtx $ \ctxPtr ->
B.withByteArray d $ \dataPtr ->
c_poly1305_update (castPtr ctxPtr) dataPtr (fromIntegral $ B.length d)
| 239
|
update (State prevCtx) d = State $ B.copyAndFreeze prevCtx $ \ctxPtr ->
B.withByteArray d $ \dataPtr ->
c_poly1305_update (castPtr ctxPtr) dataPtr (fromIntegral $ B.length d)
| 186
| true
| true
| 1
| 13
| 55
| 119
| 55
| 64
| null | null |
yoo-e/yesod-helpers
|
Yesod/Helpers/Utils.hs
|
bsd-3-clause
|
-- | Lookup file extension for a MIME
defaultExtensionOfMime :: MM.MimeType -> Maybe MM.Extension
defaultExtensionOfMime mt = fmap fst $ find ((== mt) . snd) (mapToList MM.defaultMimeMap)
| 187
|
defaultExtensionOfMime :: MM.MimeType -> Maybe MM.Extension
defaultExtensionOfMime mt = fmap fst $ find ((== mt) . snd) (mapToList MM.defaultMimeMap)
| 149
|
defaultExtensionOfMime mt = fmap fst $ find ((== mt) . snd) (mapToList MM.defaultMimeMap)
| 89
| true
| true
| 0
| 9
| 26
| 57
| 29
| 28
| null | null |
rbonifacio/funsat
|
etc/fiblib/Data/FibHeap.hs
|
bsd-3-clause
|
insertRight x (Cursor t p) = case p of
Point ls rs u -> Cursor t (Point ls (x:rs) u)
| 88
|
insertRight x (Cursor t p) = case p of
Point ls rs u -> Cursor t (Point ls (x:rs) u)
| 88
|
insertRight x (Cursor t p) = case p of
Point ls rs u -> Cursor t (Point ls (x:rs) u)
| 88
| false
| false
| 2
| 9
| 23
| 57
| 28
| 29
| null | null |
ezyang/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
firstAName = varQual aRROW (fsLit "first") firstAIdKey
| 66
|
firstAName = varQual aRROW (fsLit "first") firstAIdKey
| 66
|
firstAName = varQual aRROW (fsLit "first") firstAIdKey
| 66
| false
| false
| 1
| 7
| 18
| 22
| 9
| 13
| null | null |
lancelotsix/hs-tls
|
debug/src/Stunnel.hs
|
bsd-3-clause
|
connectAddressDescription (AddrSocket family sockaddr) = do
sock <- socket family Stream defaultProtocol
E.catch (connect sock sockaddr)
(\(e :: SomeException) -> sClose sock >> error ("cannot open socket " ++ show sockaddr ++ " " ++ show e))
return $ StunnelSocket sock
| 292
|
connectAddressDescription (AddrSocket family sockaddr) = do
sock <- socket family Stream defaultProtocol
E.catch (connect sock sockaddr)
(\(e :: SomeException) -> sClose sock >> error ("cannot open socket " ++ show sockaddr ++ " " ++ show e))
return $ StunnelSocket sock
| 292
|
connectAddressDescription (AddrSocket family sockaddr) = do
sock <- socket family Stream defaultProtocol
E.catch (connect sock sockaddr)
(\(e :: SomeException) -> sClose sock >> error ("cannot open socket " ++ show sockaddr ++ " " ++ show e))
return $ StunnelSocket sock
| 292
| false
| false
| 0
| 16
| 62
| 105
| 49
| 56
| null | null |
gcampax/ghc
|
compiler/typecheck/TcRnTypes.hs
|
bsd-3-clause
|
subGoalCounterValue CountTyFunApps (SubGoalDepth _ f) = f
| 59
|
subGoalCounterValue CountTyFunApps (SubGoalDepth _ f) = f
| 59
|
subGoalCounterValue CountTyFunApps (SubGoalDepth _ f) = f
| 59
| false
| false
| 0
| 7
| 8
| 19
| 9
| 10
| null | null |
graninas/Andromeda
|
src/Andromeda/Types/Hardware/Device.hs
|
bsd-3-clause
|
writeDeviceIO = writeIORef
| 26
|
writeDeviceIO = writeIORef
| 26
|
writeDeviceIO = writeIORef
| 26
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
emonkak/skype4hs
|
src/Network/Skype/Command/Chat.hs
|
mit
|
joinChat :: (MonadBaseControl IO m, MonadIO m, MonadSkype m)
=> ChatID
-> SkypeT m ()
joinChat chatID = executeCommandWithID command $ \response ->
case response of
AlterChat AlterChatJoin -> return $ Just ()
_ -> return Nothing
where
command = "ALTER CHAT " <> chatID <> " JOIN"
-- | Leaves to a chat.
| 359
|
joinChat :: (MonadBaseControl IO m, MonadIO m, MonadSkype m)
=> ChatID
-> SkypeT m ()
joinChat chatID = executeCommandWithID command $ \response ->
case response of
AlterChat AlterChatJoin -> return $ Just ()
_ -> return Nothing
where
command = "ALTER CHAT " <> chatID <> " JOIN"
-- | Leaves to a chat.
| 359
|
joinChat chatID = executeCommandWithID command $ \response ->
case response of
AlterChat AlterChatJoin -> return $ Just ()
_ -> return Nothing
where
command = "ALTER CHAT " <> chatID <> " JOIN"
-- | Leaves to a chat.
| 255
| false
| true
| 0
| 12
| 110
| 108
| 53
| 55
| null | null |
changlinli/nikki
|
src/Base/Renderable/WholeScreenPixmap.hs
|
lgpl-3.0
|
typPixmaps :: Application -> WholeScreenPixmap -> [Pixmap]
typPixmaps app MenuBackground =
menuBackground $ applicationPixmaps app
| 134
|
typPixmaps :: Application -> WholeScreenPixmap -> [Pixmap]
typPixmaps app MenuBackground =
menuBackground $ applicationPixmaps app
| 134
|
typPixmaps app MenuBackground =
menuBackground $ applicationPixmaps app
| 75
| false
| true
| 0
| 7
| 18
| 34
| 17
| 17
| null | null |
urbanslug/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
ratioDataConKey = mkPreludeDataConUnique 12
| 67
|
ratioDataConKey = mkPreludeDataConUnique 12
| 67
|
ratioDataConKey = mkPreludeDataConUnique 12
| 67
| false
| false
| 0
| 5
| 27
| 9
| 4
| 5
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.