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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ekmett/ekg | System/Remote/Snap.hs | bsd-3-clause | ------------------------------------------------------------------------
-- | Convert a host name (e.g. \"localhost\" or \"127.0.0.1\") to a
-- numeric host address (e.g. \"127.0.0.1\").
getNumericHostAddress :: S.ByteString -> IO S.ByteString
getNumericHostAddress host = do
ais <- getAddrInfo Nothing (Just (S8.unpack host)) Nothing
case ais of
[] -> unsupportedAddressError
(ai:_) -> do
ni <- getNameInfo [NI_NUMERICHOST] True False (addrAddress ai)
case ni of
(Just numericHost, _) -> return $! S8.pack numericHost
_ -> unsupportedAddressError
where
unsupportedAddressError = throwIO $
userError $ "unsupported address: " ++ S8.unpack host | 738 | getNumericHostAddress :: S.ByteString -> IO S.ByteString
getNumericHostAddress host = do
ais <- getAddrInfo Nothing (Just (S8.unpack host)) Nothing
case ais of
[] -> unsupportedAddressError
(ai:_) -> do
ni <- getNameInfo [NI_NUMERICHOST] True False (addrAddress ai)
case ni of
(Just numericHost, _) -> return $! S8.pack numericHost
_ -> unsupportedAddressError
where
unsupportedAddressError = throwIO $
userError $ "unsupported address: " ++ S8.unpack host | 550 | getNumericHostAddress host = do
ais <- getAddrInfo Nothing (Just (S8.unpack host)) Nothing
case ais of
[] -> unsupportedAddressError
(ai:_) -> do
ni <- getNameInfo [NI_NUMERICHOST] True False (addrAddress ai)
case ni of
(Just numericHost, _) -> return $! S8.pack numericHost
_ -> unsupportedAddressError
where
unsupportedAddressError = throwIO $
userError $ "unsupported address: " ++ S8.unpack host | 493 | true | true | 0 | 17 | 175 | 172 | 84 | 88 | null | null |
rahulmutt/ghcvm | compiler/Eta/Rename/RnTypes.hs | bsd-3-clause | warnUnusedForAlls :: SDoc -> LHsTyVarBndrs RdrName -> [RdrName] -> TcM ()
warnUnusedForAlls in_doc bound mentioned_rdrs
= whenWOptM Opt_WarnUnusedMatches $
mapM_ add_warn bound_but_not_used
where
bound_names = hsLTyVarLocNames bound
bound_but_not_used = filterOut ((`elem` mentioned_rdrs) . unLoc) bound_names
add_warn (L loc tv)
= addWarnAt (Reason Opt_WarnUnusedMatches) loc $
vcat [ ptext (sLit "Unused quantified type variable") <+> quotes (ppr tv)
, in_doc ] | 518 | warnUnusedForAlls :: SDoc -> LHsTyVarBndrs RdrName -> [RdrName] -> TcM ()
warnUnusedForAlls in_doc bound mentioned_rdrs
= whenWOptM Opt_WarnUnusedMatches $
mapM_ add_warn bound_but_not_used
where
bound_names = hsLTyVarLocNames bound
bound_but_not_used = filterOut ((`elem` mentioned_rdrs) . unLoc) bound_names
add_warn (L loc tv)
= addWarnAt (Reason Opt_WarnUnusedMatches) loc $
vcat [ ptext (sLit "Unused quantified type variable") <+> quotes (ppr tv)
, in_doc ] | 518 | warnUnusedForAlls in_doc bound mentioned_rdrs
= whenWOptM Opt_WarnUnusedMatches $
mapM_ add_warn bound_but_not_used
where
bound_names = hsLTyVarLocNames bound
bound_but_not_used = filterOut ((`elem` mentioned_rdrs) . unLoc) bound_names
add_warn (L loc tv)
= addWarnAt (Reason Opt_WarnUnusedMatches) loc $
vcat [ ptext (sLit "Unused quantified type variable") <+> quotes (ppr tv)
, in_doc ] | 444 | false | true | 0 | 9 | 114 | 151 | 74 | 77 | null | null |
mmarx/jebediah | cli/spaceplane-hangar/Main.hs | gpl-3.0 | c1' = head $ counter sub | 24 | c1' = head $ counter sub | 24 | c1' = head $ counter sub | 24 | false | false | 0 | 6 | 5 | 13 | 6 | 7 | null | null |
apyrgio/snf-ganeti | src/Ganeti/Constants.hs | bsd-2-clause | ssMasterNetmask :: String
ssMasterNetmask = "master_netmask" | 60 | ssMasterNetmask :: String
ssMasterNetmask = "master_netmask" | 60 | ssMasterNetmask = "master_netmask" | 34 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
fgaz/shine | shine-examples/spaceinvaders/Game.hs | mit | runCollisions :: [Item] -> [Item] -> ([Item], [Item])
runCollisions [] is = ([], is) | 84 | runCollisions :: [Item] -> [Item] -> ([Item], [Item])
runCollisions [] is = ([], is) | 84 | runCollisions [] is = ([], is) | 30 | false | true | 0 | 8 | 13 | 52 | 30 | 22 | null | null |
kim/amazonka | amazonka-opsworks/gen/Network/AWS/OpsWorks/Types.hs | mpl-2.0 | -- | Whether to enable Elastic Load Balancing connection draining. For more
-- information, see <http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/TerminologyandKeyConcepts.html#conn-drain Connection Draining>
secDelayUntilElbConnectionsDrained :: Lens' ShutdownEventConfiguration (Maybe Bool)
secDelayUntilElbConnectionsDrained =
lens _secDelayUntilElbConnectionsDrained
(\s a -> s { _secDelayUntilElbConnectionsDrained = a }) | 459 | secDelayUntilElbConnectionsDrained :: Lens' ShutdownEventConfiguration (Maybe Bool)
secDelayUntilElbConnectionsDrained =
lens _secDelayUntilElbConnectionsDrained
(\s a -> s { _secDelayUntilElbConnectionsDrained = a }) | 229 | secDelayUntilElbConnectionsDrained =
lens _secDelayUntilElbConnectionsDrained
(\s a -> s { _secDelayUntilElbConnectionsDrained = a }) | 145 | true | true | 0 | 9 | 48 | 47 | 26 | 21 | null | null |
nicklawls/transformers | app/Main.hs | bsd-3-clause | eval4 (Plus e1 e2) = do tick
e1' <- eval4 e1
e2' <- eval4 e2
case (e1', e2') of
(IntVal i1, IntVal i2) ->
return $ IntVal (i1 + i2)
_ -> throwError "type error in addition" | 326 | eval4 (Plus e1 e2) = do tick
e1' <- eval4 e1
e2' <- eval4 e2
case (e1', e2') of
(IntVal i1, IntVal i2) ->
return $ IntVal (i1 + i2)
_ -> throwError "type error in addition" | 326 | eval4 (Plus e1 e2) = do tick
e1' <- eval4 e1
e2' <- eval4 e2
case (e1', e2') of
(IntVal i1, IntVal i2) ->
return $ IntVal (i1 + i2)
_ -> throwError "type error in addition" | 326 | false | false | 0 | 13 | 190 | 95 | 44 | 51 | null | null |
phaazon/phaazon.net | backend/src/State.hs | gpl-3.0 | -- | Mon cul c’est du téflon.
getUploadedFiles :: (MonadIO m) => APIState -> m MimeSortedFiles
getUploadedFiles = liftIO . readTVarIO . uploadedFiles | 149 | getUploadedFiles :: (MonadIO m) => APIState -> m MimeSortedFiles
getUploadedFiles = liftIO . readTVarIO . uploadedFiles | 119 | getUploadedFiles = liftIO . readTVarIO . uploadedFiles | 54 | true | true | 0 | 7 | 22 | 36 | 19 | 17 | null | null |
robdockins/orlin | src/Orlin/CmdLine.hs | bsd-2-clause | buildUnitEnv' :: String -> IO (QuantitySet, UnitTable, CompSt, AST.Module AST.Ident)
buildUnitEnv' fp = do
mod <- openFile fp ReadMode >>= hGetContents >>=
either printErrs return . runModuleParser fp >>= premoduleToModule
let (st', x) = unComp (buildUnitEnv mod) initialCompSt
displayErrors (comp_messages st')
case x of
Nothing -> exitFailure
Just (q,ut) -> return (q,ut,st',mod) | 412 | buildUnitEnv' :: String -> IO (QuantitySet, UnitTable, CompSt, AST.Module AST.Ident)
buildUnitEnv' fp = do
mod <- openFile fp ReadMode >>= hGetContents >>=
either printErrs return . runModuleParser fp >>= premoduleToModule
let (st', x) = unComp (buildUnitEnv mod) initialCompSt
displayErrors (comp_messages st')
case x of
Nothing -> exitFailure
Just (q,ut) -> return (q,ut,st',mod) | 412 | buildUnitEnv' fp = do
mod <- openFile fp ReadMode >>= hGetContents >>=
either printErrs return . runModuleParser fp >>= premoduleToModule
let (st', x) = unComp (buildUnitEnv mod) initialCompSt
displayErrors (comp_messages st')
case x of
Nothing -> exitFailure
Just (q,ut) -> return (q,ut,st',mod) | 327 | false | true | 0 | 12 | 82 | 158 | 78 | 80 | null | null |
bernstein/ircfs | Ircfs/Connect.hs | bsd-3-clause | isConnected Disconnected = False | 35 | isConnected Disconnected = False | 35 | isConnected Disconnected = False | 35 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
Jiggins/CS210 | Parser.hs | gpl-3.0 | -- | Uses regex to find the year in brackets and remove it.
-- also removes any quotes `"`
parseUrl :: String -> String
parseUrl = filter (/= '\"') . head . splitRegex (mkRegex "\\(.*\\)") | 188 | parseUrl :: String -> String
parseUrl = filter (/= '\"') . head . splitRegex (mkRegex "\\(.*\\)") | 97 | parseUrl = filter (/= '\"') . head . splitRegex (mkRegex "\\(.*\\)") | 68 | true | true | 0 | 8 | 34 | 41 | 22 | 19 | null | null |
HIPERFIT/futhark | src/Futhark/Transform/Rename.hs | isc | -- | Produce a map of the substitutions that should be performed by
-- the renamer.
renamerSubstitutions :: RenameM Substitutions
renamerSubstitutions = asks envNameMap | 168 | renamerSubstitutions :: RenameM Substitutions
renamerSubstitutions = asks envNameMap | 84 | renamerSubstitutions = asks envNameMap | 38 | true | true | 0 | 5 | 23 | 19 | 10 | 9 | null | null |
jordanemedlock/fungen | Graphics/UI/Fungen/Util.hs | bsd-3-clause | pow2 n = 2 * pow2(n-1) | 22 | pow2 n = 2 * pow2(n-1) | 22 | pow2 n = 2 * pow2(n-1) | 22 | false | false | 2 | 7 | 5 | 28 | 11 | 17 | null | null |
lambdacms/lambdacms | lambdacms-core/LambdaCms/Core/Foundation.hs | mit | adminLayoutSub :: LambdaCmsAdmin master
=> WidgetT sub IO ()
-> HandlerT sub (HandlerT master IO) Html
adminLayoutSub widget = widgetToParentWidget widget >>= lift . adminLayout | 213 | adminLayoutSub :: LambdaCmsAdmin master
=> WidgetT sub IO ()
-> HandlerT sub (HandlerT master IO) Html
adminLayoutSub widget = widgetToParentWidget widget >>= lift . adminLayout | 213 | adminLayoutSub widget = widgetToParentWidget widget >>= lift . adminLayout | 74 | false | true | 0 | 9 | 60 | 60 | 28 | 32 | null | null |
mrlovre/super-memory | Pro3/src/LinguisticVariables/DistanceLinguisticVariables.hs | gpl-3.0 | closeDistance :: AFuzzySet
closeDistance = distanceFuzzySet $ lambdaFunctionGenerator criticalDistanceI closeDistanceI farDistanceI | 131 | closeDistance :: AFuzzySet
closeDistance = distanceFuzzySet $ lambdaFunctionGenerator criticalDistanceI closeDistanceI farDistanceI | 131 | closeDistance = distanceFuzzySet $ lambdaFunctionGenerator criticalDistanceI closeDistanceI farDistanceI | 104 | false | true | 0 | 6 | 10 | 22 | 11 | 11 | null | null |
SaneApp/hedis-simple | src/Database/Redis/Simple.hs | mit | zRevRangeByScoreLimit :: (R.RedisCtx mi r, WrappedRedis m mi r) => ByteString -> Double -> Double -> Integer -> Integer -> m [ByteString]
zRevRangeByScoreLimit k l r o c = wrap $ R.zrevrangebyscoreLimit k l r o c | 212 | zRevRangeByScoreLimit :: (R.RedisCtx mi r, WrappedRedis m mi r) => ByteString -> Double -> Double -> Integer -> Integer -> m [ByteString]
zRevRangeByScoreLimit k l r o c = wrap $ R.zrevrangebyscoreLimit k l r o c | 212 | zRevRangeByScoreLimit k l r o c = wrap $ R.zrevrangebyscoreLimit k l r o c | 74 | false | true | 0 | 12 | 36 | 88 | 44 | 44 | null | null |
rueshyna/gogol | gogol-partners/gen/Network/Google/Partners/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'ListUserStatesResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lusrUserStates'
--
-- * 'lusrResponseMetadata'
listUserStatesResponse
:: ListUserStatesResponse
listUserStatesResponse =
ListUserStatesResponse'
{ _lusrUserStates = Nothing
, _lusrResponseMetadata = Nothing
} | 411 | listUserStatesResponse
:: ListUserStatesResponse
listUserStatesResponse =
ListUserStatesResponse'
{ _lusrUserStates = Nothing
, _lusrResponseMetadata = Nothing
} | 181 | listUserStatesResponse =
ListUserStatesResponse'
{ _lusrUserStates = Nothing
, _lusrResponseMetadata = Nothing
} | 128 | true | true | 0 | 7 | 72 | 42 | 24 | 18 | null | null |
kelnage/tamarin-prover | lib/theory/src/Theory/Constraint/Solver/ProofMethod.hs | gpl-3.0 | injRanking :: ProofContext
-> Bool
-> System
-> [AnnotatedGoal] -> [AnnotatedGoal]
injRanking ctxt allowLoopBreakers sys =
(sortOnUsefulness . unmark . sortDecisionTree [notSolveLast] . sortDecisionTree solveFirst . goalNrRanking)
where
oneCaseOnly = catMaybes . map getMsgOneCase . L.get pcSources $ ctxt
getMsgOneCase cd = case msgPremise (L.get cdGoal cd) of
Just (viewTerm -> FApp o _)
| length (getDisj (L.get cdCases cd)) == 1 -> Just o
_ -> Nothing
sortOnUsefulness = sortOn (tagUsefulness . snd . snd)
tagUsefulness Useful = 0 :: Int
tagUsefulness ProbablyConstructible = 1
tagUsefulness LoopBreaker = 1
tagUsefulness CurrentlyDeducible = 2
unmark | allowLoopBreakers = map unmarkPremiseG
| otherwise = id
unmarkPremiseG (goal@(PremiseG _ _), (nr, _)) = (goal, (nr, Useful))
unmarkPremiseG annGoal = annGoal
-- move the Last proto facts (L_) and large splits to the end by
-- putting all goals that shouldn't be solved last in front
notSolveLast goaltuple = (isNoLargeSplitGoal $ fst goaltuple)
&& (isNonLastProtoFact $ fst goaltuple)
&& (isNotKnowsLastNameGoal $ fst goaltuple)
solveFirst =
[ isImmediateGoal . fst -- Goals with the I_ prefix
, isHighPriorityGoal . fst -- Goals with the F_ prefix, by goal number
, isMedPriorityGoal -- Various important goals, by goal number
, isLowPriorityGoal ]
-- move the rest (mostly more expensive KU-goals) before expensive
-- equation splits
smallSplitGoalSize = 3
msgPremise (ActionG _ fa) = do (UpK, m) <- kFactView fa; return m
msgPremise _ = Nothing
-- Putting the goals together like this ranks them by goal number
-- within the same priority class, so one type of goal doesn't always win
-- (assuming the same usefulness)
isHighPriorityGoal goal = (isKnowsFirstNameGoal goal)
|| (isFirstProtoFact goal)
|| (isChainGoal goal)
|| (isFreshKnowsGoal goal)
isMedPriorityGoal goaltuple = (isStandardActionGoal $ fst goaltuple)
|| (isDisjGoal $ fst goaltuple)
|| (isPrivateKnowsGoal $ fst goaltuple)
|| (isSplitGoalSmall $ fst goaltuple)
|| (isMsgOneCaseGoal $ fst goaltuple)
|| (isNonLoopBreakerProtoFactGoal goaltuple)
isLowPriorityGoal goaltuple = (isDoubleExpGoal $ fst goaltuple)
|| (isSignatureGoal $ fst goaltuple)
|| (isProtoFactGoal goaltuple)
isNonLoopBreakerProtoFactGoal (PremiseG _ fa, (_, Useful)) = not (isKFact fa)
isNonLoopBreakerProtoFactGoal _ = False
isProtoFactGoal (PremiseG _ fa, (_, _)) = not (isKFact fa)
isProtoFactGoal _ = False
-- Detect 'I_' (immediate) fact and term prefix for heuristics
isImmediateGoal (PremiseG _ (Fact (ProtoFact _ ('I':'_':_) _) _)) = True
isImmediateGoal (ActionG _ (Fact (ProtoFact _ ('I':'_':_) _) _)) = True
isImmediateGoal goal = isKnowsImmediateNameGoal goal
-- Detect 'F_' (first) fact prefix for heuristics
isFirstProtoFact (PremiseG _ (Fact (ProtoFact _ ('F':'_':_) _) _)) = True
isFirstProtoFact (ActionG _ (Fact (ProtoFact _ ('F':'_':_) _) _)) = True
isFirstProtoFact _ = False
-- Detect 'L_' (last) fact prefix for heuristics
isNonLastProtoFact (PremiseG _ (Fact (ProtoFact _ ('L':'_':_) _) _)) = False
isNonLastProtoFact (ActionG _ (Fact (ProtoFact _ ('L':'_':_) _) _)) = False
isNonLastProtoFact _ = True
isLastName lv = isPrefixOf "L_" (lvarName lv)
isFirstName lv = isPrefixOf "F_" (lvarName lv)
isImmediateName lv = isPrefixOf "I_" (lvarName lv)
isNotKnowsLastNameGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | ((lvarSort lv == LSortFresh) && isLastName lv)-> False
_ -> True
isKnowsFirstNameGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | ((lvarSort lv == LSortFresh) && isFirstName lv)-> True
_ -> False
isKnowsImmediateNameGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | ((lvarSort lv == LSortFresh) && isImmediateName lv)-> True
_ -> False
isFreshKnowsGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | (lvarSort lv == LSortFresh) -> True
_ -> False
isMsgOneCaseGoal goal = case msgPremise goal of
Just (viewTerm -> FApp o _) | o `elem` oneCaseOnly -> True
_ -> False
isPrivateKnowsGoal goal = case msgPremise goal of
Just t -> isPrivateFunction t
_ -> False
isSignatureGoal goal = case msgPremise goal of
Just (viewTerm -> FApp (NoEq (f, _)) _) | (BC.unpack f) == "sign" -> True
_ -> False
isDoubleExpGoal goal = case msgPremise goal of
Just (viewTerm2 -> FExp _ (viewTerm2 -> FMult _)) -> True
_ -> False
-- Be conservative on splits that don't exist.
isSplitGoalSmall (SplitG sid) =
maybe False (<= smallSplitGoalSize) $ splitSize (L.get sEqStore sys) sid
isSplitGoalSmall _ = False
isNoLargeSplitGoal goal@(SplitG _) = isSplitGoalSmall goal
isNoLargeSplitGoal _ = True
-- | @sortDecisionTree xs ps@ returns a reordering of @xs@
-- such that the sublist satisfying @ps!!0@ occurs first,
-- then the sublist satisfying @ps!!1@, and so on.
sortDecisionTree :: [a -> Bool] -> [a] -> [a]
sortDecisionTree [] xs = xs
sortDecisionTree (p:ps) xs = sat ++ sortDecisionTree ps nonsat
where (sat, nonsat) = partition p xs
-- | A ranking function tuned for the automatic verification of
-- classical security protocols that exhibit a well-founded protocol premise
-- fact flow. | 6,733 | injRanking :: ProofContext
-> Bool
-> System
-> [AnnotatedGoal] -> [AnnotatedGoal]
injRanking ctxt allowLoopBreakers sys =
(sortOnUsefulness . unmark . sortDecisionTree [notSolveLast] . sortDecisionTree solveFirst . goalNrRanking)
where
oneCaseOnly = catMaybes . map getMsgOneCase . L.get pcSources $ ctxt
getMsgOneCase cd = case msgPremise (L.get cdGoal cd) of
Just (viewTerm -> FApp o _)
| length (getDisj (L.get cdCases cd)) == 1 -> Just o
_ -> Nothing
sortOnUsefulness = sortOn (tagUsefulness . snd . snd)
tagUsefulness Useful = 0 :: Int
tagUsefulness ProbablyConstructible = 1
tagUsefulness LoopBreaker = 1
tagUsefulness CurrentlyDeducible = 2
unmark | allowLoopBreakers = map unmarkPremiseG
| otherwise = id
unmarkPremiseG (goal@(PremiseG _ _), (nr, _)) = (goal, (nr, Useful))
unmarkPremiseG annGoal = annGoal
-- move the Last proto facts (L_) and large splits to the end by
-- putting all goals that shouldn't be solved last in front
notSolveLast goaltuple = (isNoLargeSplitGoal $ fst goaltuple)
&& (isNonLastProtoFact $ fst goaltuple)
&& (isNotKnowsLastNameGoal $ fst goaltuple)
solveFirst =
[ isImmediateGoal . fst -- Goals with the I_ prefix
, isHighPriorityGoal . fst -- Goals with the F_ prefix, by goal number
, isMedPriorityGoal -- Various important goals, by goal number
, isLowPriorityGoal ]
-- move the rest (mostly more expensive KU-goals) before expensive
-- equation splits
smallSplitGoalSize = 3
msgPremise (ActionG _ fa) = do (UpK, m) <- kFactView fa; return m
msgPremise _ = Nothing
-- Putting the goals together like this ranks them by goal number
-- within the same priority class, so one type of goal doesn't always win
-- (assuming the same usefulness)
isHighPriorityGoal goal = (isKnowsFirstNameGoal goal)
|| (isFirstProtoFact goal)
|| (isChainGoal goal)
|| (isFreshKnowsGoal goal)
isMedPriorityGoal goaltuple = (isStandardActionGoal $ fst goaltuple)
|| (isDisjGoal $ fst goaltuple)
|| (isPrivateKnowsGoal $ fst goaltuple)
|| (isSplitGoalSmall $ fst goaltuple)
|| (isMsgOneCaseGoal $ fst goaltuple)
|| (isNonLoopBreakerProtoFactGoal goaltuple)
isLowPriorityGoal goaltuple = (isDoubleExpGoal $ fst goaltuple)
|| (isSignatureGoal $ fst goaltuple)
|| (isProtoFactGoal goaltuple)
isNonLoopBreakerProtoFactGoal (PremiseG _ fa, (_, Useful)) = not (isKFact fa)
isNonLoopBreakerProtoFactGoal _ = False
isProtoFactGoal (PremiseG _ fa, (_, _)) = not (isKFact fa)
isProtoFactGoal _ = False
-- Detect 'I_' (immediate) fact and term prefix for heuristics
isImmediateGoal (PremiseG _ (Fact (ProtoFact _ ('I':'_':_) _) _)) = True
isImmediateGoal (ActionG _ (Fact (ProtoFact _ ('I':'_':_) _) _)) = True
isImmediateGoal goal = isKnowsImmediateNameGoal goal
-- Detect 'F_' (first) fact prefix for heuristics
isFirstProtoFact (PremiseG _ (Fact (ProtoFact _ ('F':'_':_) _) _)) = True
isFirstProtoFact (ActionG _ (Fact (ProtoFact _ ('F':'_':_) _) _)) = True
isFirstProtoFact _ = False
-- Detect 'L_' (last) fact prefix for heuristics
isNonLastProtoFact (PremiseG _ (Fact (ProtoFact _ ('L':'_':_) _) _)) = False
isNonLastProtoFact (ActionG _ (Fact (ProtoFact _ ('L':'_':_) _) _)) = False
isNonLastProtoFact _ = True
isLastName lv = isPrefixOf "L_" (lvarName lv)
isFirstName lv = isPrefixOf "F_" (lvarName lv)
isImmediateName lv = isPrefixOf "I_" (lvarName lv)
isNotKnowsLastNameGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | ((lvarSort lv == LSortFresh) && isLastName lv)-> False
_ -> True
isKnowsFirstNameGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | ((lvarSort lv == LSortFresh) && isFirstName lv)-> True
_ -> False
isKnowsImmediateNameGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | ((lvarSort lv == LSortFresh) && isImmediateName lv)-> True
_ -> False
isFreshKnowsGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | (lvarSort lv == LSortFresh) -> True
_ -> False
isMsgOneCaseGoal goal = case msgPremise goal of
Just (viewTerm -> FApp o _) | o `elem` oneCaseOnly -> True
_ -> False
isPrivateKnowsGoal goal = case msgPremise goal of
Just t -> isPrivateFunction t
_ -> False
isSignatureGoal goal = case msgPremise goal of
Just (viewTerm -> FApp (NoEq (f, _)) _) | (BC.unpack f) == "sign" -> True
_ -> False
isDoubleExpGoal goal = case msgPremise goal of
Just (viewTerm2 -> FExp _ (viewTerm2 -> FMult _)) -> True
_ -> False
-- Be conservative on splits that don't exist.
isSplitGoalSmall (SplitG sid) =
maybe False (<= smallSplitGoalSize) $ splitSize (L.get sEqStore sys) sid
isSplitGoalSmall _ = False
isNoLargeSplitGoal goal@(SplitG _) = isSplitGoalSmall goal
isNoLargeSplitGoal _ = True
-- | @sortDecisionTree xs ps@ returns a reordering of @xs@
-- such that the sublist satisfying @ps!!0@ occurs first,
-- then the sublist satisfying @ps!!1@, and so on.
sortDecisionTree :: [a -> Bool] -> [a] -> [a]
sortDecisionTree [] xs = xs
sortDecisionTree (p:ps) xs = sat ++ sortDecisionTree ps nonsat
where (sat, nonsat) = partition p xs
-- | A ranking function tuned for the automatic verification of
-- classical security protocols that exhibit a well-founded protocol premise
-- fact flow. | 6,733 | injRanking ctxt allowLoopBreakers sys =
(sortOnUsefulness . unmark . sortDecisionTree [notSolveLast] . sortDecisionTree solveFirst . goalNrRanking)
where
oneCaseOnly = catMaybes . map getMsgOneCase . L.get pcSources $ ctxt
getMsgOneCase cd = case msgPremise (L.get cdGoal cd) of
Just (viewTerm -> FApp o _)
| length (getDisj (L.get cdCases cd)) == 1 -> Just o
_ -> Nothing
sortOnUsefulness = sortOn (tagUsefulness . snd . snd)
tagUsefulness Useful = 0 :: Int
tagUsefulness ProbablyConstructible = 1
tagUsefulness LoopBreaker = 1
tagUsefulness CurrentlyDeducible = 2
unmark | allowLoopBreakers = map unmarkPremiseG
| otherwise = id
unmarkPremiseG (goal@(PremiseG _ _), (nr, _)) = (goal, (nr, Useful))
unmarkPremiseG annGoal = annGoal
-- move the Last proto facts (L_) and large splits to the end by
-- putting all goals that shouldn't be solved last in front
notSolveLast goaltuple = (isNoLargeSplitGoal $ fst goaltuple)
&& (isNonLastProtoFact $ fst goaltuple)
&& (isNotKnowsLastNameGoal $ fst goaltuple)
solveFirst =
[ isImmediateGoal . fst -- Goals with the I_ prefix
, isHighPriorityGoal . fst -- Goals with the F_ prefix, by goal number
, isMedPriorityGoal -- Various important goals, by goal number
, isLowPriorityGoal ]
-- move the rest (mostly more expensive KU-goals) before expensive
-- equation splits
smallSplitGoalSize = 3
msgPremise (ActionG _ fa) = do (UpK, m) <- kFactView fa; return m
msgPremise _ = Nothing
-- Putting the goals together like this ranks them by goal number
-- within the same priority class, so one type of goal doesn't always win
-- (assuming the same usefulness)
isHighPriorityGoal goal = (isKnowsFirstNameGoal goal)
|| (isFirstProtoFact goal)
|| (isChainGoal goal)
|| (isFreshKnowsGoal goal)
isMedPriorityGoal goaltuple = (isStandardActionGoal $ fst goaltuple)
|| (isDisjGoal $ fst goaltuple)
|| (isPrivateKnowsGoal $ fst goaltuple)
|| (isSplitGoalSmall $ fst goaltuple)
|| (isMsgOneCaseGoal $ fst goaltuple)
|| (isNonLoopBreakerProtoFactGoal goaltuple)
isLowPriorityGoal goaltuple = (isDoubleExpGoal $ fst goaltuple)
|| (isSignatureGoal $ fst goaltuple)
|| (isProtoFactGoal goaltuple)
isNonLoopBreakerProtoFactGoal (PremiseG _ fa, (_, Useful)) = not (isKFact fa)
isNonLoopBreakerProtoFactGoal _ = False
isProtoFactGoal (PremiseG _ fa, (_, _)) = not (isKFact fa)
isProtoFactGoal _ = False
-- Detect 'I_' (immediate) fact and term prefix for heuristics
isImmediateGoal (PremiseG _ (Fact (ProtoFact _ ('I':'_':_) _) _)) = True
isImmediateGoal (ActionG _ (Fact (ProtoFact _ ('I':'_':_) _) _)) = True
isImmediateGoal goal = isKnowsImmediateNameGoal goal
-- Detect 'F_' (first) fact prefix for heuristics
isFirstProtoFact (PremiseG _ (Fact (ProtoFact _ ('F':'_':_) _) _)) = True
isFirstProtoFact (ActionG _ (Fact (ProtoFact _ ('F':'_':_) _) _)) = True
isFirstProtoFact _ = False
-- Detect 'L_' (last) fact prefix for heuristics
isNonLastProtoFact (PremiseG _ (Fact (ProtoFact _ ('L':'_':_) _) _)) = False
isNonLastProtoFact (ActionG _ (Fact (ProtoFact _ ('L':'_':_) _) _)) = False
isNonLastProtoFact _ = True
isLastName lv = isPrefixOf "L_" (lvarName lv)
isFirstName lv = isPrefixOf "F_" (lvarName lv)
isImmediateName lv = isPrefixOf "I_" (lvarName lv)
isNotKnowsLastNameGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | ((lvarSort lv == LSortFresh) && isLastName lv)-> False
_ -> True
isKnowsFirstNameGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | ((lvarSort lv == LSortFresh) && isFirstName lv)-> True
_ -> False
isKnowsImmediateNameGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | ((lvarSort lv == LSortFresh) && isImmediateName lv)-> True
_ -> False
isFreshKnowsGoal goal = case msgPremise goal of
Just (viewTerm -> Lit (Var lv)) | (lvarSort lv == LSortFresh) -> True
_ -> False
isMsgOneCaseGoal goal = case msgPremise goal of
Just (viewTerm -> FApp o _) | o `elem` oneCaseOnly -> True
_ -> False
isPrivateKnowsGoal goal = case msgPremise goal of
Just t -> isPrivateFunction t
_ -> False
isSignatureGoal goal = case msgPremise goal of
Just (viewTerm -> FApp (NoEq (f, _)) _) | (BC.unpack f) == "sign" -> True
_ -> False
isDoubleExpGoal goal = case msgPremise goal of
Just (viewTerm2 -> FExp _ (viewTerm2 -> FMult _)) -> True
_ -> False
-- Be conservative on splits that don't exist.
isSplitGoalSmall (SplitG sid) =
maybe False (<= smallSplitGoalSize) $ splitSize (L.get sEqStore sys) sid
isSplitGoalSmall _ = False
isNoLargeSplitGoal goal@(SplitG _) = isSplitGoalSmall goal
isNoLargeSplitGoal _ = True
-- | @sortDecisionTree xs ps@ returns a reordering of @xs@
-- such that the sublist satisfying @ps!!0@ occurs first,
-- then the sublist satisfying @ps!!1@, and so on.
sortDecisionTree :: [a -> Bool] -> [a] -> [a]
sortDecisionTree [] xs = xs
sortDecisionTree (p:ps) xs = sat ++ sortDecisionTree ps nonsat
where (sat, nonsat) = partition p xs
-- | A ranking function tuned for the automatic verification of
-- classical security protocols that exhibit a well-founded protocol premise
-- fact flow. | 6,614 | false | true | 0 | 17 | 2,426 | 1,709 | 861 | 848 | null | null |
sbidin/sdl2-ttf | src/SDL/Font.hs | mit | cStringToText :: MonadIO m => CString -> m Text
cStringToText = fmap decodeUtf8 . liftIO . unsafePackCString | 108 | cStringToText :: MonadIO m => CString -> m Text
cStringToText = fmap decodeUtf8 . liftIO . unsafePackCString | 108 | cStringToText = fmap decodeUtf8 . liftIO . unsafePackCString | 60 | false | true | 0 | 8 | 16 | 42 | 18 | 24 | null | null |
charleso/haskell-in-haste | src/Chat/Bot/Misc/Cipher.hs | bsd-3-clause | alphUpper :: [Char]
alphUpper = ['A'..'Z'] | 42 | alphUpper :: [Char]
alphUpper = ['A'..'Z'] | 42 | alphUpper = ['A'..'Z'] | 22 | false | true | 0 | 7 | 5 | 26 | 12 | 14 | null | null |
markflorisson/hpack | testrepo/bytestring-0.9.1.9/Data/ByteString/Char8.hs | bsd-3-clause | -- | 'break' @p@ is equivalent to @'span' ('not' . p)@.
break :: (Char -> Bool) -> ByteString -> (ByteString, ByteString)
break f = B.break (f . w2c) | 149 | break :: (Char -> Bool) -> ByteString -> (ByteString, ByteString)
break f = B.break (f . w2c) | 93 | break f = B.break (f . w2c) | 27 | true | true | 0 | 9 | 27 | 54 | 27 | 27 | null | null |
mightybyte/reflex | src/Reflex/Spider/Internal.hs | bsd-3-clause | recalculateCoincidenceHeight :: CoincidenceSubscribed a -> IO ()
recalculateCoincidenceHeight subscribed = do
oldHeight <- readIORef $ coincidenceSubscribedHeight subscribed
when (oldHeight == invalidHeight) $ do
height <- calculateCoincidenceHeight subscribed
when (height /= invalidHeight) $ do
writeIORef (coincidenceSubscribedHeight subscribed) height
mapM_ recalculateSubscriberHeight =<< readIORef (coincidenceSubscribedSubscribers subscribed) --TODO: This should probably be mandatory, just like with the merge and switch ones | 557 | recalculateCoincidenceHeight :: CoincidenceSubscribed a -> IO ()
recalculateCoincidenceHeight subscribed = do
oldHeight <- readIORef $ coincidenceSubscribedHeight subscribed
when (oldHeight == invalidHeight) $ do
height <- calculateCoincidenceHeight subscribed
when (height /= invalidHeight) $ do
writeIORef (coincidenceSubscribedHeight subscribed) height
mapM_ recalculateSubscriberHeight =<< readIORef (coincidenceSubscribedSubscribers subscribed) --TODO: This should probably be mandatory, just like with the merge and switch ones | 557 | recalculateCoincidenceHeight subscribed = do
oldHeight <- readIORef $ coincidenceSubscribedHeight subscribed
when (oldHeight == invalidHeight) $ do
height <- calculateCoincidenceHeight subscribed
when (height /= invalidHeight) $ do
writeIORef (coincidenceSubscribedHeight subscribed) height
mapM_ recalculateSubscriberHeight =<< readIORef (coincidenceSubscribedSubscribers subscribed) --TODO: This should probably be mandatory, just like with the merge and switch ones | 492 | false | true | 0 | 16 | 80 | 118 | 53 | 65 | null | null |
supki/pakej | src/Pakej/Widget/Memory.hs | bsd-3-clause | -- | Generic memory metadata lookup
lookup :: Num a => Text -> Query a
lookup k = fmap fromIntegral . HashMap.lookup k . unMem | 126 | lookup :: Num a => Text -> Query a
lookup k = fmap fromIntegral . HashMap.lookup k . unMem | 90 | lookup k = fmap fromIntegral . HashMap.lookup k . unMem | 55 | true | true | 0 | 8 | 24 | 45 | 21 | 24 | null | null |
kairne/repa-lts | Data/Array/Repa/Arbitrary.hs | bsd-3-clause | -- | Property tested for quadruple of unboxed random arrays with a given shape.
forAll4VShaped sh = forAll4 $ arbitraryVShaped sh | 129 | forAll4VShaped sh = forAll4 $ arbitraryVShaped sh | 49 | forAll4VShaped sh = forAll4 $ arbitraryVShaped sh | 49 | true | false | 0 | 6 | 20 | 17 | 8 | 9 | null | null |
elieux/ghc | compiler/basicTypes/IdInfo.hs | bsd-3-clause | ruleInfoRules :: RuleInfo -> [CoreRule]
ruleInfoRules (RuleInfo rules _) = rules | 80 | ruleInfoRules :: RuleInfo -> [CoreRule]
ruleInfoRules (RuleInfo rules _) = rules | 80 | ruleInfoRules (RuleInfo rules _) = rules | 40 | false | true | 0 | 7 | 10 | 29 | 15 | 14 | null | null |
mwu-tow/cuda | Foreign/CUDA/Internal/C2HS.hs | bsd-3-clause | -- Tests whether the given bit mask is contained in the given bit pattern
-- (i.e., all bits set in the mask are also set in the pattern).
--
containsBitMask :: (Num a, Bits a, Enum b) => a -> b -> Bool
bits `containsBitMask` bm = let bm' = fromIntegral . fromEnum $ bm
in
bm' .&. bits == bm' | 348 | containsBitMask :: (Num a, Bits a, Enum b) => a -> b -> Bool
bits `containsBitMask` bm = let bm' = fromIntegral . fromEnum $ bm
in
bm' .&. bits == bm' | 206 | bits `containsBitMask` bm = let bm' = fromIntegral . fromEnum $ bm
in
bm' .&. bits == bm' | 145 | true | true | 0 | 10 | 116 | 85 | 43 | 42 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | coercibleClass :: Class
coercibleClass = mkClass (tyConTyVars coercibleTyCon) [] [] [] [] [] (mkAnd []) coercibleTyCon | 118 | coercibleClass :: Class
coercibleClass = mkClass (tyConTyVars coercibleTyCon) [] [] [] [] [] (mkAnd []) coercibleTyCon | 118 | coercibleClass = mkClass (tyConTyVars coercibleTyCon) [] [] [] [] [] (mkAnd []) coercibleTyCon | 94 | false | true | 0 | 8 | 15 | 59 | 27 | 32 | null | null |
ghc-android/ghc | compiler/utils/Digraph.hs | bsd-3-clause | componentsG :: Graph node -> [[node]]
componentsG graph = map (map (gr_vertex_to_node graph) . flatten)
$ components (gr_int_graph graph) | 155 | componentsG :: Graph node -> [[node]]
componentsG graph = map (map (gr_vertex_to_node graph) . flatten)
$ components (gr_int_graph graph) | 155 | componentsG graph = map (map (gr_vertex_to_node graph) . flatten)
$ components (gr_int_graph graph) | 117 | false | true | 2 | 9 | 36 | 66 | 30 | 36 | null | null |
wincent/docvim | lib/Text/Docvim/Printer/Vim.hs | mit | sanitize :: Char -> Char
sanitize x = if isSpace x then '-' else x | 66 | sanitize :: Char -> Char
sanitize x = if isSpace x then '-' else x | 66 | sanitize x = if isSpace x then '-' else x | 41 | false | true | 0 | 7 | 14 | 35 | 16 | 19 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 27436 = 238 | 31 | getValueFromProduct 27436 = 238 | 31 | getValueFromProduct 27436 = 238 | 31 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
beni55/binary | src/Data/Binary/Put.hs | bsd-3-clause | -- | /O(1)./ Write a Word16 in native host order and host endianness.
-- For portability issues see @putWordhost@.
putWord16host :: Word16 -> Put
putWord16host = tell . B.putWord16host | 196 | putWord16host :: Word16 -> Put
putWord16host = tell . B.putWord16host | 81 | putWord16host = tell . B.putWord16host | 44 | true | true | 0 | 6 | 40 | 23 | 13 | 10 | null | null |
svalaskevicius/hob | test/Hob/Command/ReplaceTextSpec.hs | gpl-3.0 | main :: IO ()
main = hspec spec | 31 | main :: IO ()
main = hspec spec | 31 | main = hspec spec | 17 | false | true | 0 | 7 | 7 | 25 | 10 | 15 | null | null |
ownclo/jpeg-on-steroids | vendor/Haskell/bitmap-0.0.2/Data/Bitmap/Internal.hs | bsd-3-clause | itmapComponentSizeInBytes :: (BitmapClass bitmap, PixelComponent t) => bitmap t -> Int
bitmapComponentSizeInBytes bm = sizeOf (bitmapUndefined bm) | 147 | bitmapComponentSizeInBytes :: (BitmapClass bitmap, PixelComponent t) => bitmap t -> Int
bitmapComponentSizeInBytes bm = sizeOf (bitmapUndefined bm) | 147 | bitmapComponentSizeInBytes bm = sizeOf (bitmapUndefined bm) | 59 | false | true | 0 | 7 | 17 | 45 | 22 | 23 | null | null |
myfreeweb/microformats2-parser | library/Data/Microformats2/Parser/HtmlUtil.hs | unlicense | deduplicateElements ∷ [Element] → [Element]
deduplicateElements es = filter (not . isNested) es
where isNested e = any (\e' → e `elem` filter (/= e') (e' ^.. cosmos)) es
-- not the fastest function I guess... | 218 | deduplicateElements ∷ [Element] → [Element]
deduplicateElements es = filter (not . isNested) es
where isNested e = any (\e' → e `elem` filter (/= e') (e' ^.. cosmos)) es
-- not the fastest function I guess... | 218 | deduplicateElements es = filter (not . isNested) es
where isNested e = any (\e' → e `elem` filter (/= e') (e' ^.. cosmos)) es
-- not the fastest function I guess... | 174 | false | true | 0 | 11 | 45 | 82 | 45 | 37 | null | null |
x-y-z/cabal | Cabal/Distribution/Simple/GHC.hs | bsd-3-clause | getLibDir' :: Verbosity -> ConfiguredProgram -> IO FilePath
getLibDir' verbosity ghcProg =
dropWhileEndLE isSpace `fmap`
rawSystemProgramStdout verbosity ghcProg ["--print-libdir"] | 189 | getLibDir' :: Verbosity -> ConfiguredProgram -> IO FilePath
getLibDir' verbosity ghcProg =
dropWhileEndLE isSpace `fmap`
rawSystemProgramStdout verbosity ghcProg ["--print-libdir"] | 189 | getLibDir' verbosity ghcProg =
dropWhileEndLE isSpace `fmap`
rawSystemProgramStdout verbosity ghcProg ["--print-libdir"] | 129 | false | true | 0 | 7 | 27 | 46 | 23 | 23 | null | null |
egison/egison | hs-src/Language/Egison/Primitives/IO.hs | mit | flushStdout :: String -> PrimitiveFunc
flushStdout = noArg $ return $ makeIO' $ liftIO $ hFlush stdout | 102 | flushStdout :: String -> PrimitiveFunc
flushStdout = noArg $ return $ makeIO' $ liftIO $ hFlush stdout | 102 | flushStdout = noArg $ return $ makeIO' $ liftIO $ hFlush stdout | 63 | false | true | 0 | 8 | 16 | 34 | 17 | 17 | null | null |
ecaustin/haskhol-haskell | examples/List/List.hs | bsd-2-clause | myapp (x:xs) ys = x : myapp xs ys | 33 | myapp (x:xs) ys = x : myapp xs ys | 33 | myapp (x:xs) ys = x : myapp xs ys | 33 | false | false | 1 | 8 | 8 | 30 | 13 | 17 | null | null |
bvdelft/parac2 | src/Language/Java/Paragon/TypeCheck/Monad/CodeState.hs | bsd-3-clause | mergeInstances :: InstanceMap -> InstanceMap -> TcDeclM InstanceMap
mergeInstances m1 m2 = do --mergeGeneric mergeIInfos
let newKeys = Map.keys m1 `intersect` Map.keys m2
oldVals = map (\k -> (k, fromJust (Map.lookup k m1), fromJust (Map.lookup k m2))) newKeys
newKeyVals <- mapM mergeIInfos oldVals
return $ Map.fromList $ catMaybes newKeyVals
where mergeIInfos :: (B.ByteString, InstanceInfo, InstanceInfo) -> TcDeclM (Maybe (B.ByteString, InstanceInfo))
mergeIInfos (k,ii1,ii2) = do
if iType ii1 /= iType ii2
then return Nothing
else do
aid <- mergeIa (iActorId ii1) (iActorId ii2)
as <- mergeIas (iImplActorArgs ii1) (iImplActorArgs ii2)
newMems <- mergeVarMaps (iMembers ii1) (iMembers ii2)
newNull <- mergeNullTypes (iNull ii1) (iNull ii2)
return $ Just (k, II
(iType ii1)
(iStable ii1)
(iFresh ii1 && iFresh ii2)
aid as newMems newNull)
mergeIas :: [TypedActorIdSpec] -> [TypedActorIdSpec] -> TcDeclM [TypedActorIdSpec]
mergeIas ias1 ias2 = zipWithM mergeIa ias1 ias2
mergeIa :: TypedActorIdSpec -> TypedActorIdSpec -> TcDeclM TypedActorIdSpec
mergeIa ai1 ai2
| ai1 == ai2 = return ai1
mergeIa (TypedActorIdSpec rt (ConcreteActorId (Instance n _))) _
= TypedActorIdSpec rt . ConcreteActorId <$> newInstance n
mergeIa _ (TypedActorIdSpec rt (ConcreteActorId (Instance n _)))
= TypedActorIdSpec rt . ConcreteActorId <$> newInstance n
mergeIa (TypedActorIdSpec rt (ConcreteActorId (Unknown _))) _
= TypedActorIdSpec rt . ConcreteActorId <$> newUnknown
mergeIa ai _ = panic (codeStateModule ++ ".mergeIas")
$ "Instance has non-instance implicit argument: " ++ show ai
mergeNullTypes :: NullType -> NullType -> TcDeclM NullType
mergeNullTypes nt1 nt2 = return (joinNT nt1 nt2) | 2,277 | mergeInstances :: InstanceMap -> InstanceMap -> TcDeclM InstanceMap
mergeInstances m1 m2 = do --mergeGeneric mergeIInfos
let newKeys = Map.keys m1 `intersect` Map.keys m2
oldVals = map (\k -> (k, fromJust (Map.lookup k m1), fromJust (Map.lookup k m2))) newKeys
newKeyVals <- mapM mergeIInfos oldVals
return $ Map.fromList $ catMaybes newKeyVals
where mergeIInfos :: (B.ByteString, InstanceInfo, InstanceInfo) -> TcDeclM (Maybe (B.ByteString, InstanceInfo))
mergeIInfos (k,ii1,ii2) = do
if iType ii1 /= iType ii2
then return Nothing
else do
aid <- mergeIa (iActorId ii1) (iActorId ii2)
as <- mergeIas (iImplActorArgs ii1) (iImplActorArgs ii2)
newMems <- mergeVarMaps (iMembers ii1) (iMembers ii2)
newNull <- mergeNullTypes (iNull ii1) (iNull ii2)
return $ Just (k, II
(iType ii1)
(iStable ii1)
(iFresh ii1 && iFresh ii2)
aid as newMems newNull)
mergeIas :: [TypedActorIdSpec] -> [TypedActorIdSpec] -> TcDeclM [TypedActorIdSpec]
mergeIas ias1 ias2 = zipWithM mergeIa ias1 ias2
mergeIa :: TypedActorIdSpec -> TypedActorIdSpec -> TcDeclM TypedActorIdSpec
mergeIa ai1 ai2
| ai1 == ai2 = return ai1
mergeIa (TypedActorIdSpec rt (ConcreteActorId (Instance n _))) _
= TypedActorIdSpec rt . ConcreteActorId <$> newInstance n
mergeIa _ (TypedActorIdSpec rt (ConcreteActorId (Instance n _)))
= TypedActorIdSpec rt . ConcreteActorId <$> newInstance n
mergeIa (TypedActorIdSpec rt (ConcreteActorId (Unknown _))) _
= TypedActorIdSpec rt . ConcreteActorId <$> newUnknown
mergeIa ai _ = panic (codeStateModule ++ ".mergeIas")
$ "Instance has non-instance implicit argument: " ++ show ai
mergeNullTypes :: NullType -> NullType -> TcDeclM NullType
mergeNullTypes nt1 nt2 = return (joinNT nt1 nt2) | 2,276 | mergeInstances m1 m2 = do --mergeGeneric mergeIInfos
let newKeys = Map.keys m1 `intersect` Map.keys m2
oldVals = map (\k -> (k, fromJust (Map.lookup k m1), fromJust (Map.lookup k m2))) newKeys
newKeyVals <- mapM mergeIInfos oldVals
return $ Map.fromList $ catMaybes newKeyVals
where mergeIInfos :: (B.ByteString, InstanceInfo, InstanceInfo) -> TcDeclM (Maybe (B.ByteString, InstanceInfo))
mergeIInfos (k,ii1,ii2) = do
if iType ii1 /= iType ii2
then return Nothing
else do
aid <- mergeIa (iActorId ii1) (iActorId ii2)
as <- mergeIas (iImplActorArgs ii1) (iImplActorArgs ii2)
newMems <- mergeVarMaps (iMembers ii1) (iMembers ii2)
newNull <- mergeNullTypes (iNull ii1) (iNull ii2)
return $ Just (k, II
(iType ii1)
(iStable ii1)
(iFresh ii1 && iFresh ii2)
aid as newMems newNull)
mergeIas :: [TypedActorIdSpec] -> [TypedActorIdSpec] -> TcDeclM [TypedActorIdSpec]
mergeIas ias1 ias2 = zipWithM mergeIa ias1 ias2
mergeIa :: TypedActorIdSpec -> TypedActorIdSpec -> TcDeclM TypedActorIdSpec
mergeIa ai1 ai2
| ai1 == ai2 = return ai1
mergeIa (TypedActorIdSpec rt (ConcreteActorId (Instance n _))) _
= TypedActorIdSpec rt . ConcreteActorId <$> newInstance n
mergeIa _ (TypedActorIdSpec rt (ConcreteActorId (Instance n _)))
= TypedActorIdSpec rt . ConcreteActorId <$> newInstance n
mergeIa (TypedActorIdSpec rt (ConcreteActorId (Unknown _))) _
= TypedActorIdSpec rt . ConcreteActorId <$> newUnknown
mergeIa ai _ = panic (codeStateModule ++ ".mergeIas")
$ "Instance has non-instance implicit argument: " ++ show ai
mergeNullTypes :: NullType -> NullType -> TcDeclM NullType
mergeNullTypes nt1 nt2 = return (joinNT nt1 nt2) | 2,208 | false | true | 0 | 18 | 833 | 648 | 317 | 331 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_2 (51#) = happyGoto action_20 | 36 | action_2 (51#) = happyGoto action_20 | 36 | action_2 (51#) = happyGoto action_20 | 36 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
taruti/network-fancy | test.hs | bsd-3-clause | logLock = unsafePerformIO $ newMVar () | 38 | logLock = unsafePerformIO $ newMVar () | 38 | logLock = unsafePerformIO $ newMVar () | 38 | false | false | 0 | 7 | 5 | 15 | 7 | 8 | null | null |
eiji-a/aya | src/Aya/Scene-balls_in_room.hs | bsd-3-clause | lp1 = Primitive (fromJust $ initPolygon lpt1 lpt2 lpt3) mplight | 63 | lp1 = Primitive (fromJust $ initPolygon lpt1 lpt2 lpt3) mplight | 63 | lp1 = Primitive (fromJust $ initPolygon lpt1 lpt2 lpt3) mplight | 63 | false | false | 1 | 8 | 9 | 28 | 12 | 16 | null | null |
DaMSL/K3 | src/Language/K3/Runtime/Engine.hs | apache-2.0 | flushEBuffer :: IOHandle v -> EndpointBuffer v -> IO (EndpointBuffer v, Maybe EndpointNotification)
flushEBuffer h = modifyEBuffer $ flushEBContents h | 150 | flushEBuffer :: IOHandle v -> EndpointBuffer v -> IO (EndpointBuffer v, Maybe EndpointNotification)
flushEBuffer h = modifyEBuffer $ flushEBContents h | 150 | flushEBuffer h = modifyEBuffer $ flushEBContents h | 50 | false | true | 0 | 9 | 19 | 50 | 23 | 27 | null | null |
sgillespie/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | word64ToIntegerName = varQual gHC_INTEGER_TYPE (fsLit "word64ToInteger") word64ToIntegerIdKey | 97 | word64ToIntegerName = varQual gHC_INTEGER_TYPE (fsLit "word64ToInteger") word64ToIntegerIdKey | 97 | word64ToIntegerName = varQual gHC_INTEGER_TYPE (fsLit "word64ToInteger") word64ToIntegerIdKey | 97 | false | false | 0 | 7 | 10 | 19 | 9 | 10 | null | null |
avieth/postgresql-simple | src/Database/PostgreSQL/Simple/BuiltinTypes.hs | bsd-3-clause | point :: ByteString
point = "point" | 35 | point :: ByteString
point = "point" | 35 | point = "point" | 15 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
Vlix/facebookmessenger | test/UnitTest/RequestParse/MessageRequest.hs | mit | textRequestMaxVal :: Value
textRequestMaxVal = $$(decodeFile "test/json/request/text_request_maximal.json") | 107 | textRequestMaxVal :: Value
textRequestMaxVal = $$(decodeFile "test/json/request/text_request_maximal.json") | 107 | textRequestMaxVal = $$(decodeFile "test/json/request/text_request_maximal.json") | 80 | false | true | 0 | 7 | 6 | 18 | 9 | 9 | null | null |
andyarvanitis/Idris-dev | src/Idris/Completion.hs | bsd-3-clause | completeColour :: CompletionFunc Idris
completeColour (prev, next) = case words (reverse prev) of
[c] | isCmd c -> do cmpls <- completeColourOpt next
return (reverse $ c ++ " ", cmpls)
[c, o] | o `elem` opts -> let correct = (c ++ " " ++ o) in
return (reverse correct, [simpleCompletion ""])
| o `elem` colourTypes -> completeColourFormat (prev, next)
| otherwise -> let cmpls = completeWith (opts ++ colourTypes) o in
let sofar = (c ++ " ") in
return (reverse sofar, cmpls)
cmd@(c:o:_) | isCmd c && o `elem` colourTypes ->
completeColourFormat (prev, next)
_ -> noCompletion (prev, next)
where completeColourOpt :: String -> Idris [Completion]
completeColourOpt = return . completeWith (opts ++ colourTypes)
opts = ["on", "off"]
colourTypes = map (map toLower . reverse . drop 6 . reverse . show) $
enumFromTo (minBound::ColourType) maxBound
isCmd ":colour" = True
isCmd ":color" = True
isCmd _ = False
colours = map (map toLower . show) $ enumFromTo (minBound::Color) maxBound
formats = ["vivid", "dull", "underline", "nounderline", "bold", "nobold", "italic", "noitalic"]
completeColourFormat = let getCmpl = completeWith (colours ++ formats) in
completeWord Nothing " \t" (return . getCmpl)
-- The FIXMEs are Issue #1768 on the issue tracker.
-- https://github.com/idris-lang/Idris-dev/issues/1768
-- | Get the completion function for a particular command | 1,988 | completeColour :: CompletionFunc Idris
completeColour (prev, next) = case words (reverse prev) of
[c] | isCmd c -> do cmpls <- completeColourOpt next
return (reverse $ c ++ " ", cmpls)
[c, o] | o `elem` opts -> let correct = (c ++ " " ++ o) in
return (reverse correct, [simpleCompletion ""])
| o `elem` colourTypes -> completeColourFormat (prev, next)
| otherwise -> let cmpls = completeWith (opts ++ colourTypes) o in
let sofar = (c ++ " ") in
return (reverse sofar, cmpls)
cmd@(c:o:_) | isCmd c && o `elem` colourTypes ->
completeColourFormat (prev, next)
_ -> noCompletion (prev, next)
where completeColourOpt :: String -> Idris [Completion]
completeColourOpt = return . completeWith (opts ++ colourTypes)
opts = ["on", "off"]
colourTypes = map (map toLower . reverse . drop 6 . reverse . show) $
enumFromTo (minBound::ColourType) maxBound
isCmd ":colour" = True
isCmd ":color" = True
isCmd _ = False
colours = map (map toLower . show) $ enumFromTo (minBound::Color) maxBound
formats = ["vivid", "dull", "underline", "nounderline", "bold", "nobold", "italic", "noitalic"]
completeColourFormat = let getCmpl = completeWith (colours ++ formats) in
completeWord Nothing " \t" (return . getCmpl)
-- The FIXMEs are Issue #1768 on the issue tracker.
-- https://github.com/idris-lang/Idris-dev/issues/1768
-- | Get the completion function for a particular command | 1,988 | completeColour (prev, next) = case words (reverse prev) of
[c] | isCmd c -> do cmpls <- completeColourOpt next
return (reverse $ c ++ " ", cmpls)
[c, o] | o `elem` opts -> let correct = (c ++ " " ++ o) in
return (reverse correct, [simpleCompletion ""])
| o `elem` colourTypes -> completeColourFormat (prev, next)
| otherwise -> let cmpls = completeWith (opts ++ colourTypes) o in
let sofar = (c ++ " ") in
return (reverse sofar, cmpls)
cmd@(c:o:_) | isCmd c && o `elem` colourTypes ->
completeColourFormat (prev, next)
_ -> noCompletion (prev, next)
where completeColourOpt :: String -> Idris [Completion]
completeColourOpt = return . completeWith (opts ++ colourTypes)
opts = ["on", "off"]
colourTypes = map (map toLower . reverse . drop 6 . reverse . show) $
enumFromTo (minBound::ColourType) maxBound
isCmd ":colour" = True
isCmd ":color" = True
isCmd _ = False
colours = map (map toLower . show) $ enumFromTo (minBound::Color) maxBound
formats = ["vivid", "dull", "underline", "nounderline", "bold", "nobold", "italic", "noitalic"]
completeColourFormat = let getCmpl = completeWith (colours ++ formats) in
completeWord Nothing " \t" (return . getCmpl)
-- The FIXMEs are Issue #1768 on the issue tracker.
-- https://github.com/idris-lang/Idris-dev/issues/1768
-- | Get the completion function for a particular command | 1,949 | false | true | 11 | 17 | 839 | 524 | 270 | 254 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Monobasic.hs | gpl-2.0 | regex_'5cb'28Namespace'29'28'5b'5cs'5d'7c'24'29 = compileRegex True "\\b(Namespace)([\\s]|$)" | 93 | regex_'5cb'28Namespace'29'28'5b'5cs'5d'7c'24'29 = compileRegex True "\\b(Namespace)([\\s]|$)" | 93 | regex_'5cb'28Namespace'29'28'5b'5cs'5d'7c'24'29 = compileRegex True "\\b(Namespace)([\\s]|$)" | 93 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
clinty/Juicy.Pixels | src/Codec/Picture/Gif.hs | bsd-3-clause | graphicControlLabel = 0xF9 | 26 | graphicControlLabel = 0xF9 | 26 | graphicControlLabel = 0xF9 | 26 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
ekmett/transients | benchmarks/wordmap/Simple.hs | bsd-2-clause | -- offset :: Int -> Word16 -> Int
-- offset k w = popCount $ w .&. (unsafeShiftL 1 k - 1)
-- {-# INLINE offset #-}
fork :: Int -> Key -> WordMap v -> Key -> WordMap v -> WordMap v
fork o k n ok on = Node (k .&. unsafeShiftL 0xfffffffffffffff0 o) o (mask k o .|. mask ok o) $ runST $ do
arr <- newSmallArray 2 n
writeSmallArray arr (fromEnum (k < ok)) on
unsafeFreezeSmallArray arr | 387 | fork :: Int -> Key -> WordMap v -> Key -> WordMap v -> WordMap v
fork o k n ok on = Node (k .&. unsafeShiftL 0xfffffffffffffff0 o) o (mask k o .|. mask ok o) $ runST $ do
arr <- newSmallArray 2 n
writeSmallArray arr (fromEnum (k < ok)) on
unsafeFreezeSmallArray arr | 271 | fork o k n ok on = Node (k .&. unsafeShiftL 0xfffffffffffffff0 o) o (mask k o .|. mask ok o) $ runST $ do
arr <- newSmallArray 2 n
writeSmallArray arr (fromEnum (k < ok)) on
unsafeFreezeSmallArray arr | 206 | true | true | 0 | 13 | 88 | 144 | 67 | 77 | null | null |
y-kamiya/functional-algorithm-design | src/Countdown/Countdown2.hs | mit | nearest :: Int -> [(Expr, Value)] -> (Expr, Value)
-- nearest n ts = minimumBy (compare `on` snd) [(e, abs $ v - n) | (e,v) <- ts]
nearest n ((e,v):evs) = if d == 0 then (e,v)
else search n d (e,v) evs
where d = abs (n - v) | 283 | nearest :: Int -> [(Expr, Value)] -> (Expr, Value)
nearest n ((e,v):evs) = if d == 0 then (e,v)
else search n d (e,v) evs
where d = abs (n - v) | 203 | nearest n ((e,v):evs) = if d == 0 then (e,v)
else search n d (e,v) evs
where d = abs (n - v) | 152 | true | true | 0 | 9 | 110 | 103 | 59 | 44 | null | null |
thinkpad20/docx | src/Text/Docx/Docx.hs | mit | -- | Adds the first element as the last subelement of the second.
addSubelem :: Element -> Element -> Element
addSubelem subelem elem = elem {eSubElements = eSubElements elem |> subelem} | 186 | addSubelem :: Element -> Element -> Element
addSubelem subelem elem = elem {eSubElements = eSubElements elem |> subelem} | 120 | addSubelem subelem elem = elem {eSubElements = eSubElements elem |> subelem} | 76 | true | true | 0 | 8 | 30 | 40 | 21 | 19 | null | null |
WraithM/CoreCompiler | src/Core/Lexer.hs | bsd-3-clause | dot = T.dot lexer | 25 | dot = T.dot lexer | 25 | dot = T.dot lexer | 25 | false | false | 0 | 6 | 11 | 11 | 5 | 6 | null | null |
shockkolate/etch | src/Etch/Analysis/Resolution.hs | apache-2.0 | exprAnalysis (CallExpr (Call (_ `As` BuiltinType FunctionBuiltin) (CompoundExpr (PrimaryCompound primary `As` _) `As` _) `As` _) `As` _) = do
builtin <- Function2Builtin <$> typeAnalysis (PrimaryType primary)
pure $ tymap CompoundExpr $ tymap PrimaryCompound (BuiltinPrimary builtin `As` BuiltinType builtin) | 316 | exprAnalysis (CallExpr (Call (_ `As` BuiltinType FunctionBuiltin) (CompoundExpr (PrimaryCompound primary `As` _) `As` _) `As` _) `As` _) = do
builtin <- Function2Builtin <$> typeAnalysis (PrimaryType primary)
pure $ tymap CompoundExpr $ tymap PrimaryCompound (BuiltinPrimary builtin `As` BuiltinType builtin) | 316 | exprAnalysis (CallExpr (Call (_ `As` BuiltinType FunctionBuiltin) (CompoundExpr (PrimaryCompound primary `As` _) `As` _) `As` _) `As` _) = do
builtin <- Function2Builtin <$> typeAnalysis (PrimaryType primary)
pure $ tymap CompoundExpr $ tymap PrimaryCompound (BuiltinPrimary builtin `As` BuiltinType builtin) | 316 | false | false | 0 | 16 | 46 | 126 | 65 | 61 | null | null |
scvalex/landler | Language/Landler/Types.hs | gpl-3.0 | -- | Get the final type of a derivation (i.e. the type in the root of
-- the tree).
getDerivationType :: Derivation -> Type
getDerivationType (Ax _ _ t) = t | 164 | getDerivationType :: Derivation -> Type
getDerivationType (Ax _ _ t) = t | 80 | getDerivationType (Ax _ _ t) = t | 40 | true | true | 0 | 7 | 38 | 30 | 16 | 14 | null | null |
othercriteria/blaze | Blaze.hs | mit | -- Methods for building States
mkDoubleData :: Double -> State
mkDoubleData d = mkNode $ SNode [] (DoubleDatum d) | 114 | mkDoubleData :: Double -> State
mkDoubleData d = mkNode $ SNode [] (DoubleDatum d) | 82 | mkDoubleData d = mkNode $ SNode [] (DoubleDatum d) | 50 | true | true | 0 | 8 | 19 | 36 | 18 | 18 | null | null |
sdiehl/ghc | libraries/ghci/GHCi/RemoteTypes.hs | bsd-3-clause | -- | Make a reference to a local value that we can send remotely.
-- This reference will keep the value that it refers to alive until
-- 'freeRemoteRef' is called.
mkRemoteRef :: a -> IO (RemoteRef a)
mkRemoteRef a = do
sp <- newStablePtr a
return $! RemoteRef (toRemotePtr (castStablePtrToPtr sp))
-- | Convert an HValueRef to an HValue. Should only be used if the HValue
-- originated in this process. | 409 | mkRemoteRef :: a -> IO (RemoteRef a)
mkRemoteRef a = do
sp <- newStablePtr a
return $! RemoteRef (toRemotePtr (castStablePtrToPtr sp))
-- | Convert an HValueRef to an HValue. Should only be used if the HValue
-- originated in this process. | 245 | mkRemoteRef a = do
sp <- newStablePtr a
return $! RemoteRef (toRemotePtr (castStablePtrToPtr sp))
-- | Convert an HValueRef to an HValue. Should only be used if the HValue
-- originated in this process. | 208 | true | true | 0 | 13 | 77 | 69 | 33 | 36 | null | null |
kylcarte/logics | src/Control/Monad/Supply.hs | bsd-3-clause | pop :: Monoid m => (a -> m) -> Int -> Stream a -> (m,Stream a)
pop f = \case
n | n <= 0 -> (,) mempty
n -> \(a :< as) -> first (mappend $ f a) $ pop f (n-1) as | 172 | pop :: Monoid m => (a -> m) -> Int -> Stream a -> (m,Stream a)
pop f = \case
n | n <= 0 -> (,) mempty
n -> \(a :< as) -> first (mappend $ f a) $ pop f (n-1) as | 172 | pop f = \case
n | n <= 0 -> (,) mempty
n -> \(a :< as) -> first (mappend $ f a) $ pop f (n-1) as | 109 | false | true | 2 | 11 | 56 | 125 | 62 | 63 | null | null |
RefactoringTools/HaRe | old/testing/evalMonad/FourierAST.hs | bsd-3-clause | sct :: [Double] -> [Double]
sct xs
=
concat
(splitAtN 20
(map
(\ k ->
(xs_dot (map (cos . ((fromInt k) *)) (thetas n))))
[k | k <- [0 .. n - 1]]))
where
n = length xs
xs_dot = sum . (zipWith (*) xs)
fromInt = fromInteger . toInteger | 366 | sct :: [Double] -> [Double]
sct xs
=
concat
(splitAtN 20
(map
(\ k ->
(xs_dot (map (cos . ((fromInt k) *)) (thetas n))))
[k | k <- [0 .. n - 1]]))
where
n = length xs
xs_dot = sum . (zipWith (*) xs)
fromInt = fromInteger . toInteger | 364 | sct xs
=
concat
(splitAtN 20
(map
(\ k ->
(xs_dot (map (cos . ((fromInt k) *)) (thetas n))))
[k | k <- [0 .. n - 1]]))
where
n = length xs
xs_dot = sum . (zipWith (*) xs)
fromInt = fromInteger . toInteger | 336 | false | true | 2 | 20 | 183 | 151 | 80 | 71 | null | null |
Yuras/hfd | src/OMsg.hs | bsd-3-clause | - | Make binary message
--
-- Format: length (4b) + message id (4b) + message
--
-- All data is little endian
mkBin :: Word32 -> ByteString -> ByteString
mkBin idi msg = BS.concat [l, i, msg]
where
i = mkBinWord32 idi
l = mkBinWord32 $ fromIntegral $ BS.length msg
-- | Convert `Word32` to `ByteString` using little endian encoding
| 339 | mkBin :: Word32 -> ByteString -> ByteString
mkBin idi msg = BS.concat [l, i, msg]
where
i = mkBinWord32 idi
l = mkBinWord32 $ fromIntegral $ BS.length msg
-- | Convert `Word32` to `ByteString` using little endian encoding | 228 | mkBin idi msg = BS.concat [l, i, msg]
where
i = mkBinWord32 idi
l = mkBinWord32 $ fromIntegral $ BS.length msg
-- | Convert `Word32` to `ByteString` using little endian encoding | 184 | true | true | 1 | 8 | 68 | 83 | 43 | 40 | null | null |
alexstachnik/High-Level-C | src/Language/HLC/Quasi/TypeParser.hs | gpl-2.0 | asstToConstraint (AppA className args) =
extTypeToTHType (foldl TyApp (TyCon $ UnQual className) args) | 104 | asstToConstraint (AppA className args) =
extTypeToTHType (foldl TyApp (TyCon $ UnQual className) args) | 104 | asstToConstraint (AppA className args) =
extTypeToTHType (foldl TyApp (TyCon $ UnQual className) args) | 104 | false | false | 0 | 10 | 14 | 40 | 19 | 21 | null | null |
rueshyna/gogol | gogol-monitoring/gen/Network/Google/Monitoring/Types/Product.hs | mpl-2.0 | -- | The metric kind of the time series. When listing time series, this
-- metric kind might be different from the metric kind of the associated
-- metric if this time series is an alignment or reduction of other time
-- series.When creating a time series, this field is optional. If present,
-- it must be the same as the metric kind of the associated metric. If the
-- associated metric\'s descriptor must be auto-created, then this field
-- specifies the metric kind of the new descriptor and must be either GAUGE
-- (the default) or CUMULATIVE.
tsMetricKind :: Lens' TimeSeries (Maybe TimeSeriesMetricKind)
tsMetricKind
= lens _tsMetricKind (\ s a -> s{_tsMetricKind = a}) | 678 | tsMetricKind :: Lens' TimeSeries (Maybe TimeSeriesMetricKind)
tsMetricKind
= lens _tsMetricKind (\ s a -> s{_tsMetricKind = a}) | 129 | tsMetricKind
= lens _tsMetricKind (\ s a -> s{_tsMetricKind = a}) | 67 | true | true | 1 | 9 | 116 | 59 | 32 | 27 | null | null |
siddhanathan/yi | yi-mode-haskell/src/Yi/Syntax/Paren.hs | gpl-2.0 | isNoise _ = True | 16 | isNoise _ = True | 16 | isNoise _ = True | 16 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
johannesgerer/buchhaltung | src/Buchhaltung/Utils.hs | mit | mconcat' :: Monoid t => [t] -> t
mconcat' [] = mempty | 53 | mconcat' :: Monoid t => [t] -> t
mconcat' [] = mempty | 53 | mconcat' [] = mempty | 20 | false | true | 0 | 7 | 11 | 30 | 15 | 15 | null | null |
kadena-io/pact | src/Pact/Native/Decrypt.hs | bsd-3-clause | --Bob's public key, X25519(b, 9):
_bobPK :: IO (ByteString,PublicKey)
_bobPK = _wBsArg _importPK "de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f" | 163 | _bobPK :: IO (ByteString,PublicKey)
_bobPK = _wBsArg _importPK "de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f" | 129 | _bobPK = _wBsArg _importPK "de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f" | 93 | true | true | 0 | 6 | 13 | 26 | 14 | 12 | null | null |
imalsogreg/arte-ephys | arte-spike-viewer/src/System/Arte/SpikeViewer.hs | gpl-3.0 | imToPic :: MutImage -> IO Picture --this function has been <Checked>.
imToPic mutim = do
im <- freezeImage mutim --changes MutableImage to Image
let bString = encodeBitmap im
return $ scale (1) (-1) $ bitmapOfByteString 700 700 (BS.drop (54) $ toStrict bString) False | 273 | imToPic :: MutImage -> IO Picture
imToPic mutim = do
im <- freezeImage mutim --changes MutableImage to Image
let bString = encodeBitmap im
return $ scale (1) (-1) $ bitmapOfByteString 700 700 (BS.drop (54) $ toStrict bString) False | 237 | imToPic mutim = do
im <- freezeImage mutim --changes MutableImage to Image
let bString = encodeBitmap im
return $ scale (1) (-1) $ bitmapOfByteString 700 700 (BS.drop (54) $ toStrict bString) False | 203 | true | true | 0 | 12 | 48 | 96 | 46 | 50 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/topic/monads/wiki-haskell-org_all-about-monads/src/Wiki_haskell_org_all_about_monads.hs | unlicense | {-
------------------------------------------------------------------------------
Part III - Monad Transformers
17 Introduction
Part I : monad concept
Part II : "standard" monads
Need to combine monads.
When one computation is a strict subset of the other, it is possible
to perform the monad computations separately, unless the
sub-computation is performed in a one-way monad.
When computations can't be performed in isolation, then need
monad that combines the features of the two+ monads into single computation.
Combine standard monads via monad transformers.
------------------------------------------------------------------------------
18 Combining monads the hard way
Exercise: combine monads without using transformers.
Why: develop insights into issues.
18.1 Nested Monads
Example of separate monads:
Code available in [[../examples/example19.hs|example19.hs]]
fun :: IO String
fun = do n <- (readLn::IO Int) -- this is an IO monad block
return $ (`runCont` id) $ do -- this is a Cont monad block
str <- callCC $ \exit1 -> do
when (n < 10) (exit1 (show n))
let ns = map digitToInt (show (n `div` 2))
n' <- callCC $ \exit2 -> do
when ((length ns) < 3) (exit2 (length ns))
when ((length ns) < 5) (exit2 n)
when ((length ns) < 7) $ do let ns' = map intToDigit (reverse ns)
exit1 (dropWhile (=='0') ns')
return $ sum ns
return $ "(ns = " ++ (show ns) ++ ") " ++ (show n')
return $ "Answer: " ++ str
18.2 Combined Monads
When nesting pattern (above) cannot be used, do computations within a
monad in which the values are themselves monadic values in another monad. E.g:
- Cont (IO String) : I/O in Continuation monad.
- State (Either Err a)
Example: require additional IO in middle of Continuation monad.
- user specify part of output value when input value satisfies predicate.
Cannot nest, because
- IO depends on part of Continuation compuation
- Continuation depends on the result of IO
Insead, make Continuation use values IO.
What used to be Int/String now IO Int/IO String.
Can't extract values from IO.
Code available in [[../examples/example20.hs|example20.hs]]
-}
toIO :: a -> IO a
toIO = return | 2,326 | toIO :: a -> IO a
toIO = return | 31 | toIO = return | 13 | true | true | 0 | 7 | 555 | 25 | 11 | 14 | null | null |
ekmett/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | mkConInfoTableLabel name c = IdLabel name c ConInfoTable | 63 | mkConInfoTableLabel name c = IdLabel name c ConInfoTable | 63 | mkConInfoTableLabel name c = IdLabel name c ConInfoTable | 63 | false | false | 0 | 5 | 14 | 18 | 8 | 10 | null | null |
ucla-pls/wiretap-tools | src/Wiretap/Data/Program.hs | gpl-3.0 | fromFolder :: FilePath -> IO Program
fromFolder folder = do
fields <- IM.map cleanField <$> intMapFromFile "fields.txt"
instructions <- intMapFromFile "instructions.txt"
methods <- intMapFromFile "methods.txt"
return $ Program
{ _fieldNames = fields
, _instructionNames = instructions
, _instructionFolder = Just $ folder </> "instructions"
, _methodNames = methods
}
where
intMapFromFile f =
IM.fromAscList . zip [0..] . lines <$> readFile (folder </> f)
cleanField = takeWhile (/= ':') . tail . dropWhile (/= '.') | 560 | fromFolder :: FilePath -> IO Program
fromFolder folder = do
fields <- IM.map cleanField <$> intMapFromFile "fields.txt"
instructions <- intMapFromFile "instructions.txt"
methods <- intMapFromFile "methods.txt"
return $ Program
{ _fieldNames = fields
, _instructionNames = instructions
, _instructionFolder = Just $ folder </> "instructions"
, _methodNames = methods
}
where
intMapFromFile f =
IM.fromAscList . zip [0..] . lines <$> readFile (folder </> f)
cleanField = takeWhile (/= ':') . tail . dropWhile (/= '.') | 560 | fromFolder folder = do
fields <- IM.map cleanField <$> intMapFromFile "fields.txt"
instructions <- intMapFromFile "instructions.txt"
methods <- intMapFromFile "methods.txt"
return $ Program
{ _fieldNames = fields
, _instructionNames = instructions
, _instructionFolder = Just $ folder </> "instructions"
, _methodNames = methods
}
where
intMapFromFile f =
IM.fromAscList . zip [0..] . lines <$> readFile (folder </> f)
cleanField = takeWhile (/= ':') . tail . dropWhile (/= '.') | 523 | false | true | 3 | 11 | 119 | 180 | 86 | 94 | null | null |
mrakgr/futhark | src/Futhark/Analysis/ScalExp.hs | bsd-3-clause | expandScalExp look (RelExp relop x) = RelExp relop $ expandScalExp look x | 73 | expandScalExp look (RelExp relop x) = RelExp relop $ expandScalExp look x | 73 | expandScalExp look (RelExp relop x) = RelExp relop $ expandScalExp look x | 73 | false | false | 0 | 7 | 11 | 31 | 14 | 17 | null | null |
AndrewRademacher/hs-amazon-products | src/Amazon/Types/Item.hs | mit | xpItem :: PU [Node] Item
xpItem =
xpWrap (\(a, b, c, d) -> Item a b c (fmap (fmap removeTuple) d))
(\(Item a b c d) -> (a, b, c, (fmap (fmap addTuple) d))) $
xpClean $ xp4Tuple
(xpElemText (nsName "ASIN"))
(xpOption $ xpElemText (nsName "ParentASIN"))
(xpOption $ xpElemNodes (nsName "ItemAttributes") $ xpClean xpAttributes)
(xpOption $ xpElemNodes (nsName "ImageSets") $
xpList $ xpElem (nsName "ImageSet") (xpAttr ("Category") xpId) xpImageSet)
where removeTuple (_,d) = d
addTuple d = ("",d)
---- | 589 | xpItem :: PU [Node] Item
xpItem =
xpWrap (\(a, b, c, d) -> Item a b c (fmap (fmap removeTuple) d))
(\(Item a b c d) -> (a, b, c, (fmap (fmap addTuple) d))) $
xpClean $ xp4Tuple
(xpElemText (nsName "ASIN"))
(xpOption $ xpElemText (nsName "ParentASIN"))
(xpOption $ xpElemNodes (nsName "ItemAttributes") $ xpClean xpAttributes)
(xpOption $ xpElemNodes (nsName "ImageSets") $
xpList $ xpElem (nsName "ImageSet") (xpAttr ("Category") xpId) xpImageSet)
where removeTuple (_,d) = d
addTuple d = ("",d)
---- | 589 | xpItem =
xpWrap (\(a, b, c, d) -> Item a b c (fmap (fmap removeTuple) d))
(\(Item a b c d) -> (a, b, c, (fmap (fmap addTuple) d))) $
xpClean $ xp4Tuple
(xpElemText (nsName "ASIN"))
(xpOption $ xpElemText (nsName "ParentASIN"))
(xpOption $ xpElemNodes (nsName "ItemAttributes") $ xpClean xpAttributes)
(xpOption $ xpElemNodes (nsName "ImageSets") $
xpList $ xpElem (nsName "ImageSet") (xpAttr ("Category") xpId) xpImageSet)
where removeTuple (_,d) = d
addTuple d = ("",d)
---- | 564 | false | true | 0 | 14 | 167 | 260 | 137 | 123 | null | null |
icyfork/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | prop_checkConditionalAndOrs1 = verify checkConditionalAndOrs "[ foo && bar ]" | 77 | prop_checkConditionalAndOrs1 = verify checkConditionalAndOrs "[ foo && bar ]" | 77 | prop_checkConditionalAndOrs1 = verify checkConditionalAndOrs "[ foo && bar ]" | 77 | false | false | 1 | 5 | 8 | 14 | 5 | 9 | null | null |
luigy/stack | src/Stack/Options.hs | bsd-3-clause | globalOptsFromMonoid :: Bool -> GlobalOptsMonoid -> GlobalOpts
globalOptsFromMonoid defaultTerminal GlobalOptsMonoid{..} = GlobalOpts
{ globalReExecVersion = globalMonoidReExecVersion
, globalDockerEntrypoint = globalMonoidDockerEntrypoint
, globalLogLevel = fromMaybe defaultLogLevel globalMonoidLogLevel
, globalConfigMonoid = globalMonoidConfigMonoid
, globalResolver = globalMonoidResolver
, globalCompiler = globalMonoidCompiler
, globalTerminal = fromMaybe defaultTerminal globalMonoidTerminal
, globalStackYaml = globalMonoidStackYaml } | 575 | globalOptsFromMonoid :: Bool -> GlobalOptsMonoid -> GlobalOpts
globalOptsFromMonoid defaultTerminal GlobalOptsMonoid{..} = GlobalOpts
{ globalReExecVersion = globalMonoidReExecVersion
, globalDockerEntrypoint = globalMonoidDockerEntrypoint
, globalLogLevel = fromMaybe defaultLogLevel globalMonoidLogLevel
, globalConfigMonoid = globalMonoidConfigMonoid
, globalResolver = globalMonoidResolver
, globalCompiler = globalMonoidCompiler
, globalTerminal = fromMaybe defaultTerminal globalMonoidTerminal
, globalStackYaml = globalMonoidStackYaml } | 575 | globalOptsFromMonoid defaultTerminal GlobalOptsMonoid{..} = GlobalOpts
{ globalReExecVersion = globalMonoidReExecVersion
, globalDockerEntrypoint = globalMonoidDockerEntrypoint
, globalLogLevel = fromMaybe defaultLogLevel globalMonoidLogLevel
, globalConfigMonoid = globalMonoidConfigMonoid
, globalResolver = globalMonoidResolver
, globalCompiler = globalMonoidCompiler
, globalTerminal = fromMaybe defaultTerminal globalMonoidTerminal
, globalStackYaml = globalMonoidStackYaml } | 512 | false | true | 0 | 8 | 80 | 94 | 53 | 41 | null | null |
bitemyapp/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | hvMemPath :: String
hvMemPath = "mem_path" | 42 | hvMemPath :: String
hvMemPath = "mem_path" | 42 | hvMemPath = "mem_path" | 22 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'TL.stripSuffix'
tl_stripSuffix = TL.stripSuffix | 52 | tl_stripSuffix = TL.stripSuffix | 31 | tl_stripSuffix = TL.stripSuffix | 31 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
achirkin/qua-view | src/SmallGL/RenderingMapTiles.hs | mit | renderMapTiles :: WebGLRenderingContext
-> ProjMatrix
-> ViewMatrix
-> RenderMTilesProgram
-> IO ()
renderMapTiles _ _ _ rmtp | null (rmtTiles rmtp) = return () | 220 | renderMapTiles :: WebGLRenderingContext
-> ProjMatrix
-> ViewMatrix
-> RenderMTilesProgram
-> IO ()
renderMapTiles _ _ _ rmtp | null (rmtTiles rmtp) = return () | 220 | renderMapTiles _ _ _ rmtp | null (rmtTiles rmtp) = return () | 60 | false | true | 0 | 11 | 83 | 65 | 29 | 36 | null | null |
YtGz/Analyzing-the-Complexity-of-Monotone-Prolog | src/SymbolicEvaluationGraphs/Utilities.hs | lgpl-3.0 | isAbstractVariable _ = error "Malformed term" | 45 | isAbstractVariable _ = error "Malformed term" | 45 | isAbstractVariable _ = error "Malformed term" | 45 | false | false | 0 | 5 | 5 | 12 | 5 | 7 | null | null |
ethercrow/y | src/Y/String.hs | bsd-3-clause | splitAt n (YiString lines (Size size)) =
(YiString leftLines (Size n64), YiString rightLines (Size (size - n64)))
where n64 = fromIntegral n :: Int64
(positionAtStartOfBoundaryLine, boundaryLineIndex) = findSplitBoundary n64 lines
mostlyLeftPart = S.take (succ boundaryLineIndex) lines
strictlyRightPart = S.drop (succ boundaryLineIndex) lines
strictlyLeftPart S.:> lastLeftLine
= S.viewr mostlyLeftPart
(leftLines, rightLines)
= (strictlyLeftPart
|> lineTake (n64 - positionAtStartOfBoundaryLine) lastLeftLine,
lineDrop (n64 - positionAtStartOfBoundaryLine) lastLeftLine
<| strictlyRightPart) | 736 | splitAt n (YiString lines (Size size)) =
(YiString leftLines (Size n64), YiString rightLines (Size (size - n64)))
where n64 = fromIntegral n :: Int64
(positionAtStartOfBoundaryLine, boundaryLineIndex) = findSplitBoundary n64 lines
mostlyLeftPart = S.take (succ boundaryLineIndex) lines
strictlyRightPart = S.drop (succ boundaryLineIndex) lines
strictlyLeftPart S.:> lastLeftLine
= S.viewr mostlyLeftPart
(leftLines, rightLines)
= (strictlyLeftPart
|> lineTake (n64 - positionAtStartOfBoundaryLine) lastLeftLine,
lineDrop (n64 - positionAtStartOfBoundaryLine) lastLeftLine
<| strictlyRightPart) | 736 | splitAt n (YiString lines (Size size)) =
(YiString leftLines (Size n64), YiString rightLines (Size (size - n64)))
where n64 = fromIntegral n :: Int64
(positionAtStartOfBoundaryLine, boundaryLineIndex) = findSplitBoundary n64 lines
mostlyLeftPart = S.take (succ boundaryLineIndex) lines
strictlyRightPart = S.drop (succ boundaryLineIndex) lines
strictlyLeftPart S.:> lastLeftLine
= S.viewr mostlyLeftPart
(leftLines, rightLines)
= (strictlyLeftPart
|> lineTake (n64 - positionAtStartOfBoundaryLine) lastLeftLine,
lineDrop (n64 - positionAtStartOfBoundaryLine) lastLeftLine
<| strictlyRightPart) | 736 | false | false | 7 | 10 | 207 | 184 | 97 | 87 | null | null |
amoerie/labyrinth | Labyrinth/Game.hs | mit | simulatePossibleNextGame :: Game -> Labyrinth.Board.InsertionPoint -> Direction -> PossibleNextGame
simulatePossibleNextGame game insertionPoint direction = PossibleNextGame insertionPoint direction newGame
where newGame = insertFreeTile insertionPoint direction game | 269 | simulatePossibleNextGame :: Game -> Labyrinth.Board.InsertionPoint -> Direction -> PossibleNextGame
simulatePossibleNextGame game insertionPoint direction = PossibleNextGame insertionPoint direction newGame
where newGame = insertFreeTile insertionPoint direction game | 269 | simulatePossibleNextGame game insertionPoint direction = PossibleNextGame insertionPoint direction newGame
where newGame = insertFreeTile insertionPoint direction game | 169 | false | true | 1 | 7 | 26 | 63 | 28 | 35 | null | null |
facebookincubator/duckling | Duckling/Numeral/AR/EG/Rules.hs | bsd-3-clause | ruleInteger13 :: Rule
ruleInteger13 = Rule
{ name = "integer 13"
, pattern =
[ regex "[تط]ل(ا)?[تط]اشر"
]
, prod = \_ -> integer 13
} | 149 | ruleInteger13 :: Rule
ruleInteger13 = Rule
{ name = "integer 13"
, pattern =
[ regex "[تط]ل(ا)?[تط]اشر"
]
, prod = \_ -> integer 13
} | 149 | ruleInteger13 = Rule
{ name = "integer 13"
, pattern =
[ regex "[تط]ل(ا)?[تط]اشر"
]
, prod = \_ -> integer 13
} | 127 | false | true | 0 | 9 | 41 | 49 | 27 | 22 | null | null |
glhrmfrts/lusk | Lusk/Parser.hs | mit | -- concat := additive '..' expr | additive
parseConcatExpr :: Parser SyntaxTree
parseConcatExpr = do
try $ do
lhs <- parseAdditiveExpr
spaces
op <- string ".."
spaces
rhs <- parseExpr
return $ binary (getOpType op) (lhs, rhs)
<|> parseAdditiveExpr | 275 | parseConcatExpr :: Parser SyntaxTree
parseConcatExpr = do
try $ do
lhs <- parseAdditiveExpr
spaces
op <- string ".."
spaces
rhs <- parseExpr
return $ binary (getOpType op) (lhs, rhs)
<|> parseAdditiveExpr | 232 | parseConcatExpr = do
try $ do
lhs <- parseAdditiveExpr
spaces
op <- string ".."
spaces
rhs <- parseExpr
return $ binary (getOpType op) (lhs, rhs)
<|> parseAdditiveExpr | 195 | true | true | 4 | 13 | 66 | 87 | 39 | 48 | null | null |
christiaanb/ghc | compiler/basicTypes/VarSet.hs | bsd-3-clause | extendVarSet_C = addOneToUniqSet_C | 34 | extendVarSet_C = addOneToUniqSet_C | 34 | extendVarSet_C = addOneToUniqSet_C | 34 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
benjaminselfridge/logix | src/Calculus.hs | bsd-3-clause | mergeTermAssignments [] = return [] | 35 | mergeTermAssignments [] = return [] | 35 | mergeTermAssignments [] = return [] | 35 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
bitc/omegagb | src/Cpu.hs | gpl-2.0 | mcti 0xDB _ = error "$DB Invalid Opcode" | 45 | mcti 0xDB _ = error "$DB Invalid Opcode" | 45 | mcti 0xDB _ = error "$DB Invalid Opcode" | 45 | false | false | 0 | 4 | 12 | 16 | 6 | 10 | null | null |
sheyll/b9-vm-image-builder | src/lib/B9/B9Logging.hs | mit | logImpl :: Maybe LogLevel -> Maybe SysIO.Handle -> LogLevel -> String -> IO ()
logImpl minLevel mh level msg = do
lm <- formatLogMsg level msg
when (isJust minLevel && level >= fromJust minLevel) $ do
putStr lm
SysIO.hFlush SysIO.stdout
when (isJust mh) $ do
SysIO.hPutStr (fromJust mh) lm
SysIO.hFlush (fromJust mh) | 338 | logImpl :: Maybe LogLevel -> Maybe SysIO.Handle -> LogLevel -> String -> IO ()
logImpl minLevel mh level msg = do
lm <- formatLogMsg level msg
when (isJust minLevel && level >= fromJust minLevel) $ do
putStr lm
SysIO.hFlush SysIO.stdout
when (isJust mh) $ do
SysIO.hPutStr (fromJust mh) lm
SysIO.hFlush (fromJust mh) | 338 | logImpl minLevel mh level msg = do
lm <- formatLogMsg level msg
when (isJust minLevel && level >= fromJust minLevel) $ do
putStr lm
SysIO.hFlush SysIO.stdout
when (isJust mh) $ do
SysIO.hPutStr (fromJust mh) lm
SysIO.hFlush (fromJust mh) | 259 | false | true | 0 | 13 | 73 | 155 | 67 | 88 | null | null |
jhance/objection | Language/Objection/CodeGen.hs | gpl-3.0 | genLiteral :: Literal -> (Type, Value)
genLiteral (LiteralInt i) =
(PrimitiveType PrimitiveInt, constInt int32Type (fromIntegral i) True) | 141 | genLiteral :: Literal -> (Type, Value)
genLiteral (LiteralInt i) =
(PrimitiveType PrimitiveInt, constInt int32Type (fromIntegral i) True) | 141 | genLiteral (LiteralInt i) =
(PrimitiveType PrimitiveInt, constInt int32Type (fromIntegral i) True) | 102 | false | true | 0 | 8 | 20 | 52 | 27 | 25 | null | null |
j-mueller/iso-svg | src/Graphics/SceneGraph.hs | bsd-3-clause | normaliseLight :: Fractional a => Light V4 a -> Light V3 a
normaliseLight = Light <$> view (lightPos.to normalizePoint) <*> view strength | 137 | normaliseLight :: Fractional a => Light V4 a -> Light V3 a
normaliseLight = Light <$> view (lightPos.to normalizePoint) <*> view strength | 137 | normaliseLight = Light <$> view (lightPos.to normalizePoint) <*> view strength | 78 | false | true | 0 | 10 | 21 | 54 | 25 | 29 | null | null |
kim/amazonka | amazonka-ecs/gen/Network/AWS/ECS/StopTask.hs | mpl-2.0 | -- | The short name or full Amazon Resource Name (ARN) of the cluster that hosts
-- the task you want to stop. If you do not specify a cluster, the default
-- cluster is assumed..
stCluster :: Lens' StopTask (Maybe Text)
stCluster = lens _stCluster (\s a -> s { _stCluster = a }) | 279 | stCluster :: Lens' StopTask (Maybe Text)
stCluster = lens _stCluster (\s a -> s { _stCluster = a }) | 99 | stCluster = lens _stCluster (\s a -> s { _stCluster = a }) | 58 | true | true | 0 | 9 | 54 | 48 | 27 | 21 | null | null |
tebello-thejane/bitx-haskell | test/Network/Bitcoin/BitX/Spec/Specs/LensSpec.hs | bsd-3-clause | _order :: Maybe Int
_order = do
let x = BitX.Order 0 0
let _ = x ^. BitX.volume
let _ = x ^. BitX.price
Nothing | 127 | _order :: Maybe Int
_order = do
let x = BitX.Order 0 0
let _ = x ^. BitX.volume
let _ = x ^. BitX.price
Nothing | 127 | _order = do
let x = BitX.Order 0 0
let _ = x ^. BitX.volume
let _ = x ^. BitX.price
Nothing | 107 | false | true | 0 | 11 | 41 | 65 | 29 | 36 | null | null |
mbakke/ganeti | src/Ganeti/HTools/Instance.hs | bsd-2-clause | instanceDown _ = True | 41 | instanceDown _ = True | 41 | instanceDown _ = True | 41 | false | false | 0 | 5 | 23 | 9 | 4 | 5 | null | null |
ml9951/ghc | compiler/typecheck/TcGenGenerics.hs | bsd-3-clause | forgetArgVar Gen1_DC{} = Gen1 | 29 | forgetArgVar Gen1_DC{} = Gen1 | 29 | forgetArgVar Gen1_DC{} = Gen1 | 29 | false | false | 0 | 6 | 3 | 13 | 6 | 7 | null | null |
fmapfmapfmap/amazonka | amazonka-elasticache/gen/Network/AWS/ElastiCache/CreateCacheParameterGroup.hs | mpl-2.0 | -- | The name of the cache parameter group family the cache parameter group
-- can be used with.
--
-- Valid values are: 'memcached1.4' | 'redis2.6' | 'redis2.8'
ccpgCacheParameterGroupFamily :: Lens' CreateCacheParameterGroup Text
ccpgCacheParameterGroupFamily = lens _ccpgCacheParameterGroupFamily (\ s a -> s{_ccpgCacheParameterGroupFamily = a}) | 348 | ccpgCacheParameterGroupFamily :: Lens' CreateCacheParameterGroup Text
ccpgCacheParameterGroupFamily = lens _ccpgCacheParameterGroupFamily (\ s a -> s{_ccpgCacheParameterGroupFamily = a}) | 186 | ccpgCacheParameterGroupFamily = lens _ccpgCacheParameterGroupFamily (\ s a -> s{_ccpgCacheParameterGroupFamily = a}) | 116 | true | true | 0 | 9 | 44 | 43 | 25 | 18 | null | null |
adityagupta1089/Project-Euler-Haskell | src/problems/Problem549.hs | bsd-3-clause | maxPow :: Int -> Int -> Int
maxPow x p
| mod x p /= 0 = 0
| otherwise = 1 + maxPow (div x p) p | 105 | maxPow :: Int -> Int -> Int
maxPow x p
| mod x p /= 0 = 0
| otherwise = 1 + maxPow (div x p) p | 105 | maxPow x p
| mod x p /= 0 = 0
| otherwise = 1 + maxPow (div x p) p | 77 | false | true | 0 | 9 | 38 | 65 | 30 | 35 | null | null |
andyarvanitis/Idris-dev | src/Idris/Core/Elaborate.hs | bsd-3-clause | match_fill :: Raw -> Elab' aux ()
match_fill t = processTactic' (MatchFill t) | 77 | match_fill :: Raw -> Elab' aux ()
match_fill t = processTactic' (MatchFill t) | 77 | match_fill t = processTactic' (MatchFill t) | 43 | false | true | 0 | 8 | 12 | 38 | 17 | 21 | null | null |
karamellpelle/grid | source/Game/Values.hs | gpl-3.0 | valueLevelPuzzlePathSpeedLevel :: Float
valueLevelPuzzlePathSpeedLevel =
1.5 | 81 | valueLevelPuzzlePathSpeedLevel :: Float
valueLevelPuzzlePathSpeedLevel =
1.5 | 81 | valueLevelPuzzlePathSpeedLevel =
1.5 | 41 | false | true | 0 | 4 | 10 | 11 | 6 | 5 | null | null |
maxigit/sql-fragment | tests/doctest.hs | bsd-3-clause | -- local
main :: IO ()
main = doctest [ "-i./src/"
, "src/Database/SQLFragment/SQLFragment.hs"
, "src/Database/SQLFragment/Operators.hs"
, "src/Database/SQLFragment/Join.hs"
, "src/Database/SQLFragment/Internal.hs"
] | 292 | main :: IO ()
main = doctest [ "-i./src/"
, "src/Database/SQLFragment/SQLFragment.hs"
, "src/Database/SQLFragment/Operators.hs"
, "src/Database/SQLFragment/Join.hs"
, "src/Database/SQLFragment/Internal.hs"
] | 282 | main = doctest [ "-i./src/"
, "src/Database/SQLFragment/SQLFragment.hs"
, "src/Database/SQLFragment/Operators.hs"
, "src/Database/SQLFragment/Join.hs"
, "src/Database/SQLFragment/Internal.hs"
] | 268 | true | true | 0 | 6 | 95 | 35 | 20 | 15 | null | null |
jgoerzen/dtmconv | HaXml-1.12/src/Text/PrettyPrint/HughesPJ.hs | gpl-2.0 | -- p can't be Empty, so no need for mkNest
aboveNest (NilAbove p) g k q = nilAbove_ (aboveNest p g k q) | 143 | aboveNest (NilAbove p) g k q = nilAbove_ (aboveNest p g k q) | 67 | aboveNest (NilAbove p) g k q = nilAbove_ (aboveNest p g k q) | 67 | true | false | 0 | 7 | 62 | 37 | 18 | 19 | null | null |
amccausl/Swish | Swish/HaskellRDF/SwishScript.hs | lgpl-2.1 | formulaList :: N3Parser [SwishStateIO (Either String RDFFormula)]
formulaList = between (symbol "(") (symbol ")") (many formulaExpr)
<?>
"List of formulae (names or named graphs)" | 194 | formulaList :: N3Parser [SwishStateIO (Either String RDFFormula)]
formulaList = between (symbol "(") (symbol ")") (many formulaExpr)
<?>
"List of formulae (names or named graphs)" | 193 | formulaList = between (symbol "(") (symbol ")") (many formulaExpr)
<?>
"List of formulae (names or named graphs)" | 127 | false | true | 3 | 9 | 38 | 63 | 28 | 35 | null | null |
valis/hoq | src/Semantics/Pattern.hs | gpl-2.0 | clauseToClauseEq (Clause (Cons (PatDCon v dt i n cs params ps) pats) term) = case clauseToClauseEq $ Clause (ps +++ pats) term of
ClauseEq pats' term' -> case patternsSplitAt pats' (patternsLength ps) of
Split pats1 pats2 -> ClauseEq (Cons (PatDCon v dt i n cs params pats1) pats2) term' | 299 | clauseToClauseEq (Clause (Cons (PatDCon v dt i n cs params ps) pats) term) = case clauseToClauseEq $ Clause (ps +++ pats) term of
ClauseEq pats' term' -> case patternsSplitAt pats' (patternsLength ps) of
Split pats1 pats2 -> ClauseEq (Cons (PatDCon v dt i n cs params pats1) pats2) term' | 299 | clauseToClauseEq (Clause (Cons (PatDCon v dt i n cs params ps) pats) term) = case clauseToClauseEq $ Clause (ps +++ pats) term of
ClauseEq pats' term' -> case patternsSplitAt pats' (patternsLength ps) of
Split pats1 pats2 -> ClauseEq (Cons (PatDCon v dt i n cs params pats1) pats2) term' | 299 | false | false | 0 | 15 | 60 | 131 | 63 | 68 | null | null |
skogsbaer/HTF | Test/Framework/HUnitWrapper.hs | lgpl-2.1 | -- | Fail if the given @Either a b@ value is a 'Right',
-- supplying an additional error message.
-- Use this function if @b@ is an instance of 'Show'.
assertLeftVerbose :: (Show b, HasCallStack) => String -> Either a b -> IO a
assertLeftVerbose = assertLeft_ "assertLeftVerbose" | 279 | assertLeftVerbose :: (Show b, HasCallStack) => String -> Either a b -> IO a
assertLeftVerbose = assertLeft_ "assertLeftVerbose" | 127 | assertLeftVerbose = assertLeft_ "assertLeftVerbose" | 51 | true | true | 0 | 8 | 47 | 46 | 24 | 22 | null | null |
kim/amazonka | amazonka-cloudsearch/gen/Network/AWS/CloudSearch/DeleteDomain.hs | mpl-2.0 | -- | 'DeleteDomainResponse' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'ddrDomainStatus' @::@ 'Maybe' 'DomainStatus'
--
deleteDomainResponse :: DeleteDomainResponse
deleteDomainResponse = DeleteDomainResponse
{ _ddrDomainStatus = Nothing
} | 287 | deleteDomainResponse :: DeleteDomainResponse
deleteDomainResponse = DeleteDomainResponse
{ _ddrDomainStatus = Nothing
} | 127 | deleteDomainResponse = DeleteDomainResponse
{ _ddrDomainStatus = Nothing
} | 82 | true | true | 0 | 6 | 39 | 28 | 18 | 10 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.