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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Mathnerd314/lamdu | src/Lamdu/CodeEdit/ExpressionEdit/CollapsedEdit.hs | gpl-3.0 | make ::
MonadA m => ParentPrecedence ->
Sugar.Collapsed Sugar.Name m (ExprGuiM.SugarExpr m) ->
Widget.Id -> ExprGuiM m (ExpressionGui m)
make (ParentPrecedence parentPrecedence) collapsed myId = do
config <- ExprGuiM.widgetEnv WE.readConfig
let
makeExpanded wId =
ExpressionGui.withBgColor Layers.collapsedExpandedBG
(Config.collapsedExpandedBGColor config) (bgId wId) <$>
ExprGuiM.inCollapsedExpression
(ExprGuiM.makeSubexpresion parentPrecedence fullExpression)
f wId =
Collapser
{ cMakeExpanded = makeExpanded wId
, cMakeFocusedCompact =
colorize wId (compact ^. Sugar.gvVarType) $
GetVarEdit.makeUncoloredView compact funcId
}
colorize _ Sugar.GetDefinition =
ExprGuiM.withFgColor $ Config.collapsedForegroundColor config
colorize wId _ = colorizeGetParameter wId
colorizeGetParameter wId =
fmap
(ExpressionGui.withBgColor
Layers.collapsedCompactBG
(Config.collapsedCompactBGColor config) (bgId wId)) .
ExprGuiM.withFgColor (Config.parameterColor config)
case () of
_ | hasInfo -> makeExpanded myId
| otherwise -> ExpressionGui.makeCollapser (collapsedFDConfig config) f myId
where
Sugar.Collapsed funcGuid compact fullExpression hasInfo = collapsed
bgId wId = Widget.toAnimId wId ++ ["bg"]
funcId = WidgetIds.fromGuid funcGuid | 1,389 | make ::
MonadA m => ParentPrecedence ->
Sugar.Collapsed Sugar.Name m (ExprGuiM.SugarExpr m) ->
Widget.Id -> ExprGuiM m (ExpressionGui m)
make (ParentPrecedence parentPrecedence) collapsed myId = do
config <- ExprGuiM.widgetEnv WE.readConfig
let
makeExpanded wId =
ExpressionGui.withBgColor Layers.collapsedExpandedBG
(Config.collapsedExpandedBGColor config) (bgId wId) <$>
ExprGuiM.inCollapsedExpression
(ExprGuiM.makeSubexpresion parentPrecedence fullExpression)
f wId =
Collapser
{ cMakeExpanded = makeExpanded wId
, cMakeFocusedCompact =
colorize wId (compact ^. Sugar.gvVarType) $
GetVarEdit.makeUncoloredView compact funcId
}
colorize _ Sugar.GetDefinition =
ExprGuiM.withFgColor $ Config.collapsedForegroundColor config
colorize wId _ = colorizeGetParameter wId
colorizeGetParameter wId =
fmap
(ExpressionGui.withBgColor
Layers.collapsedCompactBG
(Config.collapsedCompactBGColor config) (bgId wId)) .
ExprGuiM.withFgColor (Config.parameterColor config)
case () of
_ | hasInfo -> makeExpanded myId
| otherwise -> ExpressionGui.makeCollapser (collapsedFDConfig config) f myId
where
Sugar.Collapsed funcGuid compact fullExpression hasInfo = collapsed
bgId wId = Widget.toAnimId wId ++ ["bg"]
funcId = WidgetIds.fromGuid funcGuid | 1,389 | make (ParentPrecedence parentPrecedence) collapsed myId = do
config <- ExprGuiM.widgetEnv WE.readConfig
let
makeExpanded wId =
ExpressionGui.withBgColor Layers.collapsedExpandedBG
(Config.collapsedExpandedBGColor config) (bgId wId) <$>
ExprGuiM.inCollapsedExpression
(ExprGuiM.makeSubexpresion parentPrecedence fullExpression)
f wId =
Collapser
{ cMakeExpanded = makeExpanded wId
, cMakeFocusedCompact =
colorize wId (compact ^. Sugar.gvVarType) $
GetVarEdit.makeUncoloredView compact funcId
}
colorize _ Sugar.GetDefinition =
ExprGuiM.withFgColor $ Config.collapsedForegroundColor config
colorize wId _ = colorizeGetParameter wId
colorizeGetParameter wId =
fmap
(ExpressionGui.withBgColor
Layers.collapsedCompactBG
(Config.collapsedCompactBGColor config) (bgId wId)) .
ExprGuiM.withFgColor (Config.parameterColor config)
case () of
_ | hasInfo -> makeExpanded myId
| otherwise -> ExpressionGui.makeCollapser (collapsedFDConfig config) f myId
where
Sugar.Collapsed funcGuid compact fullExpression hasInfo = collapsed
bgId wId = Widget.toAnimId wId ++ ["bg"]
funcId = WidgetIds.fromGuid funcGuid | 1,246 | false | true | 4 | 16 | 288 | 399 | 184 | 215 | null | null |
bhamrick/hsmath | Math/Polynomial/Operations.hs | bsd-3-clause | _subP :: Num a => [a] -> [a] -> [a]
_subP as [] = as | 52 | _subP :: Num a => [a] -> [a] -> [a]
_subP as [] = as | 52 | _subP as [] = as | 16 | false | true | 0 | 8 | 14 | 42 | 22 | 20 | null | null |
thalerjonathan/phd | coding/prototyping/haskell/PureAgentsPar/src/PureAgentsPar.hs | gpl-3.0 | stepAllAgents :: [Agent m s e] -> Double -> [Agent m s e]
stepAllAgents as dt = deliverOutMsgs steppedAs
where
steppedAs = foldl (stepAllAgentsFold dt) [] as
stepAllAgentsFold :: Double -> [Agent m s e] -> Agent m s e -> [Agent m s e]
stepAllAgentsFold dt as a
| killAgent = (as ++ nas)
| otherwise = (as ++ [aNewAgentsRemoved] ++ nas)
where
aAfterStep = stepAgent dt a
nas = newAgents aAfterStep
killAgent = (killFlag aAfterStep)
aNewAgentsRemoved = aAfterStep { newAgents = [] }
-- TODO: can we parallelize this?
deliverOutMsgs :: [Agent m s e] -> [Agent m s e]
deliverOutMsgs as = Map.elems agentsWithMsgs
where
(allOutMsgs, as') = collectOutMsgs as
agentMap = foldl (\acc a -> Map.insert (agentId a) a acc ) Map.empty as' -- TODO: hashmap will change the order, is this alright? should be when working in parallel
agentsWithMsgs = foldl (\agentMap' outMsgTup -> deliverMsg agentMap' outMsgTup ) agentMap allOutMsgs
deliverMsg :: Map.Map AgentId (Agent m s e) -> (AgentId, AgentId, m) -> Map.Map AgentId (Agent m s e)
deliverMsg agentMap (senderId, targetId, m) = Map.insert targetId a' agentMap
where
a = fromJust (Map.lookup targetId agentMap) -- NOTE: must be in the map
ib = inBox a
ibM = (senderId, m)
a' = a { inBox = ib ++ [ibM] } -- TODO: is ordering important??? what is the meaning of ordering in this case?
-- NOTE: first AgentId: senderId, second AgentId: targetId
collectOutMsgs :: [Agent m s e] -> ([(AgentId, AgentId, m)], [Agent m s e])
collectOutMsgs as = foldl (\(accMsgs, accAs) a -> ((outBox a) ++ accMsgs, (a { outBox = [] }) : accAs) ) ([], []) as
-- TODO: run parallel
stepAgent :: Double -> Agent m s e -> Agent m s e
stepAgent dt a = aAfterUpdt
where
aAfterMsgProc = processAllMessages a
aAfterUpdt = (trans aAfterMsgProc) aAfterMsgProc (-1, Dt dt)
processMsg :: Agent m s e -> (AgentId, m) -> Agent m s e
processMsg a (senderId, m) = (trans a) a (senderId, Domain m)
processAllMessages :: Agent m s e -> Agent m s e
processAllMessages a = aAfterMsgs { inBox = [] }
where
aAfterMsgs = foldl (\a' senderMsgPair -> processMsg a' senderMsgPair) a (inBox a)
------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
{- TODO: experiment with 'active' messages which represent a conversation between two agents but will be executed only by
the receiving agent and will result in a final result which is then local to the receiving agent. This allows
to encapsulate data in a more general way through closures and to have some logic working upon the data. -}
{-
main :: IO ()
main = do
let b = makeOffer bid
let r = executeOffer ask b
putStrLn (show r)
where
bid = Bid 42
ask = Ask 41
data Offering a = Bid a | Ask a | Accept | Refuse deriving (Show)
data Conversation m = Msg m | Conv (m -> Conversation m)
{- NOTE: this part sends an offer enclosed in the lambda and will compare it to a passed in offer where a reply is then made
TODO: introduce additional step> send o along with an additional reply and wait
-}
makeOffer :: Offering Int -> Conversation (Offering Int)
makeOffer o = Conv (\o' -> if compareOffer o o' then
Msg Accept
else
Msg Refuse )
{- NOTE: this part is the counterpart which allows to execute a given offering-conversation with a given offering
problem: we loose track were we are like in makeOffer
TODO: must always terminate and finally return Message
-}
executeOffer :: Offering Int -> Conversation (Offering Int) -> Offering Int
executeOffer o (Conv f) = executeOffer o (f o)
executeOffer o (Msg o') = o'
compareOffer :: Offering Int -> Offering Int -> Bool
compareOffer (Bid a) (Ask a') = a >= a'
compareOffer (Ask a) (Bid a') = a <= a'
compareOffer _ _ = False
-}
----------------------------------------------------------------------------------------------------------------------------- | 4,380 | stepAllAgents :: [Agent m s e] -> Double -> [Agent m s e]
stepAllAgents as dt = deliverOutMsgs steppedAs
where
steppedAs = foldl (stepAllAgentsFold dt) [] as
stepAllAgentsFold :: Double -> [Agent m s e] -> Agent m s e -> [Agent m s e]
stepAllAgentsFold dt as a
| killAgent = (as ++ nas)
| otherwise = (as ++ [aNewAgentsRemoved] ++ nas)
where
aAfterStep = stepAgent dt a
nas = newAgents aAfterStep
killAgent = (killFlag aAfterStep)
aNewAgentsRemoved = aAfterStep { newAgents = [] }
-- TODO: can we parallelize this?
deliverOutMsgs :: [Agent m s e] -> [Agent m s e]
deliverOutMsgs as = Map.elems agentsWithMsgs
where
(allOutMsgs, as') = collectOutMsgs as
agentMap = foldl (\acc a -> Map.insert (agentId a) a acc ) Map.empty as' -- TODO: hashmap will change the order, is this alright? should be when working in parallel
agentsWithMsgs = foldl (\agentMap' outMsgTup -> deliverMsg agentMap' outMsgTup ) agentMap allOutMsgs
deliverMsg :: Map.Map AgentId (Agent m s e) -> (AgentId, AgentId, m) -> Map.Map AgentId (Agent m s e)
deliverMsg agentMap (senderId, targetId, m) = Map.insert targetId a' agentMap
where
a = fromJust (Map.lookup targetId agentMap) -- NOTE: must be in the map
ib = inBox a
ibM = (senderId, m)
a' = a { inBox = ib ++ [ibM] } -- TODO: is ordering important??? what is the meaning of ordering in this case?
-- NOTE: first AgentId: senderId, second AgentId: targetId
collectOutMsgs :: [Agent m s e] -> ([(AgentId, AgentId, m)], [Agent m s e])
collectOutMsgs as = foldl (\(accMsgs, accAs) a -> ((outBox a) ++ accMsgs, (a { outBox = [] }) : accAs) ) ([], []) as
-- TODO: run parallel
stepAgent :: Double -> Agent m s e -> Agent m s e
stepAgent dt a = aAfterUpdt
where
aAfterMsgProc = processAllMessages a
aAfterUpdt = (trans aAfterMsgProc) aAfterMsgProc (-1, Dt dt)
processMsg :: Agent m s e -> (AgentId, m) -> Agent m s e
processMsg a (senderId, m) = (trans a) a (senderId, Domain m)
processAllMessages :: Agent m s e -> Agent m s e
processAllMessages a = aAfterMsgs { inBox = [] }
where
aAfterMsgs = foldl (\a' senderMsgPair -> processMsg a' senderMsgPair) a (inBox a)
------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
{- TODO: experiment with 'active' messages which represent a conversation between two agents but will be executed only by
the receiving agent and will result in a final result which is then local to the receiving agent. This allows
to encapsulate data in a more general way through closures and to have some logic working upon the data. -}
{-
main :: IO ()
main = do
let b = makeOffer bid
let r = executeOffer ask b
putStrLn (show r)
where
bid = Bid 42
ask = Ask 41
data Offering a = Bid a | Ask a | Accept | Refuse deriving (Show)
data Conversation m = Msg m | Conv (m -> Conversation m)
{- NOTE: this part sends an offer enclosed in the lambda and will compare it to a passed in offer where a reply is then made
TODO: introduce additional step> send o along with an additional reply and wait
-}
makeOffer :: Offering Int -> Conversation (Offering Int)
makeOffer o = Conv (\o' -> if compareOffer o o' then
Msg Accept
else
Msg Refuse )
{- NOTE: this part is the counterpart which allows to execute a given offering-conversation with a given offering
problem: we loose track were we are like in makeOffer
TODO: must always terminate and finally return Message
-}
executeOffer :: Offering Int -> Conversation (Offering Int) -> Offering Int
executeOffer o (Conv f) = executeOffer o (f o)
executeOffer o (Msg o') = o'
compareOffer :: Offering Int -> Offering Int -> Bool
compareOffer (Bid a) (Ask a') = a >= a'
compareOffer (Ask a) (Bid a') = a <= a'
compareOffer _ _ = False
-}
----------------------------------------------------------------------------------------------------------------------------- | 4,380 | stepAllAgents as dt = deliverOutMsgs steppedAs
where
steppedAs = foldl (stepAllAgentsFold dt) [] as
stepAllAgentsFold :: Double -> [Agent m s e] -> Agent m s e -> [Agent m s e]
stepAllAgentsFold dt as a
| killAgent = (as ++ nas)
| otherwise = (as ++ [aNewAgentsRemoved] ++ nas)
where
aAfterStep = stepAgent dt a
nas = newAgents aAfterStep
killAgent = (killFlag aAfterStep)
aNewAgentsRemoved = aAfterStep { newAgents = [] }
-- TODO: can we parallelize this?
deliverOutMsgs :: [Agent m s e] -> [Agent m s e]
deliverOutMsgs as = Map.elems agentsWithMsgs
where
(allOutMsgs, as') = collectOutMsgs as
agentMap = foldl (\acc a -> Map.insert (agentId a) a acc ) Map.empty as' -- TODO: hashmap will change the order, is this alright? should be when working in parallel
agentsWithMsgs = foldl (\agentMap' outMsgTup -> deliverMsg agentMap' outMsgTup ) agentMap allOutMsgs
deliverMsg :: Map.Map AgentId (Agent m s e) -> (AgentId, AgentId, m) -> Map.Map AgentId (Agent m s e)
deliverMsg agentMap (senderId, targetId, m) = Map.insert targetId a' agentMap
where
a = fromJust (Map.lookup targetId agentMap) -- NOTE: must be in the map
ib = inBox a
ibM = (senderId, m)
a' = a { inBox = ib ++ [ibM] } -- TODO: is ordering important??? what is the meaning of ordering in this case?
-- NOTE: first AgentId: senderId, second AgentId: targetId
collectOutMsgs :: [Agent m s e] -> ([(AgentId, AgentId, m)], [Agent m s e])
collectOutMsgs as = foldl (\(accMsgs, accAs) a -> ((outBox a) ++ accMsgs, (a { outBox = [] }) : accAs) ) ([], []) as
-- TODO: run parallel
stepAgent :: Double -> Agent m s e -> Agent m s e
stepAgent dt a = aAfterUpdt
where
aAfterMsgProc = processAllMessages a
aAfterUpdt = (trans aAfterMsgProc) aAfterMsgProc (-1, Dt dt)
processMsg :: Agent m s e -> (AgentId, m) -> Agent m s e
processMsg a (senderId, m) = (trans a) a (senderId, Domain m)
processAllMessages :: Agent m s e -> Agent m s e
processAllMessages a = aAfterMsgs { inBox = [] }
where
aAfterMsgs = foldl (\a' senderMsgPair -> processMsg a' senderMsgPair) a (inBox a)
------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
{- TODO: experiment with 'active' messages which represent a conversation between two agents but will be executed only by
the receiving agent and will result in a final result which is then local to the receiving agent. This allows
to encapsulate data in a more general way through closures and to have some logic working upon the data. -}
{-
main :: IO ()
main = do
let b = makeOffer bid
let r = executeOffer ask b
putStrLn (show r)
where
bid = Bid 42
ask = Ask 41
data Offering a = Bid a | Ask a | Accept | Refuse deriving (Show)
data Conversation m = Msg m | Conv (m -> Conversation m)
{- NOTE: this part sends an offer enclosed in the lambda and will compare it to a passed in offer where a reply is then made
TODO: introduce additional step> send o along with an additional reply and wait
-}
makeOffer :: Offering Int -> Conversation (Offering Int)
makeOffer o = Conv (\o' -> if compareOffer o o' then
Msg Accept
else
Msg Refuse )
{- NOTE: this part is the counterpart which allows to execute a given offering-conversation with a given offering
problem: we loose track were we are like in makeOffer
TODO: must always terminate and finally return Message
-}
executeOffer :: Offering Int -> Conversation (Offering Int) -> Offering Int
executeOffer o (Conv f) = executeOffer o (f o)
executeOffer o (Msg o') = o'
compareOffer :: Offering Int -> Offering Int -> Bool
compareOffer (Bid a) (Ask a') = a >= a'
compareOffer (Ask a) (Bid a') = a <= a'
compareOffer _ _ = False
-}
----------------------------------------------------------------------------------------------------------------------------- | 4,322 | false | true | 9 | 13 | 1,100 | 826 | 437 | 389 | null | null |
zaxtax/hakaru-old | Language/Hakaru/Syntax.hs | bsd-3-clause | eval (Unbool b x y) = unbool (eval b) (eval x) (eval y) | 55 | eval (Unbool b x y) = unbool (eval b) (eval x) (eval y) | 55 | eval (Unbool b x y) = unbool (eval b) (eval x) (eval y) | 55 | false | false | 0 | 7 | 12 | 44 | 21 | 23 | null | null |
tjakway/ghcjvm | compiler/utils/Util.hs | bsd-3-clause | isWindowsHost = True | 20 | isWindowsHost = True | 20 | isWindowsHost = True | 20 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
keithodulaigh/Hets | DFOL/Utils.hs | gpl-2.0 | implPrec :: Int
implPrec = 4 | 28 | implPrec :: Int
implPrec = 4 | 28 | implPrec = 4 | 12 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/ARB/Compatibility/Tokens.hs | bsd-3-clause | gl_NORMAL_MAP :: GLenum
gl_NORMAL_MAP = 0x8511 | 46 | gl_NORMAL_MAP :: GLenum
gl_NORMAL_MAP = 0x8511 | 46 | gl_NORMAL_MAP = 0x8511 | 22 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
andykitchen/linear-logic | Rewrite.hs | gpl-3.0 | match (a :&: b) (c :&: d) = crossMatch (a, b) (c, d) | 52 | match (a :&: b) (c :&: d) = crossMatch (a, b) (c, d) | 52 | match (a :&: b) (c :&: d) = crossMatch (a, b) (c, d) | 52 | false | false | 0 | 7 | 12 | 42 | 23 | 19 | null | null |
spechub/Hets | CSL/Keywords.hs | gpl-2.0 | timesS :: String
timesS = "times" | 33 | timesS :: String
timesS = "times" | 33 | timesS = "times" | 16 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
taksuyu/marktime | src/Marktime/Database.hs | bsd-3-clause | pauseTask :: DB -> Key TaskStore -> IO (Either PauseTaskError ())
pauseTask db key = runDBGetTime db $ \time -> do
task <- get key
case task of
Just TaskStore{..} ->
case (taskStoreStartTime, taskStoreFinished) of
(Just a, False) -> do
update key [ TaskStoreStartTime =. Nothing
, TaskStoreDurations =. TimeTo (a, time) : taskStoreDurations ]
pure (Right ())
(_, True) ->
pure (Left AlreadyFinished)
(Nothing, _) ->
pure (Left PauseNotStarted)
Nothing ->
pure (Left PauseTaskNotFound)
-- FIXME: UGLY! Change that generation please. | 641 | pauseTask :: DB -> Key TaskStore -> IO (Either PauseTaskError ())
pauseTask db key = runDBGetTime db $ \time -> do
task <- get key
case task of
Just TaskStore{..} ->
case (taskStoreStartTime, taskStoreFinished) of
(Just a, False) -> do
update key [ TaskStoreStartTime =. Nothing
, TaskStoreDurations =. TimeTo (a, time) : taskStoreDurations ]
pure (Right ())
(_, True) ->
pure (Left AlreadyFinished)
(Nothing, _) ->
pure (Left PauseNotStarted)
Nothing ->
pure (Left PauseTaskNotFound)
-- FIXME: UGLY! Change that generation please. | 641 | pauseTask db key = runDBGetTime db $ \time -> do
task <- get key
case task of
Just TaskStore{..} ->
case (taskStoreStartTime, taskStoreFinished) of
(Just a, False) -> do
update key [ TaskStoreStartTime =. Nothing
, TaskStoreDurations =. TimeTo (a, time) : taskStoreDurations ]
pure (Right ())
(_, True) ->
pure (Left AlreadyFinished)
(Nothing, _) ->
pure (Left PauseNotStarted)
Nothing ->
pure (Left PauseTaskNotFound)
-- FIXME: UGLY! Change that generation please. | 575 | false | true | 0 | 22 | 191 | 216 | 107 | 109 | null | null |
MathiasVP/syntax-checker-checker | qcsyntax.hs | mit | shrinkExpression (If e1 e2 e3) =
easy [e1, e2, e3] | 52 | shrinkExpression (If e1 e2 e3) =
easy [e1, e2, e3] | 52 | shrinkExpression (If e1 e2 e3) =
easy [e1, e2, e3] | 52 | false | false | 0 | 7 | 11 | 31 | 16 | 15 | null | null |
shapr/adventofcode2016 | src/Three/Main.hs | bsd-3-clause | checkThree [] = 0 | 25 | checkThree [] = 0 | 25 | checkThree [] = 0 | 25 | false | false | 1 | 5 | 11 | 15 | 5 | 10 | null | null |
brendanhay/gogol | gogol-toolresults/gen/Network/Google/ToolResults/Types/Product.hs | mpl-2.0 | -- | Resource names of the overlapping screen elements
oauieResourceName :: Lens' OverlAppingUIElements [Text]
oauieResourceName
= lens _oauieResourceName
(\ s a -> s{_oauieResourceName = a})
. _Default
. _Coerce | 232 | oauieResourceName :: Lens' OverlAppingUIElements [Text]
oauieResourceName
= lens _oauieResourceName
(\ s a -> s{_oauieResourceName = a})
. _Default
. _Coerce | 177 | oauieResourceName
= lens _oauieResourceName
(\ s a -> s{_oauieResourceName = a})
. _Default
. _Coerce | 121 | true | true | 3 | 8 | 48 | 58 | 28 | 30 | null | null |
ntc2/cryptol | src/Cryptol/Utils/PP.hs | bsd-3-clause | optParens :: Bool -> Doc -> Doc
optParens b body | b = parens body
| otherwise = body | 110 | optParens :: Bool -> Doc -> Doc
optParens b body | b = parens body
| otherwise = body | 110 | optParens b body | b = parens body
| otherwise = body | 78 | false | true | 0 | 7 | 43 | 42 | 19 | 23 | null | null |
travitch/foreign-inference | tests/NullableTests.hs | bsd-3-clause | analyzeNullable ds m =
nullSummaryToTestFormat (_nullableSummary res)
where
pta = identifyIndirectCallTargets m
cg = callGraph m pta []
analyses :: [ComposableAnalysis AnalysisSummary FunctionMetadata]
analyses = [ identifyReturns ds returnSummary
, identifyNullable ds nullableSummary returnSummary
]
analysisFunc = callGraphComposeAnalysis analyses
res = callGraphSCCTraversal cg analysisFunc mempty | 459 | analyzeNullable ds m =
nullSummaryToTestFormat (_nullableSummary res)
where
pta = identifyIndirectCallTargets m
cg = callGraph m pta []
analyses :: [ComposableAnalysis AnalysisSummary FunctionMetadata]
analyses = [ identifyReturns ds returnSummary
, identifyNullable ds nullableSummary returnSummary
]
analysisFunc = callGraphComposeAnalysis analyses
res = callGraphSCCTraversal cg analysisFunc mempty | 459 | analyzeNullable ds m =
nullSummaryToTestFormat (_nullableSummary res)
where
pta = identifyIndirectCallTargets m
cg = callGraph m pta []
analyses :: [ComposableAnalysis AnalysisSummary FunctionMetadata]
analyses = [ identifyReturns ds returnSummary
, identifyNullable ds nullableSummary returnSummary
]
analysisFunc = callGraphComposeAnalysis analyses
res = callGraphSCCTraversal cg analysisFunc mempty | 459 | false | false | 2 | 7 | 102 | 106 | 50 | 56 | null | null |
wavewave/madgraph-auto-dataset | src/HEP/Automation/MadGraph/Dataset/Set20110303set2.hs | gpl-3.0 | sixtasklist :: [WorkSetup]
sixtasklist = [ WS my_ssetup (psetup_six_ttbar01j)
(rsetupGen p MLM NoUserCutDef NoPGS 20000 num)
my_csetup
| p <- sixparamset , num <- sets ] | 243 | sixtasklist :: [WorkSetup]
sixtasklist = [ WS my_ssetup (psetup_six_ttbar01j)
(rsetupGen p MLM NoUserCutDef NoPGS 20000 num)
my_csetup
| p <- sixparamset , num <- sets ] | 243 | sixtasklist = [ WS my_ssetup (psetup_six_ttbar01j)
(rsetupGen p MLM NoUserCutDef NoPGS 20000 num)
my_csetup
| p <- sixparamset , num <- sets ] | 216 | false | true | 0 | 8 | 99 | 61 | 32 | 29 | null | null |
mhwombat/creatur-examples | src/Tutorial/Chapter7/Plant.hs | bsd-3-clause | run _ = return [] | 17 | run _ = return [] | 17 | run _ = return [] | 17 | false | false | 0 | 6 | 4 | 15 | 6 | 9 | null | null |
rawlep/EQS | esit.hs | mit | isVar :: Expr -> Bool
isVar Var = True | 47 | isVar :: Expr -> Bool
isVar Var = True | 47 | isVar Var = True | 25 | false | true | 0 | 5 | 17 | 18 | 9 | 9 | null | null |
7lb/tsp-haskell | tsp.hs | mit | elite 0 _ = [] | 15 | elite 0 _ = [] | 15 | elite 0 _ = [] | 15 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
rvion/ride | jetpack-gen/src/Gen/Iface.hs | bsd-3-clause | -- toReexportableTerm :: IfaceDecl -> ReexportableTerm
-- toReexportableTerm x =
showIfaceKind :: IfaceDecl -> String
showIfaceKind x = case x of
IfaceId{} -> "IfaceId"
IfaceData{} -> "IfaceData"
IfaceSynonym{ifTyVars} -> "IfaceSynonym: "
IfaceFamily{} -> "IfaceFamily"
IfaceClass{} -> "IfaceClass"
IfaceAxiom{} -> "IfaceAxiom"
IfacePatSyn{} -> "IfacePatSyn" | 373 | showIfaceKind :: IfaceDecl -> String
showIfaceKind x = case x of
IfaceId{} -> "IfaceId"
IfaceData{} -> "IfaceData"
IfaceSynonym{ifTyVars} -> "IfaceSynonym: "
IfaceFamily{} -> "IfaceFamily"
IfaceClass{} -> "IfaceClass"
IfaceAxiom{} -> "IfaceAxiom"
IfacePatSyn{} -> "IfacePatSyn" | 291 | showIfaceKind x = case x of
IfaceId{} -> "IfaceId"
IfaceData{} -> "IfaceData"
IfaceSynonym{ifTyVars} -> "IfaceSynonym: "
IfaceFamily{} -> "IfaceFamily"
IfaceClass{} -> "IfaceClass"
IfaceAxiom{} -> "IfaceAxiom"
IfacePatSyn{} -> "IfacePatSyn" | 254 | true | true | 0 | 9 | 57 | 100 | 50 | 50 | null | null |
alexander-at-github/eta | compiler/ETA/TypeCheck/TcPluginM.hs | bsd-3-clause | newFlexiTyVar :: Kind -> TcPluginM TcTyVar
newFlexiTyVar = unsafeTcPluginTcM . TcMType.newFlexiTyVar | 100 | newFlexiTyVar :: Kind -> TcPluginM TcTyVar
newFlexiTyVar = unsafeTcPluginTcM . TcMType.newFlexiTyVar | 100 | newFlexiTyVar = unsafeTcPluginTcM . TcMType.newFlexiTyVar | 57 | false | true | 0 | 6 | 10 | 24 | 12 | 12 | null | null |
wavewave/enumerator-util | src/Data/Enumerator/Util.hs | bsd-2-clause | enumZip
:: (Monad m)
=> Iteratee s m a
-> Iteratee s m b
-> Iteratee s m (a, b)
enumZip x y = continue step
where
step (Chunks []) = continue step
step (Chunks str) = do
sx <- (lift.runIteratee) . (enumWholeChunk str) =<< (lift.runIteratee) x
sy <- (lift.runIteratee) . (enumWholeChunk str) =<< (lift.runIteratee) y
case (sx,sy) of
(Continue cx, Continue cy) -> enumZip (continue cx) (continue cy)
(Yield rx _xstr, Continue cy) -> enumZip (yield rx (Chunks [])) (continue cy)
(Continue cx, Yield ry _ystr) -> enumZip (continue cx) (yield ry (Chunks []))
(Yield rx xstr, Yield ry ystr) -> yield (rx,ry) (shorter xstr ystr)
(Error e, _) -> returnI (Error e)
(_, Error e) -> returnI (Error e)
step EOF = do
sx <- lift $ runIteratee x
sy <- lift $ runIteratee y
liftM2 (,) (enumEOF sx) (enumEOF sy)
shorter c1@(Chunks xs) c2@(Chunks ys)
| Prelude.length xs < Prelude.length ys = c1
| otherwise = c2
shorter EOF _ = EOF
shorter _ EOF = EOF
| 1,087 | enumZip
:: (Monad m)
=> Iteratee s m a
-> Iteratee s m b
-> Iteratee s m (a, b)
enumZip x y = continue step
where
step (Chunks []) = continue step
step (Chunks str) = do
sx <- (lift.runIteratee) . (enumWholeChunk str) =<< (lift.runIteratee) x
sy <- (lift.runIteratee) . (enumWholeChunk str) =<< (lift.runIteratee) y
case (sx,sy) of
(Continue cx, Continue cy) -> enumZip (continue cx) (continue cy)
(Yield rx _xstr, Continue cy) -> enumZip (yield rx (Chunks [])) (continue cy)
(Continue cx, Yield ry _ystr) -> enumZip (continue cx) (yield ry (Chunks []))
(Yield rx xstr, Yield ry ystr) -> yield (rx,ry) (shorter xstr ystr)
(Error e, _) -> returnI (Error e)
(_, Error e) -> returnI (Error e)
step EOF = do
sx <- lift $ runIteratee x
sy <- lift $ runIteratee y
liftM2 (,) (enumEOF sx) (enumEOF sy)
shorter c1@(Chunks xs) c2@(Chunks ys)
| Prelude.length xs < Prelude.length ys = c1
| otherwise = c2
shorter EOF _ = EOF
shorter _ EOF = EOF
| 1,087 | enumZip x y = continue step
where
step (Chunks []) = continue step
step (Chunks str) = do
sx <- (lift.runIteratee) . (enumWholeChunk str) =<< (lift.runIteratee) x
sy <- (lift.runIteratee) . (enumWholeChunk str) =<< (lift.runIteratee) y
case (sx,sy) of
(Continue cx, Continue cy) -> enumZip (continue cx) (continue cy)
(Yield rx _xstr, Continue cy) -> enumZip (yield rx (Chunks [])) (continue cy)
(Continue cx, Yield ry _ystr) -> enumZip (continue cx) (yield ry (Chunks []))
(Yield rx xstr, Yield ry ystr) -> yield (rx,ry) (shorter xstr ystr)
(Error e, _) -> returnI (Error e)
(_, Error e) -> returnI (Error e)
step EOF = do
sx <- lift $ runIteratee x
sy <- lift $ runIteratee y
liftM2 (,) (enumEOF sx) (enumEOF sy)
shorter c1@(Chunks xs) c2@(Chunks ys)
| Prelude.length xs < Prelude.length ys = c1
| otherwise = c2
shorter EOF _ = EOF
shorter _ EOF = EOF
| 997 | false | true | 0 | 15 | 322 | 540 | 263 | 277 | null | null |
tjakway/ghcjvm | compiler/prelude/TysWiredIn.hs | bsd-3-clause | charTyCon :: TyCon
charTyCon = pcNonRecDataTyCon charTyConName
(Just (CType "" Nothing ("HsChar",fsLit "HsChar")))
[] [charDataCon] | 179 | charTyCon :: TyCon
charTyCon = pcNonRecDataTyCon charTyConName
(Just (CType "" Nothing ("HsChar",fsLit "HsChar")))
[] [charDataCon] | 179 | charTyCon = pcNonRecDataTyCon charTyConName
(Just (CType "" Nothing ("HsChar",fsLit "HsChar")))
[] [charDataCon] | 160 | false | true | 0 | 11 | 62 | 56 | 27 | 29 | null | null |
hpacheco/HAAP | examples/plab/oracle/OracleT1.hs | mit | blocoRampa Sobe Este = Peca (Rampa Este) | 41 | blocoRampa Sobe Este = Peca (Rampa Este) | 41 | blocoRampa Sobe Este = Peca (Rampa Este) | 41 | false | false | 0 | 7 | 7 | 20 | 9 | 11 | null | null |
nikita-volkov/record | library/Record/TH.hs | mit | instanceDCompat =
InstanceD Nothing | 37 | instanceDCompat =
InstanceD Nothing | 37 | instanceDCompat =
InstanceD Nothing | 37 | false | false | 1 | 5 | 5 | 13 | 4 | 9 | null | null |
sopvop/heist | test/suite/Heist/Tests.hs | bsd-3-clause | backslashHandlingTest :: IO ()
backslashHandlingTest = do
hs <- loadHS "templates"
cOut <- cRender hs "backslash"
H.assertEqual "compiled failure" cExpected cOut
iOut <- iRender hs "backslash"
H.assertEqual "interpreted failure" iExpected iOut
where
cExpected = "<foo regex='abc\\d+\\\\e'></foo> "
iExpected = "<foo regex='abc\\d+\\\\e'></foo>\n" | 381 | backslashHandlingTest :: IO ()
backslashHandlingTest = do
hs <- loadHS "templates"
cOut <- cRender hs "backslash"
H.assertEqual "compiled failure" cExpected cOut
iOut <- iRender hs "backslash"
H.assertEqual "interpreted failure" iExpected iOut
where
cExpected = "<foo regex='abc\\d+\\\\e'></foo> "
iExpected = "<foo regex='abc\\d+\\\\e'></foo>\n" | 381 | backslashHandlingTest = do
hs <- loadHS "templates"
cOut <- cRender hs "backslash"
H.assertEqual "compiled failure" cExpected cOut
iOut <- iRender hs "backslash"
H.assertEqual "interpreted failure" iExpected iOut
where
cExpected = "<foo regex='abc\\d+\\\\e'></foo> "
iExpected = "<foo regex='abc\\d+\\\\e'></foo>\n" | 350 | false | true | 0 | 8 | 70 | 87 | 39 | 48 | null | null |
iteloo/tsuru-sample | iteratee-0.8.9.6/bench/BenchIO.hs | bsd-3-clause | testHdString :: IO ()
testHdString = fileDriverHandle bufSize len file >> return ()
where
len :: Monad m => Iteratee String m Int
len = length | 148 | testHdString :: IO ()
testHdString = fileDriverHandle bufSize len file >> return ()
where
len :: Monad m => Iteratee String m Int
len = length | 148 | testHdString = fileDriverHandle bufSize len file >> return ()
where
len :: Monad m => Iteratee String m Int
len = length | 126 | false | true | 0 | 7 | 31 | 59 | 28 | 31 | null | null |
kaoskorobase/hsc3-server | Sound/SC3/Server/State/Monad/Command.hs | gpl-2.0 | statusM :: (MonadIdAllocator m, RequestOSC m, MonadIO m) => m N.Status
statusM = get status | 91 | statusM :: (MonadIdAllocator m, RequestOSC m, MonadIO m) => m N.Status
statusM = get status | 91 | statusM = get status | 20 | false | true | 0 | 7 | 14 | 40 | 20 | 20 | null | null |
tmcgilchrist/scheme | src/Scheme/Parser.hs | bsd-3-clause | readExprList :: T.Text -> ThrowsError [LispVal]
readExprList = readOrThrow (endBy parseExpr spaces) | 99 | readExprList :: T.Text -> ThrowsError [LispVal]
readExprList = readOrThrow (endBy parseExpr spaces) | 99 | readExprList = readOrThrow (endBy parseExpr spaces) | 51 | false | true | 0 | 7 | 11 | 34 | 17 | 17 | null | null |
antalsz/hs-to-coq | examples/ghc/gen-files/Lexer.hs | mit | always :: ExtsBitmap -> Bool
always _ = True | 58 | always :: ExtsBitmap -> Bool
always _ = True | 58 | always _ = True | 29 | false | true | 0 | 5 | 22 | 18 | 9 | 9 | null | null |
plow-technologies/valentine | test/Valentine/ParserSpec.hs | mit | --------------------------------------------------
-- Line Parser Tests
--------------------------------------------------
quotedStringNoSpaces = [here|
<div>
<section id="hello-app">
<header id="header">
<div>
Hello
<div>
pumpernell
<div>
Guffman
|] | 342 | quotedStringNoSpaces = [here|
<div>
<section id="hello-app">
<header id="header">
<div>
Hello
<div>
pumpernell
<div>
Guffman
|] | 219 | quotedStringNoSpaces = [here|
<div>
<section id="hello-app">
<header id="header">
<div>
Hello
<div>
pumpernell
<div>
Guffman
|] | 219 | true | false | 1 | 5 | 112 | 17 | 10 | 7 | null | null |
sgillespie/ca-disease-simulator | test/QCTests.hs | mit | tests :: IO [Test]
tests = return [testGroup "Universe tests" universeTests,
testGroup "Universe2 tests" universe2Tests,
testGroup "Disease tests" diseaseTests,
testGroup "Vaccine tests" vaccineTests]
where universeTests = [testProperty "extract = focused element" prop_extract_id,
testProperty "extract . left = head ls" prop_left_id,
testProperty "left u = u" prop_left_eq,
testProperty "extract . right = right ls" prop_right_id,
testProperty "right u = u" prop_right_eq,
testProperty "fmap id u = u" prop_fmap_id,
testProperty "extract . duplicate = u" prop_duplicate_id,
testProperty "size = size . duplicate" prop_duplicate_len,
testProperty "neighbors u = [left, extract, right]"
prop_neighbors_id,
testProperty "(u =>> extract) == u" prop_rule_id]
universe2Tests = [testProperty "extract . duplicate = u" prop_duplicate2_id,
testProperty "size = size . duplicate" prop_duplicate2_len,
testProperty "neighbors u = [up, left, extract, right, down]"
prop_neighbors2_id,
testProperty "(u =>> extract) == u" prop_rule2_id]
diseaseTests = [testProperty "size genDisease = 1" prop_gendisease_infected,
testProperty "size genDisease2 = 1" prop_gendisease2_infected]
vaccineTests = [testProperty "size infected = (size . vaccinate) infected"
prop_vaccinate_id]
-- -- --
-- Universe Tests | 1,953 | tests :: IO [Test]
tests = return [testGroup "Universe tests" universeTests,
testGroup "Universe2 tests" universe2Tests,
testGroup "Disease tests" diseaseTests,
testGroup "Vaccine tests" vaccineTests]
where universeTests = [testProperty "extract = focused element" prop_extract_id,
testProperty "extract . left = head ls" prop_left_id,
testProperty "left u = u" prop_left_eq,
testProperty "extract . right = right ls" prop_right_id,
testProperty "right u = u" prop_right_eq,
testProperty "fmap id u = u" prop_fmap_id,
testProperty "extract . duplicate = u" prop_duplicate_id,
testProperty "size = size . duplicate" prop_duplicate_len,
testProperty "neighbors u = [left, extract, right]"
prop_neighbors_id,
testProperty "(u =>> extract) == u" prop_rule_id]
universe2Tests = [testProperty "extract . duplicate = u" prop_duplicate2_id,
testProperty "size = size . duplicate" prop_duplicate2_len,
testProperty "neighbors u = [up, left, extract, right, down]"
prop_neighbors2_id,
testProperty "(u =>> extract) == u" prop_rule2_id]
diseaseTests = [testProperty "size genDisease = 1" prop_gendisease_infected,
testProperty "size genDisease2 = 1" prop_gendisease2_infected]
vaccineTests = [testProperty "size infected = (size . vaccinate) infected"
prop_vaccinate_id]
-- -- --
-- Universe Tests | 1,953 | tests = return [testGroup "Universe tests" universeTests,
testGroup "Universe2 tests" universe2Tests,
testGroup "Disease tests" diseaseTests,
testGroup "Vaccine tests" vaccineTests]
where universeTests = [testProperty "extract = focused element" prop_extract_id,
testProperty "extract . left = head ls" prop_left_id,
testProperty "left u = u" prop_left_eq,
testProperty "extract . right = right ls" prop_right_id,
testProperty "right u = u" prop_right_eq,
testProperty "fmap id u = u" prop_fmap_id,
testProperty "extract . duplicate = u" prop_duplicate_id,
testProperty "size = size . duplicate" prop_duplicate_len,
testProperty "neighbors u = [left, extract, right]"
prop_neighbors_id,
testProperty "(u =>> extract) == u" prop_rule_id]
universe2Tests = [testProperty "extract . duplicate = u" prop_duplicate2_id,
testProperty "size = size . duplicate" prop_duplicate2_len,
testProperty "neighbors u = [up, left, extract, right, down]"
prop_neighbors2_id,
testProperty "(u =>> extract) == u" prop_rule2_id]
diseaseTests = [testProperty "size genDisease = 1" prop_gendisease_infected,
testProperty "size genDisease2 = 1" prop_gendisease2_infected]
vaccineTests = [testProperty "size infected = (size . vaccinate) infected"
prop_vaccinate_id]
-- -- --
-- Universe Tests | 1,934 | false | true | 3 | 7 | 826 | 217 | 109 | 108 | null | null |
acowley/ghc | compiler/coreSyn/MkCore.hs | bsd-3-clause | mkCoreTup cs = mkConApp (tupleDataCon Boxed (length cs))
(map (Type . exprType) cs ++ cs) | 115 | mkCoreTup cs = mkConApp (tupleDataCon Boxed (length cs))
(map (Type . exprType) cs ++ cs) | 115 | mkCoreTup cs = mkConApp (tupleDataCon Boxed (length cs))
(map (Type . exprType) cs ++ cs) | 115 | false | false | 0 | 10 | 40 | 47 | 23 | 24 | null | null |
ArturB/Multilinear | benchmark/3-cores/time/Bench.hs | gpl-3.0 | -- | ENTRY POINT
main :: IO ()
main = defaultMainWith defaultConfig { reportFile = Just "benchmark/3-cores-bench.html" } [
bgroup "matrix addition" $ sizedMatrixAddBench <$> [64, 128, 256, 512, 1024],
bgroup "matrix multiplication" $ sizedMatrixMultBench <$> [64, 128, 256, 512, 1024]
] | 298 | main :: IO ()
main = defaultMainWith defaultConfig { reportFile = Just "benchmark/3-cores-bench.html" } [
bgroup "matrix addition" $ sizedMatrixAddBench <$> [64, 128, 256, 512, 1024],
bgroup "matrix multiplication" $ sizedMatrixMultBench <$> [64, 128, 256, 512, 1024]
] | 281 | main = defaultMainWith defaultConfig { reportFile = Just "benchmark/3-cores-bench.html" } [
bgroup "matrix addition" $ sizedMatrixAddBench <$> [64, 128, 256, 512, 1024],
bgroup "matrix multiplication" $ sizedMatrixMultBench <$> [64, 128, 256, 512, 1024]
] | 267 | true | true | 0 | 9 | 53 | 96 | 52 | 44 | null | null |
phadej/range-set-list | tests/Map.hs | mit | lookupGEProp :: Int -> RSetAction Int -> Property
lookupGEProp x seta = Set.lookupGE x (rangeToSet seta) === RSet.lookupGE x (rangeToRSet seta) | 143 | lookupGEProp :: Int -> RSetAction Int -> Property
lookupGEProp x seta = Set.lookupGE x (rangeToSet seta) === RSet.lookupGE x (rangeToRSet seta) | 143 | lookupGEProp x seta = Set.lookupGE x (rangeToSet seta) === RSet.lookupGE x (rangeToRSet seta) | 93 | false | true | 0 | 8 | 20 | 61 | 28 | 33 | null | null |
jaiyalas/creepy-waffle | _sdl2+fwgl/aho.hs | mit | main :: IO ()
main = do
SDL.initialize [SDL.InitVideo]
SDL.HintRenderScaleQuality $= SDL.ScaleLinear
do renderQuality <- SDL.get SDL.HintRenderScaleQuality
when (renderQuality /= SDL.ScaleLinear) $
putStrLn "Warning: Linear texture filtering not enabled!"
window <-
SDL.createWindow
"SDL / OpenGL Example"
SDL.defaultWindow {SDL.windowInitialSize = V2 screenWidth screenHeight,
SDL.windowOpenGL = Just SDL.defaultOpenGL}
SDL.showWindow window
_ <- SDL.glCreateContext(window)
(prog, attrib) <- initResources
let loop = do
let collectEvents = do
e <- SDL.pollEvent
case e of
Nothing -> return []
Just e' -> (e' :) <$> collectEvents
events <- collectEvents
let quit = any (== SDL.QuitEvent) $ map SDL.eventPayload events
GL.clear [GL.ColorBuffer]
draw prog attrib
SDL.glSwapWindow window
unless quit (loop)
loop
SDL.destroyWindow window
SDL.quit | 1,041 | main :: IO ()
main = do
SDL.initialize [SDL.InitVideo]
SDL.HintRenderScaleQuality $= SDL.ScaleLinear
do renderQuality <- SDL.get SDL.HintRenderScaleQuality
when (renderQuality /= SDL.ScaleLinear) $
putStrLn "Warning: Linear texture filtering not enabled!"
window <-
SDL.createWindow
"SDL / OpenGL Example"
SDL.defaultWindow {SDL.windowInitialSize = V2 screenWidth screenHeight,
SDL.windowOpenGL = Just SDL.defaultOpenGL}
SDL.showWindow window
_ <- SDL.glCreateContext(window)
(prog, attrib) <- initResources
let loop = do
let collectEvents = do
e <- SDL.pollEvent
case e of
Nothing -> return []
Just e' -> (e' :) <$> collectEvents
events <- collectEvents
let quit = any (== SDL.QuitEvent) $ map SDL.eventPayload events
GL.clear [GL.ColorBuffer]
draw prog attrib
SDL.glSwapWindow window
unless quit (loop)
loop
SDL.destroyWindow window
SDL.quit | 1,041 | main = do
SDL.initialize [SDL.InitVideo]
SDL.HintRenderScaleQuality $= SDL.ScaleLinear
do renderQuality <- SDL.get SDL.HintRenderScaleQuality
when (renderQuality /= SDL.ScaleLinear) $
putStrLn "Warning: Linear texture filtering not enabled!"
window <-
SDL.createWindow
"SDL / OpenGL Example"
SDL.defaultWindow {SDL.windowInitialSize = V2 screenWidth screenHeight,
SDL.windowOpenGL = Just SDL.defaultOpenGL}
SDL.showWindow window
_ <- SDL.glCreateContext(window)
(prog, attrib) <- initResources
let loop = do
let collectEvents = do
e <- SDL.pollEvent
case e of
Nothing -> return []
Just e' -> (e' :) <$> collectEvents
events <- collectEvents
let quit = any (== SDL.QuitEvent) $ map SDL.eventPayload events
GL.clear [GL.ColorBuffer]
draw prog attrib
SDL.glSwapWindow window
unless quit (loop)
loop
SDL.destroyWindow window
SDL.quit | 1,027 | false | true | 4 | 17 | 304 | 289 | 143 | 146 | null | null |
frms-/aws | Aws/DynamoDb/Core.hs | bsd-3-clause | ddbApSe2 :: Region
ddbApSe2 = Region "dynamodb.ap-southeast-2.amazonaws.com" "ap-southeast-2" | 93 | ddbApSe2 :: Region
ddbApSe2 = Region "dynamodb.ap-southeast-2.amazonaws.com" "ap-southeast-2" | 93 | ddbApSe2 = Region "dynamodb.ap-southeast-2.amazonaws.com" "ap-southeast-2" | 74 | false | true | 0 | 5 | 7 | 16 | 8 | 8 | null | null |
bergmark/hakyll | src/Hakyll/Core/Provider/Internal.hs | bsd-3-clause | resourceList :: Provider -> [Identifier]
resourceList = M.keys . providerFiles | 78 | resourceList :: Provider -> [Identifier]
resourceList = M.keys . providerFiles | 78 | resourceList = M.keys . providerFiles | 37 | false | true | 0 | 6 | 9 | 24 | 13 | 11 | null | null |
nikki-and-the-robots/nikki | src/Data/Indexable/Range.hs | lgpl-3.0 | fmapMWithIndex :: (Monad m, Functor m) => Range -> (Index -> a -> m a)
-> Indexable a -> m (Indexable a)
fmapMWithIndex (SimpleRange lower upper) cmd (Indexable values) = do
let (prefix, rest) = V.splitAt lower values
(unprocessedMiddle, suffix) = V.splitAt (succ upper - lower) rest
processedMiddle <- fmapM (\ (i, v) -> tuple i <$> cmd i v) unprocessedMiddle
return $ Indexable (prefix V.++ processedMiddle V.++ suffix) | 445 | fmapMWithIndex :: (Monad m, Functor m) => Range -> (Index -> a -> m a)
-> Indexable a -> m (Indexable a)
fmapMWithIndex (SimpleRange lower upper) cmd (Indexable values) = do
let (prefix, rest) = V.splitAt lower values
(unprocessedMiddle, suffix) = V.splitAt (succ upper - lower) rest
processedMiddle <- fmapM (\ (i, v) -> tuple i <$> cmd i v) unprocessedMiddle
return $ Indexable (prefix V.++ processedMiddle V.++ suffix) | 445 | fmapMWithIndex (SimpleRange lower upper) cmd (Indexable values) = do
let (prefix, rest) = V.splitAt lower values
(unprocessedMiddle, suffix) = V.splitAt (succ upper - lower) rest
processedMiddle <- fmapM (\ (i, v) -> tuple i <$> cmd i v) unprocessedMiddle
return $ Indexable (prefix V.++ processedMiddle V.++ suffix) | 336 | false | true | 0 | 13 | 92 | 201 | 99 | 102 | null | null |
sdiehl/ghc | testsuite/tests/typecheck/should_compile/tc220.hs | bsd-3-clause | rename2 _ = everywhereM (mkM (\e -> case e of HsWildCard -> return e)) | 71 | rename2 _ = everywhereM (mkM (\e -> case e of HsWildCard -> return e)) | 71 | rename2 _ = everywhereM (mkM (\e -> case e of HsWildCard -> return e)) | 71 | false | false | 0 | 13 | 14 | 39 | 19 | 20 | null | null |
AlexeyRaga/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | orderingTyConKey = mkPreludeTyConUnique 30 | 65 | orderingTyConKey = mkPreludeTyConUnique 30 | 65 | orderingTyConKey = mkPreludeTyConUnique 30 | 65 | false | false | 0 | 5 | 26 | 9 | 4 | 5 | null | null |
mgsloan/airship | src/Airship/Internal/Decision.hs | mit | h10 r@Resource{..} = do
trace "h10"
req <- lift request
let reqHeaders = requestHeaders req
case lookup hIfUnmodifiedSince reqHeaders of
(Just _h) ->
h11 r
Nothing ->
i12 r | 228 | h10 r@Resource{..} = do
trace "h10"
req <- lift request
let reqHeaders = requestHeaders req
case lookup hIfUnmodifiedSince reqHeaders of
(Just _h) ->
h11 r
Nothing ->
i12 r | 228 | h10 r@Resource{..} = do
trace "h10"
req <- lift request
let reqHeaders = requestHeaders req
case lookup hIfUnmodifiedSince reqHeaders of
(Just _h) ->
h11 r
Nothing ->
i12 r | 228 | false | false | 1 | 12 | 84 | 86 | 36 | 50 | null | null |
katydid/haslapse | src/Data/Katydid/Relapse/Smart.hs | bsd-3-clause | leavesThenNamesAndThenContains :: Pattern -> Pattern -> Ordering
leavesThenNamesAndThenContains a@Node{} b@Node{} = leavesFirst a b | 131 | leavesThenNamesAndThenContains :: Pattern -> Pattern -> Ordering
leavesThenNamesAndThenContains a@Node{} b@Node{} = leavesFirst a b | 131 | leavesThenNamesAndThenContains a@Node{} b@Node{} = leavesFirst a b | 66 | false | true | 0 | 7 | 13 | 43 | 22 | 21 | null | null |
facebookincubator/duckling | tests/Duckling/Volume/FR/Tests.hs | bsd-3-clause | tests :: TestTree
tests = testGroup "FR Tests"
[ makeCorpusTest [Seal Volume] corpus
] | 90 | tests :: TestTree
tests = testGroup "FR Tests"
[ makeCorpusTest [Seal Volume] corpus
] | 90 | tests = testGroup "FR Tests"
[ makeCorpusTest [Seal Volume] corpus
] | 72 | false | true | 0 | 9 | 17 | 38 | 16 | 22 | null | null |
lamdu/lamdu | src/Lamdu/GUI/StatusBar/Common.hs | gpl-3.0 | hamburgerLabel :: _ => m (M.TextWidget f)
hamburgerLabel =
do
toFocusable <- Widget.makeFocusableView
Label.make hamburgerText <&> M.tValue %~ toFocusable WidgetIds.statusBarHamburger
& Styled.info
-- | Generate an invisible hamburger that responds to cursor so we
-- don't get a red cursor if the hamburger disappears with the cursor
-- on it | 376 | hamburgerLabel :: _ => m (M.TextWidget f)
hamburgerLabel =
do
toFocusable <- Widget.makeFocusableView
Label.make hamburgerText <&> M.tValue %~ toFocusable WidgetIds.statusBarHamburger
& Styled.info
-- | Generate an invisible hamburger that responds to cursor so we
-- don't get a red cursor if the hamburger disappears with the cursor
-- on it | 376 | hamburgerLabel =
do
toFocusable <- Widget.makeFocusableView
Label.make hamburgerText <&> M.tValue %~ toFocusable WidgetIds.statusBarHamburger
& Styled.info
-- | Generate an invisible hamburger that responds to cursor so we
-- don't get a red cursor if the hamburger disappears with the cursor
-- on it | 334 | false | true | 0 | 11 | 82 | 68 | 33 | 35 | null | null |
liamoc/tea-hs | Tea/Input.hs | bsd-3-clause | sdlKey SDL.SDLK_CARET = KeyCaret | 39 | sdlKey SDL.SDLK_CARET = KeyCaret | 39 | sdlKey SDL.SDLK_CARET = KeyCaret | 39 | false | false | 0 | 6 | 10 | 11 | 5 | 6 | null | null |
FranklinChen/hugs98-plus-Sep2006 | packages/base/Data/IntMap.hs | bsd-3-clause | -- | /O(n)/. Filter all keys\/values that satisfy some predicate.
filterWithKey :: (Key -> a -> Bool) -> IntMap a -> IntMap a
filterWithKey pred t
= case t of
Bin p m l r
-> bin p m (filterWithKey pred l) (filterWithKey pred r)
Tip k x
| pred k x -> t
| otherwise -> Nil
Nil -> Nil
-- | /O(n)/. partition the map according to some predicate. The first
-- map contains all elements that satisfy the predicate, the second all
-- elements that fail the predicate. See also 'split'. | 526 | filterWithKey :: (Key -> a -> Bool) -> IntMap a -> IntMap a
filterWithKey pred t
= case t of
Bin p m l r
-> bin p m (filterWithKey pred l) (filterWithKey pred r)
Tip k x
| pred k x -> t
| otherwise -> Nil
Nil -> Nil
-- | /O(n)/. partition the map according to some predicate. The first
-- map contains all elements that satisfy the predicate, the second all
-- elements that fail the predicate. See also 'split'. | 460 | filterWithKey pred t
= case t of
Bin p m l r
-> bin p m (filterWithKey pred l) (filterWithKey pred r)
Tip k x
| pred k x -> t
| otherwise -> Nil
Nil -> Nil
-- | /O(n)/. partition the map according to some predicate. The first
-- map contains all elements that satisfy the predicate, the second all
-- elements that fail the predicate. See also 'split'. | 400 | true | true | 0 | 11 | 141 | 126 | 61 | 65 | null | null |
plaimi/authochan | test/Authochan/Tests/HTTP.hs | agpl-3.0 | propStripRequest :: Gen Property
propStripRequest = do
r <- genSignedSRequest
r' <- mutateSRequest r
return $ counterexample (s r ++ "\n" ++ s r')
$ (stripRequest r == stripRequest r') === (m r == m r')
where m (SRequest r b) = requestToMessage r (hashlazy b)
s sr@(SRequest r b) = show (r, b, stripRequest sr) | 337 | propStripRequest :: Gen Property
propStripRequest = do
r <- genSignedSRequest
r' <- mutateSRequest r
return $ counterexample (s r ++ "\n" ++ s r')
$ (stripRequest r == stripRequest r') === (m r == m r')
where m (SRequest r b) = requestToMessage r (hashlazy b)
s sr@(SRequest r b) = show (r, b, stripRequest sr) | 337 | propStripRequest = do
r <- genSignedSRequest
r' <- mutateSRequest r
return $ counterexample (s r ++ "\n" ++ s r')
$ (stripRequest r == stripRequest r') === (m r == m r')
where m (SRequest r b) = requestToMessage r (hashlazy b)
s sr@(SRequest r b) = show (r, b, stripRequest sr) | 304 | false | true | 1 | 14 | 82 | 155 | 74 | 81 | null | null |
conal/DeepArrow | src/Language/Haskell/Parens.hs | bsd-3-clause | getName (Special s) = HsIdent (specialName s) | 45 | getName (Special s) = HsIdent (specialName s) | 45 | getName (Special s) = HsIdent (specialName s) | 45 | false | false | 0 | 7 | 6 | 25 | 11 | 14 | null | null |
meiersi/system-io-write | src/Codec/Bounded/Encoding/Utf8.hs | bsd-3-clause | word32Dec :: Encoding Word32
word32Dec = encodeWordDecimal 10 | 61 | word32Dec :: Encoding Word32
word32Dec = encodeWordDecimal 10 | 61 | word32Dec = encodeWordDecimal 10 | 32 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
lambda-llama/mnogo | src/Database/Mongodb/Protocol.hs | mit | getInt64 :: Get Int64
getInt64 = fmap fromIntegral getWord64le | 62 | getInt64 :: Get Int64
getInt64 = fmap fromIntegral getWord64le | 62 | getInt64 = fmap fromIntegral getWord64le | 40 | false | true | 0 | 6 | 8 | 25 | 10 | 15 | null | null |
sardonicpresence/glucose | src/Glucose/Desugar.hs | mit | desugar :: Error m => AST.Module -> m (IR.Module Unchecked)
desugar (AST.Module defs) = IR.Module . concat <$> traverse definition defs | 136 | desugar :: Error m => AST.Module -> m (IR.Module Unchecked)
desugar (AST.Module defs) = IR.Module . concat <$> traverse definition defs | 135 | desugar (AST.Module defs) = IR.Module . concat <$> traverse definition defs | 75 | false | true | 0 | 10 | 21 | 61 | 29 | 32 | null | null |
mudphone/HaskellBook | src/TwentyOne.hs | mit | take' :: Int -> List a -> List a
take' n as = go n Nil as
where go _ acc Nil = acc
go 0 acc _ = acc
go n acc (Cons x xs) = go (n - 1) (acc `append` (Cons x Nil)) xs | 184 | take' :: Int -> List a -> List a
take' n as = go n Nil as
where go _ acc Nil = acc
go 0 acc _ = acc
go n acc (Cons x xs) = go (n - 1) (acc `append` (Cons x Nil)) xs | 184 | take' n as = go n Nil as
where go _ acc Nil = acc
go 0 acc _ = acc
go n acc (Cons x xs) = go (n - 1) (acc `append` (Cons x Nil)) xs | 151 | false | true | 2 | 9 | 66 | 114 | 57 | 57 | null | null |
josuf107/Adverb | Adverb/Common.hs | gpl-3.0 | imaginatively = id | 18 | imaginatively = id | 18 | imaginatively = id | 18 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
abakst/liquidhaskell | src/Language/Haskell/Liquid/Constraint/Split.hs | bsd-3-clause | unifyVV _ _
= errorstar $ "Constraint.Generate.unifyVV called on invalid inputs" | 82 | unifyVV _ _
= errorstar $ "Constraint.Generate.unifyVV called on invalid inputs" | 82 | unifyVV _ _
= errorstar $ "Constraint.Generate.unifyVV called on invalid inputs" | 82 | false | false | 0 | 5 | 12 | 15 | 7 | 8 | null | null |
hBPF/hBPF | HBPF/Internal.hs | bsd-3-clause | printBPFInstr (IDiv a) = "div " ++ toString a | 52 | printBPFInstr (IDiv a) = "div " ++ toString a | 52 | printBPFInstr (IDiv a) = "div " ++ toString a | 52 | false | false | 0 | 7 | 15 | 22 | 10 | 12 | null | null |
green-haskell/ghc | compiler/main/Packages.hs | bsd-3-clause | pprReason :: SDoc -> UnusablePackageReason -> SDoc
pprReason pref reason = case reason of
IgnoredWithFlag ->
pref <+> ptext (sLit "ignored due to an -ignore-package flag")
MissingDependencies deps ->
pref <+>
ptext (sLit "unusable due to missing or recursive dependencies:") $$
nest 2 (hsep (map ppr deps))
ShadowedBy ipid ->
pref <+> ptext (sLit "shadowed by package ") <> ppr ipid | 420 | pprReason :: SDoc -> UnusablePackageReason -> SDoc
pprReason pref reason = case reason of
IgnoredWithFlag ->
pref <+> ptext (sLit "ignored due to an -ignore-package flag")
MissingDependencies deps ->
pref <+>
ptext (sLit "unusable due to missing or recursive dependencies:") $$
nest 2 (hsep (map ppr deps))
ShadowedBy ipid ->
pref <+> ptext (sLit "shadowed by package ") <> ppr ipid | 420 | pprReason pref reason = case reason of
IgnoredWithFlag ->
pref <+> ptext (sLit "ignored due to an -ignore-package flag")
MissingDependencies deps ->
pref <+>
ptext (sLit "unusable due to missing or recursive dependencies:") $$
nest 2 (hsep (map ppr deps))
ShadowedBy ipid ->
pref <+> ptext (sLit "shadowed by package ") <> ppr ipid | 369 | false | true | 6 | 9 | 98 | 119 | 57 | 62 | null | null |
kumasento/accelerate | Data/Array/Accelerate/Language.hs | bsd-3-clause | stencil2 :: (Shape ix, Elt a, Elt b, Elt c,
Stencil ix a stencil1,
Stencil ix b stencil2)
=> (stencil1 -> stencil2 -> Exp c) -- ^binary stencil function
-> Boundary a -- ^boundary condition #1
-> Acc (Array ix a) -- ^source array #1
-> Boundary b -- ^boundary condition #2
-> Acc (Array ix b) -- ^source array #2
-> Acc (Array ix c) -- ^destination array
stencil2 = Acc $$$$$ Stencil2 | 563 | stencil2 :: (Shape ix, Elt a, Elt b, Elt c,
Stencil ix a stencil1,
Stencil ix b stencil2)
=> (stencil1 -> stencil2 -> Exp c) -- ^binary stencil function
-> Boundary a -- ^boundary condition #1
-> Acc (Array ix a) -- ^source array #1
-> Boundary b -- ^boundary condition #2
-> Acc (Array ix b) -- ^source array #2
-> Acc (Array ix c)
stencil2 = Acc $$$$$ Stencil2 | 523 | stencil2 = Acc $$$$$ Stencil2 | 29 | true | true | 0 | 13 | 252 | 141 | 72 | 69 | null | null |
rolph-recto/liquid-fixpoint | src/Language/Fixpoint/Types/Refinements.hs | bsd-3-clause | eApps :: Expr -> [Expr] -> Expr
eApps f es = foldl EApp f es | 62 | eApps :: Expr -> [Expr] -> Expr
eApps f es = foldl EApp f es | 61 | eApps f es = foldl EApp f es | 29 | false | true | 0 | 7 | 16 | 38 | 18 | 20 | null | null |
janschulz/pandoc | src/Text/Pandoc/Readers/Docx/Parse.hs | gpl-2.0 | elemToBodyPart :: NameSpaces -> Element -> D BodyPart
elemToBodyPart ns element
| isElem ns "w" "p" element
, (c:_) <- findChildren (elemName ns "m" "oMathPara") element =
do
expsLst <- eitherToD $ readOMML $ showElement c
return $ OMathPara expsLst | 275 | elemToBodyPart :: NameSpaces -> Element -> D BodyPart
elemToBodyPart ns element
| isElem ns "w" "p" element
, (c:_) <- findChildren (elemName ns "m" "oMathPara") element =
do
expsLst <- eitherToD $ readOMML $ showElement c
return $ OMathPara expsLst | 275 | elemToBodyPart ns element
| isElem ns "w" "p" element
, (c:_) <- findChildren (elemName ns "m" "oMathPara") element =
do
expsLst <- eitherToD $ readOMML $ showElement c
return $ OMathPara expsLst | 221 | false | true | 0 | 11 | 65 | 100 | 46 | 54 | null | null |
glutamate/space | GeneralizedSignals.hs | bsd-3-clause | sigLims :: Signal a b -> (a,a)
sigLims (Signal d1 lims1 invlims1 arr1) = lims1 | 78 | sigLims :: Signal a b -> (a,a)
sigLims (Signal d1 lims1 invlims1 arr1) = lims1 | 78 | sigLims (Signal d1 lims1 invlims1 arr1) = lims1 | 47 | false | true | 0 | 9 | 14 | 47 | 22 | 25 | null | null |
brendanhay/gogol | gogol-vision/gen/Network/Google/Vision/Types/Product.hs | mpl-2.0 | -- | The resource name of the reference image. Format is:
-- \`projects\/PROJECT_ID\/locations\/LOC_ID\/products\/PRODUCT_ID\/referenceImages\/IMAGE_ID\`.
-- This field is ignored when creating a reference image.
gcvvricName :: Lens' GoogleCloudVisionV1p3beta1ReferenceImage (Maybe Text)
gcvvricName
= lens _gcvvricName (\ s a -> s{_gcvvricName = a}) | 352 | gcvvricName :: Lens' GoogleCloudVisionV1p3beta1ReferenceImage (Maybe Text)
gcvvricName
= lens _gcvvricName (\ s a -> s{_gcvvricName = a}) | 139 | gcvvricName
= lens _gcvvricName (\ s a -> s{_gcvvricName = a}) | 64 | true | true | 1 | 9 | 41 | 53 | 27 | 26 | null | null |
bgwines/filediff | src/Filediff.hs | bsd-3-clause | insertAtProgressiveIndices' curr src@((i,s):src') dest =
if i == curr
then (:) s <$> insertAtProgressiveIndices' (succ curr) src' dest
else case dest of
(d:dest') -> (:) d <$> insertAtProgressiveIndices' (succ curr) src dest'
[] -> Left "Fatal: couldn't apply list diff (application requires inserting at an index larger than the length of the list to which to apply the diff)."
-- all functions below are not exposed
-- don't hit the memotable if not necessary
-- | A wrapper around `longestCommonSubsequence`. It gives a bit of a
-- performance boost; it avoids hitting the memo table to an extent
-- (exactly how much depends on the arguments). | 693 | insertAtProgressiveIndices' curr src@((i,s):src') dest =
if i == curr
then (:) s <$> insertAtProgressiveIndices' (succ curr) src' dest
else case dest of
(d:dest') -> (:) d <$> insertAtProgressiveIndices' (succ curr) src dest'
[] -> Left "Fatal: couldn't apply list diff (application requires inserting at an index larger than the length of the list to which to apply the diff)."
-- all functions below are not exposed
-- don't hit the memotable if not necessary
-- | A wrapper around `longestCommonSubsequence`. It gives a bit of a
-- performance boost; it avoids hitting the memo table to an extent
-- (exactly how much depends on the arguments). | 693 | insertAtProgressiveIndices' curr src@((i,s):src') dest =
if i == curr
then (:) s <$> insertAtProgressiveIndices' (succ curr) src' dest
else case dest of
(d:dest') -> (:) d <$> insertAtProgressiveIndices' (succ curr) src dest'
[] -> Left "Fatal: couldn't apply list diff (application requires inserting at an index larger than the length of the list to which to apply the diff)."
-- all functions below are not exposed
-- don't hit the memotable if not necessary
-- | A wrapper around `longestCommonSubsequence`. It gives a bit of a
-- performance boost; it avoids hitting the memo table to an extent
-- (exactly how much depends on the arguments). | 693 | false | false | 0 | 12 | 151 | 118 | 64 | 54 | null | null |
brendanhay/gogol | gogol-containerbuilder/gen/Network/Google/ContainerBuilder/Types/Product.hs | mpl-2.0 | -- | Time to push all non-container artifacts.
rArtifactTiming :: Lens' Results (Maybe TimeSpan)
rArtifactTiming
= lens _rArtifactTiming
(\ s a -> s{_rArtifactTiming = a}) | 179 | rArtifactTiming :: Lens' Results (Maybe TimeSpan)
rArtifactTiming
= lens _rArtifactTiming
(\ s a -> s{_rArtifactTiming = a}) | 132 | rArtifactTiming
= lens _rArtifactTiming
(\ s a -> s{_rArtifactTiming = a}) | 82 | true | true | 0 | 8 | 32 | 49 | 25 | 24 | null | null |
brendanhay/gogol | gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'OrdersRefundItemRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'orirItems'
--
-- * 'orirReason'
--
-- * 'orirShipping'
--
-- * 'orirOperationId'
--
-- * 'orirReasonText'
ordersRefundItemRequest
:: OrdersRefundItemRequest
ordersRefundItemRequest =
OrdersRefundItemRequest'
{ _orirItems = Nothing
, _orirReason = Nothing
, _orirShipping = Nothing
, _orirOperationId = Nothing
, _orirReasonText = Nothing
} | 553 | ordersRefundItemRequest
:: OrdersRefundItemRequest
ordersRefundItemRequest =
OrdersRefundItemRequest'
{ _orirItems = Nothing
, _orirReason = Nothing
, _orirShipping = Nothing
, _orirOperationId = Nothing
, _orirReasonText = Nothing
} | 263 | ordersRefundItemRequest =
OrdersRefundItemRequest'
{ _orirItems = Nothing
, _orirReason = Nothing
, _orirShipping = Nothing
, _orirOperationId = Nothing
, _orirReasonText = Nothing
} | 208 | true | true | 1 | 7 | 106 | 63 | 41 | 22 | null | null |
shlevy/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | toRational_RDR = nameRdrName toRationalName | 52 | toRational_RDR = nameRdrName toRationalName | 52 | toRational_RDR = nameRdrName toRationalName | 52 | false | false | 0 | 5 | 12 | 9 | 4 | 5 | null | null |
nadirs/todohs | src/cli/Todo/Cli.hs | mit | query :: QueryArg -> [Task] -> [Task]
query q = filter $ case q of
QueryTodo -> not . isComplete
QueryDone -> isComplete
QueryMinPriority (Just m) -> minPriority m
QueryMinPriority _ -> const True
QueryMaxPriority (Just m) -> maxPriority m
QueryMaxPriority _ -> const True
QueryContentLike s -> isInfixOf s' . lower . content where
s' = lower s
lower = map toLower
-- let's avoid universal pattern matching so if we add
-- a new QueryArg constructor option the compiler can
-- warn us about the non-exhaustive pattern matching | 594 | query :: QueryArg -> [Task] -> [Task]
query q = filter $ case q of
QueryTodo -> not . isComplete
QueryDone -> isComplete
QueryMinPriority (Just m) -> minPriority m
QueryMinPriority _ -> const True
QueryMaxPriority (Just m) -> maxPriority m
QueryMaxPriority _ -> const True
QueryContentLike s -> isInfixOf s' . lower . content where
s' = lower s
lower = map toLower
-- let's avoid universal pattern matching so if we add
-- a new QueryArg constructor option the compiler can
-- warn us about the non-exhaustive pattern matching | 594 | query q = filter $ case q of
QueryTodo -> not . isComplete
QueryDone -> isComplete
QueryMinPriority (Just m) -> minPriority m
QueryMinPriority _ -> const True
QueryMaxPriority (Just m) -> maxPriority m
QueryMaxPriority _ -> const True
QueryContentLike s -> isInfixOf s' . lower . content where
s' = lower s
lower = map toLower
-- let's avoid universal pattern matching so if we add
-- a new QueryArg constructor option the compiler can
-- warn us about the non-exhaustive pattern matching | 556 | false | true | 8 | 8 | 157 | 143 | 71 | 72 | null | null |
coolhacks/scripts-hacks | examples/shellcheck-master/ShellCheck/Analytics.hs | mit | checkArrayAsString _ (T_Assignment id _ _ _ word) =
if willConcatInAssignment word
then
warn (getId word) 2124
"Assigning an array to a string! Assign as array, or use * instead of @ to concatenate."
else
when (willBecomeMultipleArgs word) $
warn (getId word) 2125
"Brace expansions and globs are literal in assignments. Quote it or use an array." | 397 | checkArrayAsString _ (T_Assignment id _ _ _ word) =
if willConcatInAssignment word
then
warn (getId word) 2124
"Assigning an array to a string! Assign as array, or use * instead of @ to concatenate."
else
when (willBecomeMultipleArgs word) $
warn (getId word) 2125
"Brace expansions and globs are literal in assignments. Quote it or use an array." | 397 | checkArrayAsString _ (T_Assignment id _ _ _ word) =
if willConcatInAssignment word
then
warn (getId word) 2124
"Assigning an array to a string! Assign as array, or use * instead of @ to concatenate."
else
when (willBecomeMultipleArgs word) $
warn (getId word) 2125
"Brace expansions and globs are literal in assignments. Quote it or use an array." | 397 | false | false | 0 | 9 | 106 | 75 | 36 | 39 | null | null |
tittoassini/typed | src/ZM/Type/Generate.hs | bsd-3-clause | asACT (L 0) = Con "A0" (Left []) | 32 | asACT (L 0) = Con "A0" (Left []) | 32 | asACT (L 0) = Con "A0" (Left []) | 32 | false | false | 0 | 8 | 7 | 28 | 13 | 15 | null | null |
adnelson/simple-nix | src/Nix/Expr.hs | mit | escape :: (String -> String) -> NixString -> Text
escape esc (Plain s) = pack $ esc $ unpack s | 94 | escape :: (String -> String) -> NixString -> Text
escape esc (Plain s) = pack $ esc $ unpack s | 94 | escape esc (Plain s) = pack $ esc $ unpack s | 44 | false | true | 0 | 7 | 19 | 48 | 24 | 24 | null | null |
artems/FlashBit | demo/count.hs | bsd-3-clause | wait = do
chan <- ask
liftIO . atomically $ readTChan chan | 66 | wait = do
chan <- ask
liftIO . atomically $ readTChan chan | 66 | wait = do
chan <- ask
liftIO . atomically $ readTChan chan | 66 | false | false | 0 | 8 | 19 | 27 | 12 | 15 | null | null |
nevrenato/HetsAlloy | QBF/Sublogic.hs | gpl-2.0 | isLiteral (AS_BASIC.Negation (AS_BASIC.Predication _) _ ) = True | 64 | isLiteral (AS_BASIC.Negation (AS_BASIC.Predication _) _ ) = True | 64 | isLiteral (AS_BASIC.Negation (AS_BASIC.Predication _) _ ) = True | 64 | false | false | 0 | 10 | 7 | 27 | 13 | 14 | null | null |
kawamuray/ganeti | src/Ganeti/HTools/Program/Hbal.hs | gpl-2.0 | execWithCancel :: Annotator -> String -> Node.List -> Instance.List -> [JobSet]
-> IO (Result ())
execWithCancel anno master fin_nl il cmd_jobs = do
cref <- newIORef 0
mapM_ (\(hnd, sig) -> installHandler sig (Catch (hnd cref)) Nothing)
[(handleSigTerm, softwareTermination), (handleSigInt, keyboardSignal)]
execCancelWrapper anno master fin_nl il cref cmd_jobs
-- | Select the target node group. | 422 | execWithCancel :: Annotator -> String -> Node.List -> Instance.List -> [JobSet]
-> IO (Result ())
execWithCancel anno master fin_nl il cmd_jobs = do
cref <- newIORef 0
mapM_ (\(hnd, sig) -> installHandler sig (Catch (hnd cref)) Nothing)
[(handleSigTerm, softwareTermination), (handleSigInt, keyboardSignal)]
execCancelWrapper anno master fin_nl il cref cmd_jobs
-- | Select the target node group. | 422 | execWithCancel anno master fin_nl il cmd_jobs = do
cref <- newIORef 0
mapM_ (\(hnd, sig) -> installHandler sig (Catch (hnd cref)) Nothing)
[(handleSigTerm, softwareTermination), (handleSigInt, keyboardSignal)]
execCancelWrapper anno master fin_nl il cref cmd_jobs
-- | Select the target node group. | 309 | false | true | 0 | 14 | 80 | 146 | 75 | 71 | null | null |
koterpillar/tianbar | src/System/Tianbar/RequestResponse.hs | mit | looks :: (MonadPlus m, MonadReader URI m) => String -> m [String]
looks = fmap (map U.toString) . looksBS | 105 | looks :: (MonadPlus m, MonadReader URI m) => String -> m [String]
looks = fmap (map U.toString) . looksBS | 105 | looks = fmap (map U.toString) . looksBS | 39 | false | true | 0 | 9 | 18 | 59 | 28 | 31 | null | null |
ulricha/dsh | src/Database/DSH/Tests/CombinatorTests.hs | bsd-3-clause | prop_groupWithKey_length :: (BackendVector b, VectorLang v) => [[Integer]] -> DSHProperty (v TExpr TExpr) b
prop_groupWithKey_length = makePropEq (Q.groupWithKey Q.length) (groupWithKey (fromIntegral . length)) | 210 | prop_groupWithKey_length :: (BackendVector b, VectorLang v) => [[Integer]] -> DSHProperty (v TExpr TExpr) b
prop_groupWithKey_length = makePropEq (Q.groupWithKey Q.length) (groupWithKey (fromIntegral . length)) | 210 | prop_groupWithKey_length = makePropEq (Q.groupWithKey Q.length) (groupWithKey (fromIntegral . length)) | 102 | false | true | 0 | 9 | 22 | 77 | 40 | 37 | null | null |
droundy/franchise | Distribution/Franchise/CharAssocList.hs | bsd-3-clause | lengthC :: CharAssocList a -> Int
lengthC (CAL ls) = length ls | 62 | lengthC :: CharAssocList a -> Int
lengthC (CAL ls) = length ls | 62 | lengthC (CAL ls) = length ls | 28 | false | true | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
Ragnaroek/orwell | src/Orwell/Analyse.hs | gpl-3.0 | -- TODO Report Code in eigenes Modul auslagern
-- TODO Git-Code in eigenes Modul auslagern
dumpCommits :: [CommitMetaData] -> String -> IO ()
dumpCommits commits outDir = do
mapM (\c -> BL.writeFile (outDir ++ "/" ++ (T.unpack (commitHash c)) ++ ".json") (encode c)) commits
return () | 289 | dumpCommits :: [CommitMetaData] -> String -> IO ()
dumpCommits commits outDir = do
mapM (\c -> BL.writeFile (outDir ++ "/" ++ (T.unpack (commitHash c)) ++ ".json") (encode c)) commits
return () | 197 | dumpCommits commits outDir = do
mapM (\c -> BL.writeFile (outDir ++ "/" ++ (T.unpack (commitHash c)) ++ ".json") (encode c)) commits
return () | 146 | true | true | 0 | 17 | 50 | 100 | 50 | 50 | null | null |
sherwoodwang/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/Draw.hs | lgpl-2.1 | -- | Use a 'SVGFileDC'.
withSVGFileDC :: FilePath -> (SVGFileDC () -> IO b) -> IO b
withSVGFileDC fname draw
= bracket (svgFileDCCreate fname) (svgFileDCDelete) (\dc -> dcDraw dc (draw dc)) | 191 | withSVGFileDC :: FilePath -> (SVGFileDC () -> IO b) -> IO b
withSVGFileDC fname draw
= bracket (svgFileDCCreate fname) (svgFileDCDelete) (\dc -> dcDraw dc (draw dc)) | 167 | withSVGFileDC fname draw
= bracket (svgFileDCCreate fname) (svgFileDCDelete) (\dc -> dcDraw dc (draw dc)) | 107 | true | true | 0 | 11 | 32 | 84 | 40 | 44 | null | null |
heyduck/pfds | src/Pfds/Ch03/BinomialHeap.hs | gpl-3.0 | mrg ts1 [] = ts1 | 16 | mrg ts1 [] = ts1 | 16 | mrg ts1 [] = ts1 | 16 | false | false | 0 | 6 | 4 | 14 | 6 | 8 | null | null |
urbanslug/ghc | testsuite/tests/rename/should_compile/timing003.hs | bsd-3-clause | a426 = [] | 9 | a426 = [] | 9 | a426 = [] | 9 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
rahulmutt/ghcvm | compiler/Eta/Main/DriverPhases.hs | bsd-3-clause | startPhase "cxx" = Ccpp | 28 | startPhase "cxx" = Ccpp | 28 | startPhase "cxx" = Ccpp | 28 | false | false | 1 | 5 | 8 | 13 | 4 | 9 | null | null |
Spheniscida/symmath | Test/TestSymmath.hs | mit | testRoot1 = TestCase $ assertEqual "rt(x,3) == x^(1/3)" (Power x (Number $ 1/3)) (simplify (Root 3 x)) | 102 | testRoot1 = TestCase $ assertEqual "rt(x,3) == x^(1/3)" (Power x (Number $ 1/3)) (simplify (Root 3 x)) | 102 | testRoot1 = TestCase $ assertEqual "rt(x,3) == x^(1/3)" (Power x (Number $ 1/3)) (simplify (Root 3 x)) | 102 | false | false | 0 | 11 | 16 | 50 | 25 | 25 | null | null |
int-e/hint | src/Hint/InterpreterT.hs | bsd-3-clause | showGhcEx :: GHC.GhcException -> String
showGhcEx = flip GHC.showGhcException "" | 80 | showGhcEx :: GHC.GhcException -> String
showGhcEx = flip GHC.showGhcException "" | 80 | showGhcEx = flip GHC.showGhcException "" | 40 | false | true | 0 | 6 | 9 | 24 | 12 | 12 | null | null |
radicaljims/pvn-webservice | src/Config.hs | bsd-3-clause | envPool :: Environment -> Int
envPool Test = 1 | 46 | envPool :: Environment -> Int
envPool Test = 1 | 46 | envPool Test = 1 | 16 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
HairyDude/pdxparse | src/HOI4/Common.hs | mit | -- | Is the given text a "prounoun" (e.g. ROOT)?
isPronoun :: Text -> Bool
isPronoun s = T.map toLower s `S.member` pronouns where
pronouns = S.fromList
["root"
,"prev"
,"owner"
,"controller"
]
-- | Format a script as wiki text. | 273 | isPronoun :: Text -> Bool
isPronoun s = T.map toLower s `S.member` pronouns where
pronouns = S.fromList
["root"
,"prev"
,"owner"
,"controller"
]
-- | Format a script as wiki text. | 224 | isPronoun s = T.map toLower s `S.member` pronouns where
pronouns = S.fromList
["root"
,"prev"
,"owner"
,"controller"
]
-- | Format a script as wiki text. | 198 | true | true | 0 | 7 | 84 | 58 | 33 | 25 | null | null |
oldmanmike/ghc | compiler/simplCore/OccurAnal.hs | bsd-3-clause | addOneOcc :: UsageDetails -> Id -> OccInfo -> UsageDetails
addOneOcc usage id info
= plusVarEnv_C addOccInfo usage (unitVarEnv id info) | 137 | addOneOcc :: UsageDetails -> Id -> OccInfo -> UsageDetails
addOneOcc usage id info
= plusVarEnv_C addOccInfo usage (unitVarEnv id info) | 137 | addOneOcc usage id info
= plusVarEnv_C addOccInfo usage (unitVarEnv id info) | 78 | false | true | 0 | 7 | 21 | 45 | 22 | 23 | null | null |
iblumenfeld/saw-core | src/Verifier/SAW/Simulator/BitBlast.hs | bsd-3-clause | flattenBValue (VRecord m) =
AIG.concat <$> traverse (flattenBValue <=< force) (Map.elems m) | 93 | flattenBValue (VRecord m) =
AIG.concat <$> traverse (flattenBValue <=< force) (Map.elems m) | 93 | flattenBValue (VRecord m) =
AIG.concat <$> traverse (flattenBValue <=< force) (Map.elems m) | 93 | false | false | 0 | 9 | 13 | 41 | 20 | 21 | null | null |
neothemachine/monadiccp | src/Data/Expr/Data.hs | bsd-3-clause | compareBoolExpr _ _ (BoolConst _) = GT | 38 | compareBoolExpr _ _ (BoolConst _) = GT | 38 | compareBoolExpr _ _ (BoolConst _) = GT | 38 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
quintenpalmer/dungeons | server/src/Character/Player.hs | mit | getInitiative :: Player -> Int
getInitiative player =
(getAbilMod Dex player) +
(getHalfPlayerLevel player) | 115 | getInitiative :: Player -> Int
getInitiative player =
(getAbilMod Dex player) +
(getHalfPlayerLevel player) | 115 | getInitiative player =
(getAbilMod Dex player) +
(getHalfPlayerLevel player) | 84 | false | true | 0 | 7 | 21 | 36 | 18 | 18 | null | null |
Lainepress/hledger | hledger-lib/Hledger/Data/Amount.hs | gpl-3.0 | canonicaliseMixedAmountCommodity :: Maybe (Map.Map String Commodity) -> MixedAmount -> MixedAmount
canonicaliseMixedAmountCommodity canonicalcommoditymap (Mixed as) = Mixed $ map (canonicaliseAmountCommodity canonicalcommoditymap) as | 233 | canonicaliseMixedAmountCommodity :: Maybe (Map.Map String Commodity) -> MixedAmount -> MixedAmount
canonicaliseMixedAmountCommodity canonicalcommoditymap (Mixed as) = Mixed $ map (canonicaliseAmountCommodity canonicalcommoditymap) as | 233 | canonicaliseMixedAmountCommodity canonicalcommoditymap (Mixed as) = Mixed $ map (canonicaliseAmountCommodity canonicalcommoditymap) as | 134 | false | true | 0 | 9 | 20 | 58 | 28 | 30 | null | null |
fmapfmapfmap/amazonka | amazonka-ecs/gen/Network/AWS/ECS/Types/Product.hs | mpl-2.0 | -- | The type of the resource, such as 'INTEGER', 'DOUBLE', 'LONG', or
-- 'STRINGSET'.
rType :: Lens' Resource (Maybe Text)
rType = lens _rType (\ s a -> s{_rType = a}) | 168 | rType :: Lens' Resource (Maybe Text)
rType = lens _rType (\ s a -> s{_rType = a}) | 81 | rType = lens _rType (\ s a -> s{_rType = a}) | 44 | true | true | 0 | 9 | 31 | 47 | 26 | 21 | null | null |
conal/reification-rules | src/ReificationRules/Plugin.hs | bsd-3-clause | -- fqVarName :: Var -> String
-- fqVarName = qualifiedName . varName
uqVarName :: Var -> String
uqVarName = getOccString . varName | 131 | uqVarName :: Var -> String
uqVarName = getOccString . varName | 61 | uqVarName = getOccString . varName | 34 | true | true | 1 | 7 | 22 | 29 | 13 | 16 | null | null |
tjakway/ghcjvm | compiler/prelude/THNames.hs | bsd-3-clause | constraintKIdKey = mkPreludeMiscIdUnique 415 | 45 | constraintKIdKey = mkPreludeMiscIdUnique 415 | 45 | constraintKIdKey = mkPreludeMiscIdUnique 415 | 45 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
nuttycom/haskoin | Network/Haskoin/Transaction/Builder.hs | unlicense | signTx :: Monad m
=> Tx -- ^ Transaction to sign
-> [SigInput] -- ^ SigInput signing parameters
-> [PrvKey] -- ^ List of private keys to use for signing
-> EitherT String (SecretT m) (Tx, Bool)
-- ^ (Signed transaction, Status)
signTx otx@(Tx _ ti _ _) sigis allKeys
| null ti = left "signTx: Transaction has no inputs"
| otherwise = do
tx <- foldM go otx $ findSigInput sigis ti
return (tx, verifyStdTx tx sigDat)
where
sigDat = map (\(SigInput so op _ _) -> (so, op)) sigis
go tx (sigi@(SigInput so _ _ rdmM), i) = do
keys <- liftEither $ sigKeys so rdmM allKeys
if null keys
then return tx
else foldM (\t k -> fst <$> signInput t i sigi k) tx keys
-- | Sign a single input in a transaction within the 'SecretT' monad. This
-- function will return a completion status only for that input. If false,
-- that input is either non-standard or not fully signed. | 1,034 | signTx :: Monad m
=> Tx -- ^ Transaction to sign
-> [SigInput] -- ^ SigInput signing parameters
-> [PrvKey] -- ^ List of private keys to use for signing
-> EitherT String (SecretT m) (Tx, Bool)
signTx otx@(Tx _ ti _ _) sigis allKeys
| null ti = left "signTx: Transaction has no inputs"
| otherwise = do
tx <- foldM go otx $ findSigInput sigis ti
return (tx, verifyStdTx tx sigDat)
where
sigDat = map (\(SigInput so op _ _) -> (so, op)) sigis
go tx (sigi@(SigInput so _ _ rdmM), i) = do
keys <- liftEither $ sigKeys so rdmM allKeys
if null keys
then return tx
else foldM (\t k -> fst <$> signInput t i sigi k) tx keys
-- | Sign a single input in a transaction within the 'SecretT' monad. This
-- function will return a completion status only for that input. If false,
-- that input is either non-standard or not fully signed. | 989 | signTx otx@(Tx _ ti _ _) sigis allKeys
| null ti = left "signTx: Transaction has no inputs"
| otherwise = do
tx <- foldM go otx $ findSigInput sigis ti
return (tx, verifyStdTx tx sigDat)
where
sigDat = map (\(SigInput so op _ _) -> (so, op)) sigis
go tx (sigi@(SigInput so _ _ rdmM), i) = do
keys <- liftEither $ sigKeys so rdmM allKeys
if null keys
then return tx
else foldM (\t k -> fst <$> signInput t i sigi k) tx keys
-- | Sign a single input in a transaction within the 'SecretT' monad. This
-- function will return a completion status only for that input. If false,
-- that input is either non-standard or not fully signed. | 711 | true | true | 1 | 13 | 341 | 280 | 141 | 139 | null | null |
cies/gelatin | gelatin-picture/src/Gelatin/Picture.hs | bsd-3-clause | polyline :: [V2 Float] -> Picture ()
polyline vs = liftF $ Polyline vs () | 73 | polyline :: [V2 Float] -> Picture ()
polyline vs = liftF $ Polyline vs () | 73 | polyline vs = liftF $ Polyline vs () | 36 | false | true | 0 | 7 | 14 | 40 | 19 | 21 | null | null |
batterseapower/openshake | tests/simple-hs/Main.hs | bsd-3-clause | main = print utility | 20 | main = print utility | 20 | main = print utility | 20 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
eb-gh-cr/XMonadContrib1 | XMonad/Actions/Plane.hs | bsd-3-clause | -- | Move to the next workspace in 'Direction'.
planeMove :: Lines -> Limits -> Direction -> X ()
planeMove = plane greedyView | 126 | planeMove :: Lines -> Limits -> Direction -> X ()
planeMove = plane greedyView | 78 | planeMove = plane greedyView | 28 | true | true | 0 | 9 | 22 | 32 | 16 | 16 | null | null |
mhwombat/exp-som-comparison | src/Image.hs | gpl-3.0 | makeImageSimilar :: Image -> Double -> Image -> Image
makeImageSimilar target amount a
= a { pixels=adjust (pixels target) amount (pixels a) } | 146 | makeImageSimilar :: Image -> Double -> Image -> Image
makeImageSimilar target amount a
= a { pixels=adjust (pixels target) amount (pixels a) } | 146 | makeImageSimilar target amount a
= a { pixels=adjust (pixels target) amount (pixels a) } | 92 | false | true | 0 | 9 | 26 | 57 | 29 | 28 | null | null |
khibino/haskell-lfsr | src/Data/LFSR/Tap.hs | bsd-3-clause | tapOfPair :: TapBits t => (Int, t) -> (Int, Tap t)
tapOfPair (i, bs) = (i, Tap { width = i, tapBits = bs }) | 108 | tapOfPair :: TapBits t => (Int, t) -> (Int, Tap t)
tapOfPair (i, bs) = (i, Tap { width = i, tapBits = bs }) | 108 | tapOfPair (i, bs) = (i, Tap { width = i, tapBits = bs }) | 57 | false | true | 0 | 8 | 25 | 66 | 38 | 28 | null | null |
alpicola/mel | src/Frontend/Primitives.hs | mit | evalArithOp Minus [x, y] = x - y | 32 | evalArithOp Minus [x, y] = x - y | 32 | evalArithOp Minus [x, y] = x - y | 32 | false | false | 0 | 5 | 7 | 23 | 11 | 12 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.