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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
juanbono/tapl-haskell | untyped/app/Main.hs | gpl-3.0 | main :: IO ()
main = repl | 25 | main :: IO ()
main = repl | 25 | main = repl | 11 | false | true | 0 | 6 | 6 | 16 | 8 | 8 | null | null |
DaMSL/K3 | src/Language/K3/Parser/DataTypes.hs | apache-2.0 | keyword :: String -> K3Parser ()
keyword = reserve k3Idents | 59 | keyword :: String -> K3Parser ()
keyword = reserve k3Idents | 59 | keyword = reserve k3Idents | 26 | false | true | 0 | 8 | 9 | 29 | 12 | 17 | null | null |
hot-leaf-juice/gotta-go-fast | src/GottaGoFast.hs | bsd-3-clause | isErrorFree :: State -> Bool
isErrorFree s = input s `isPrefixOf` target s | 74 | isErrorFree :: State -> Bool
isErrorFree s = input s `isPrefixOf` target s | 74 | isErrorFree s = input s `isPrefixOf` target s | 45 | false | true | 0 | 6 | 12 | 30 | 15 | 15 | null | null |
fmapfmapfmap/amazonka | amazonka-efs/test/Test/AWS/Gen/EFS.hs | mpl-2.0 | testDeleteTagsResponse :: DeleteTagsResponse -> TestTree
testDeleteTagsResponse = res
"DeleteTagsResponse"
"fixture/DeleteTagsResponse.proto"
eFS
(Proxy :: Proxy DeleteTags) | 189 | testDeleteTagsResponse :: DeleteTagsResponse -> TestTree
testDeleteTagsResponse = res
"DeleteTagsResponse"
"fixture/DeleteTagsResponse.proto"
eFS
(Proxy :: Proxy DeleteTags) | 189 | testDeleteTagsResponse = res
"DeleteTagsResponse"
"fixture/DeleteTagsResponse.proto"
eFS
(Proxy :: Proxy DeleteTags) | 132 | false | true | 0 | 6 | 30 | 36 | 17 | 19 | null | null |
andreasfrom/toyrsa | crypt.hs | mit | framed :: UI Element -> UI Element
framed = set style [ ("border", "1px solid black"), ("padding", "5px")] | 107 | framed :: UI Element -> UI Element
framed = set style [ ("border", "1px solid black"), ("padding", "5px")] | 107 | framed = set style [ ("border", "1px solid black"), ("padding", "5px")] | 72 | false | true | 0 | 7 | 18 | 44 | 24 | 20 | null | null |
green-haskell/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | setOverlapModeMaybe f (Just m) = f { overlapMode = m } | 54 | setOverlapModeMaybe f (Just m) = f { overlapMode = m } | 54 | setOverlapModeMaybe f (Just m) = f { overlapMode = m } | 54 | false | false | 0 | 7 | 10 | 25 | 13 | 12 | null | null |
seL4/capDL-tool | CapDL/PrintIsabelle.hs | bsd-2-clause | printFileName :: String -> Doc
printFileName file = text $ dropExtension $ takeFileName file | 92 | printFileName :: String -> Doc
printFileName file = text $ dropExtension $ takeFileName file | 92 | printFileName file = text $ dropExtension $ takeFileName file | 61 | false | true | 0 | 6 | 13 | 29 | 14 | 15 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrelNames.hs | bsd-3-clause | integerTyConKey = mkPreludeTyConUnique 22 | 65 | integerTyConKey = mkPreludeTyConUnique 22 | 65 | integerTyConKey = mkPreludeTyConUnique 22 | 65 | false | false | 0 | 5 | 27 | 9 | 4 | 5 | null | null |
rainbowbismuth/go-analyze | src/Go/Lexer.hs | gpl-3.0 | imaginaryLitAlt1 :: Parser Token
imaginaryLitAlt1 = P.try $ do
(FloatTok num) <- floatLit;
_ <- PC.char 'i';
return (ImaginaryTok num); | 141 | imaginaryLitAlt1 :: Parser Token
imaginaryLitAlt1 = P.try $ do
(FloatTok num) <- floatLit;
_ <- PC.char 'i';
return (ImaginaryTok num); | 141 | imaginaryLitAlt1 = P.try $ do
(FloatTok num) <- floatLit;
_ <- PC.char 'i';
return (ImaginaryTok num); | 108 | false | true | 0 | 10 | 25 | 60 | 29 | 31 | null | null |
DougBurke/swish | tests/RDFDatatypeXsdIntegerTest.hs | lgpl-2.1 | -- Tests for xsd_integer:gt
testVarModifyGt01, testVarModifyGt02, testVarModifyGt03,
testVarModifyGt04, testVarModifyGt05 :: Test
testVarModifyGt01 = testVmod2 "testVarModifyGt01"
(getDTMod dmodXsdIntegerGt rdfDatatypeValXsdInteger)
[makeBVI [("a","100"),("b","100")]]
[] | 337 | testVarModifyGt01, testVarModifyGt02, testVarModifyGt03,
testVarModifyGt04, testVarModifyGt05 :: Test
testVarModifyGt01 = testVmod2 "testVarModifyGt01"
(getDTMod dmodXsdIntegerGt rdfDatatypeValXsdInteger)
[makeBVI [("a","100"),("b","100")]]
[] | 306 | testVarModifyGt01 = testVmod2 "testVarModifyGt01"
(getDTMod dmodXsdIntegerGt rdfDatatypeValXsdInteger)
[makeBVI [("a","100"),("b","100")]]
[] | 202 | true | true | 0 | 9 | 86 | 63 | 39 | 24 | null | null |
mightymoose/liquidhaskell | src/Language/Haskell/Liquid/RefType.hs | bsd-3-clause | eqRSort m (RAllS _ t) (RAllS _ t')
= eqRSort m t t' | 53 | eqRSort m (RAllS _ t) (RAllS _ t')
= eqRSort m t t' | 53 | eqRSort m (RAllS _ t) (RAllS _ t')
= eqRSort m t t' | 53 | false | false | 0 | 7 | 14 | 36 | 17 | 19 | null | null |
brendanhay/gogol | gogol-language/gen/Network/Google/Language/Types/Product.hs | mpl-2.0 | -- | For calls to AnalyzeEntitySentiment or if
-- AnnotateTextRequest.Features.extract_entity_sentiment is set to true,
-- this field will contain the aggregate sentiment expressed for this
-- entity in the provided document.
eSentiment :: Lens' Entity (Maybe Sentiment)
eSentiment
= lens _eSentiment (\ s a -> s{_eSentiment = a}) | 332 | eSentiment :: Lens' Entity (Maybe Sentiment)
eSentiment
= lens _eSentiment (\ s a -> s{_eSentiment = a}) | 106 | eSentiment
= lens _eSentiment (\ s a -> s{_eSentiment = a}) | 61 | true | true | 0 | 9 | 49 | 51 | 28 | 23 | null | null |
brunjlar/heap | src/Data/Ordered.hs | mit | -- | Statement of the fact that for an instance of 'Ordered', for any two elements @m@ and @n@,
-- either @m < n@ or @m >= n@ holds.
--
ltGeqDec :: Ordered a => Sing a m -> Sing a n -> Either (Dict (m < n)) (Dict (m >= n))
ltGeqDec m n = case leqGtDec n m of
Left Dict -> Right Dict
Right Dict -> Left Dict
| 318 | ltGeqDec :: Ordered a => Sing a m -> Sing a n -> Either (Dict (m < n)) (Dict (m >= n))
ltGeqDec m n = case leqGtDec n m of
Left Dict -> Right Dict
Right Dict -> Left Dict
| 180 | ltGeqDec m n = case leqGtDec n m of
Left Dict -> Right Dict
Right Dict -> Left Dict
| 93 | true | true | 3 | 12 | 82 | 103 | 52 | 51 | null | null |
Proclivis/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_NSIS_DEFAULT :: Int
wxSTC_NSIS_DEFAULT = 0 | 48 | wxSTC_NSIS_DEFAULT :: Int
wxSTC_NSIS_DEFAULT = 0 | 48 | wxSTC_NSIS_DEFAULT = 0 | 22 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
lukexi/gl-pal2 | src/Graphics/GL/Pal/Debug.hs | bsd-3-clause | glCallback :: GLenum -> GLenum -> GLuint -> GLenum -> GLsizei -> Ptr GLchar -> Ptr () -> IO ()
glCallback source t ident severity _ message _ = do
message' <- peekCString message
putStrLn $ printf "opengl %s [%s] %s (%s): %s" t' severity' source' (show ident) message'
where
source' = case source of
GL_DEBUG_SOURCE_API -> "API"
GL_DEBUG_SOURCE_WINDOW_SYSTEM -> "Window System"
GL_DEBUG_SOURCE_SHADER_COMPILER -> "Shader Compiler"
GL_DEBUG_SOURCE_THIRD_PARTY -> "Third Party"
GL_DEBUG_SOURCE_APPLICATION -> "Application"
GL_DEBUG_SOURCE_OTHER -> "Other"
_ -> "Unknown"
t' = case t of
GL_DEBUG_TYPE_ERROR -> "Error"
GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR -> "Deprecated Behaviour"
GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR -> "Undefined Behaviour"
GL_DEBUG_TYPE_PORTABILITY -> "Portability"
GL_DEBUG_TYPE_PERFORMANCE -> "Performance"
GL_DEBUG_TYPE_OTHER -> "Other"
GL_DEBUG_TYPE_MARKER -> "Marker"
_ -> "Unknown"
severity' = case severity of
GL_DEBUG_SEVERITY_HIGH -> "High"
GL_DEBUG_SEVERITY_MEDIUM -> "Medium"
GL_DEBUG_SEVERITY_LOW -> "Low"
GL_DEBUG_SEVERITY_NOTIFICATION -> "Notification"
_ -> "Unknown" | 1,184 | glCallback :: GLenum -> GLenum -> GLuint -> GLenum -> GLsizei -> Ptr GLchar -> Ptr () -> IO ()
glCallback source t ident severity _ message _ = do
message' <- peekCString message
putStrLn $ printf "opengl %s [%s] %s (%s): %s" t' severity' source' (show ident) message'
where
source' = case source of
GL_DEBUG_SOURCE_API -> "API"
GL_DEBUG_SOURCE_WINDOW_SYSTEM -> "Window System"
GL_DEBUG_SOURCE_SHADER_COMPILER -> "Shader Compiler"
GL_DEBUG_SOURCE_THIRD_PARTY -> "Third Party"
GL_DEBUG_SOURCE_APPLICATION -> "Application"
GL_DEBUG_SOURCE_OTHER -> "Other"
_ -> "Unknown"
t' = case t of
GL_DEBUG_TYPE_ERROR -> "Error"
GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR -> "Deprecated Behaviour"
GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR -> "Undefined Behaviour"
GL_DEBUG_TYPE_PORTABILITY -> "Portability"
GL_DEBUG_TYPE_PERFORMANCE -> "Performance"
GL_DEBUG_TYPE_OTHER -> "Other"
GL_DEBUG_TYPE_MARKER -> "Marker"
_ -> "Unknown"
severity' = case severity of
GL_DEBUG_SEVERITY_HIGH -> "High"
GL_DEBUG_SEVERITY_MEDIUM -> "Medium"
GL_DEBUG_SEVERITY_LOW -> "Low"
GL_DEBUG_SEVERITY_NOTIFICATION -> "Notification"
_ -> "Unknown" | 1,184 | glCallback source t ident severity _ message _ = do
message' <- peekCString message
putStrLn $ printf "opengl %s [%s] %s (%s): %s" t' severity' source' (show ident) message'
where
source' = case source of
GL_DEBUG_SOURCE_API -> "API"
GL_DEBUG_SOURCE_WINDOW_SYSTEM -> "Window System"
GL_DEBUG_SOURCE_SHADER_COMPILER -> "Shader Compiler"
GL_DEBUG_SOURCE_THIRD_PARTY -> "Third Party"
GL_DEBUG_SOURCE_APPLICATION -> "Application"
GL_DEBUG_SOURCE_OTHER -> "Other"
_ -> "Unknown"
t' = case t of
GL_DEBUG_TYPE_ERROR -> "Error"
GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR -> "Deprecated Behaviour"
GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR -> "Undefined Behaviour"
GL_DEBUG_TYPE_PORTABILITY -> "Portability"
GL_DEBUG_TYPE_PERFORMANCE -> "Performance"
GL_DEBUG_TYPE_OTHER -> "Other"
GL_DEBUG_TYPE_MARKER -> "Marker"
_ -> "Unknown"
severity' = case severity of
GL_DEBUG_SEVERITY_HIGH -> "High"
GL_DEBUG_SEVERITY_MEDIUM -> "Medium"
GL_DEBUG_SEVERITY_LOW -> "Low"
GL_DEBUG_SEVERITY_NOTIFICATION -> "Notification"
_ -> "Unknown" | 1,089 | false | true | 0 | 13 | 222 | 253 | 124 | 129 | null | null |
andyarvanitis/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v (LOr ITNative) [l, r] = v ++ "INTOP(|," ++ creg l ++ ", " ++ creg r ++ ")" | 81 | doOp v (LOr ITNative) [l, r] = v ++ "INTOP(|," ++ creg l ++ ", " ++ creg r ++ ")" | 81 | doOp v (LOr ITNative) [l, r] = v ++ "INTOP(|," ++ creg l ++ ", " ++ creg r ++ ")" | 81 | false | false | 0 | 9 | 20 | 51 | 25 | 26 | null | null |
cbrghostrider/Hacking | HackerRank/FunctionalProgramming/FunctionalStructures/validBST.hs | mit | compileValidTrees :: Int -> [Int] -> [Int] -> [ITree]
compileValidTrees me lhsns rhsns =
let lts = constructTrees lhsns
rts = constructTrees rhsns
lhsok = lhsns == [] || me >= maximum lhsns
rhsok = rhsns == [] || me <= minimum rhsns
in if lhsok && rhsok then allTreeCombos me lts rts else [] | 320 | compileValidTrees :: Int -> [Int] -> [Int] -> [ITree]
compileValidTrees me lhsns rhsns =
let lts = constructTrees lhsns
rts = constructTrees rhsns
lhsok = lhsns == [] || me >= maximum lhsns
rhsok = rhsns == [] || me <= minimum rhsns
in if lhsok && rhsok then allTreeCombos me lts rts else [] | 320 | compileValidTrees me lhsns rhsns =
let lts = constructTrees lhsns
rts = constructTrees rhsns
lhsok = lhsns == [] || me >= maximum lhsns
rhsok = rhsns == [] || me <= minimum rhsns
in if lhsok && rhsok then allTreeCombos me lts rts else [] | 266 | false | true | 0 | 12 | 83 | 126 | 64 | 62 | null | null |
ohua-dev/ohua-core | core/src/Ohua/Serialize/JSON.hs | epl-1.0 | unwrapToEncoding :: (Unwrap t, ToJSON (SourceType t)) => t -> Encoding
unwrapToEncoding = toEncoding . unwrap | 109 | unwrapToEncoding :: (Unwrap t, ToJSON (SourceType t)) => t -> Encoding
unwrapToEncoding = toEncoding . unwrap | 109 | unwrapToEncoding = toEncoding . unwrap | 38 | false | true | 0 | 9 | 15 | 47 | 22 | 25 | null | null |
srijs/haskell-generalized-functors | src/Data/Functors.hs | mit | second :: Bifunctor f Covariant Covariant => (c -> d) -> f a c -> f a d
second = mapbi id | 89 | second :: Bifunctor f Covariant Covariant => (c -> d) -> f a c -> f a d
second = mapbi id | 89 | second = mapbi id | 17 | false | true | 0 | 8 | 21 | 50 | 24 | 26 | null | null |
danr/hipspec | examples/old-examples/hip/NatDouble.hs | gpl-3.0 | prop_add_comm :: Nat -> Nat -> Prop Nat
prop_add_comm x y
= x + y =:= y + x | 77 | prop_add_comm :: Nat -> Nat -> Prop Nat
prop_add_comm x y
= x + y =:= y + x | 77 | prop_add_comm x y
= x + y =:= y + x | 37 | false | true | 0 | 7 | 20 | 39 | 19 | 20 | null | null |
nicball/fvckbot | src/Main.hs | bsd-3-clause | evalSql :: Text -> IO Text
evalSql stmt =
timeout 1_000_000 "Timeout" do
Sqlite.interruptibly evalConn do
handle (\e -> pure . Text.pack . show $ (e :: Sqlite.SQLError)) do
colNames <- newIORef []
rows <- newIORef []
Sqlite.execWithCallback evalConn stmt \n cn row -> do
writeIORef colNames cn
let rowstr = Text.intercalate "\t" . fmap (fromMaybe "NULL") $ row
modifyIORef rows (rowstr :)
pure ()
colNames <- readIORef colNames
rows <- readIORef rows
if null colNames
then pure "ok"
else
pure . Text.take 1000 . Text.intercalate "\n" $
[ Text.intercalate "\t" colNames,
"--------------------------------------------"
]
<> reverse rows | 826 | evalSql :: Text -> IO Text
evalSql stmt =
timeout 1_000_000 "Timeout" do
Sqlite.interruptibly evalConn do
handle (\e -> pure . Text.pack . show $ (e :: Sqlite.SQLError)) do
colNames <- newIORef []
rows <- newIORef []
Sqlite.execWithCallback evalConn stmt \n cn row -> do
writeIORef colNames cn
let rowstr = Text.intercalate "\t" . fmap (fromMaybe "NULL") $ row
modifyIORef rows (rowstr :)
pure ()
colNames <- readIORef colNames
rows <- readIORef rows
if null colNames
then pure "ok"
else
pure . Text.take 1000 . Text.intercalate "\n" $
[ Text.intercalate "\t" colNames,
"--------------------------------------------"
]
<> reverse rows | 826 | evalSql stmt =
timeout 1_000_000 "Timeout" do
Sqlite.interruptibly evalConn do
handle (\e -> pure . Text.pack . show $ (e :: Sqlite.SQLError)) do
colNames <- newIORef []
rows <- newIORef []
Sqlite.execWithCallback evalConn stmt \n cn row -> do
writeIORef colNames cn
let rowstr = Text.intercalate "\t" . fmap (fromMaybe "NULL") $ row
modifyIORef rows (rowstr :)
pure ()
colNames <- readIORef colNames
rows <- readIORef rows
if null colNames
then pure "ok"
else
pure . Text.take 1000 . Text.intercalate "\n" $
[ Text.intercalate "\t" colNames,
"--------------------------------------------"
]
<> reverse rows | 799 | false | true | 0 | 25 | 288 | 266 | 120 | 146 | null | null |
damianfral/clay | src/Clay/Background.hs | bsd-3-clause | sideCenter = Side "center" | 26 | sideCenter = Side "center" | 26 | sideCenter = Side "center" | 26 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
joelburget/frankenstein | src/Planetary/Support/Parser.hs | bsd-3-clause | -- 0 | 0,Interfaces | e,Interfaces | Interfaces
-- TODO: allow explicit e? `[e]`
parseAbilityBody :: MonadicParsing m => m Ability'
parseAbilityBody =
let closedAb = do
_ <- textSymbol "0"
skipOptional comma
instances <- option [] parseInterfaceInstances
return $ Ability ClosedAbility (fromList instances)
varAb = do
var <- option ("e" :: Text) (try identifier)
skipOptional comma
instances <- parseInterfaceInstances
return $ Ability OpenAbility (fromList instances)
in closedAb <|> varAb <?> "Ability Body" | 583 | parseAbilityBody :: MonadicParsing m => m Ability'
parseAbilityBody =
let closedAb = do
_ <- textSymbol "0"
skipOptional comma
instances <- option [] parseInterfaceInstances
return $ Ability ClosedAbility (fromList instances)
varAb = do
var <- option ("e" :: Text) (try identifier)
skipOptional comma
instances <- parseInterfaceInstances
return $ Ability OpenAbility (fromList instances)
in closedAb <|> varAb <?> "Ability Body" | 502 | parseAbilityBody =
let closedAb = do
_ <- textSymbol "0"
skipOptional comma
instances <- option [] parseInterfaceInstances
return $ Ability ClosedAbility (fromList instances)
varAb = do
var <- option ("e" :: Text) (try identifier)
skipOptional comma
instances <- parseInterfaceInstances
return $ Ability OpenAbility (fromList instances)
in closedAb <|> varAb <?> "Ability Body" | 451 | true | true | 0 | 14 | 146 | 150 | 69 | 81 | null | null |
rgleichman/glance | gui/Clock.hs | gpl-3.0 | forM_ = flip mapM_ | 18 | forM_ = flip mapM_ | 18 | forM_ = flip mapM_ | 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_178 x = happyTcHack x happyReduce_303 | 44 | action_178 x = happyTcHack x happyReduce_303 | 44 | action_178 x = happyTcHack x happyReduce_303 | 44 | false | false | 0 | 5 | 5 | 14 | 6 | 8 | null | null |
tomjnixon/buzzlang | src/Parser.hs | mit | exprStatementParser = do reserved "progressively"
expr <- expressionParser
return $ ExprStatement expr | 152 | exprStatementParser = do reserved "progressively"
expr <- expressionParser
return $ ExprStatement expr | 152 | exprStatementParser = do reserved "progressively"
expr <- expressionParser
return $ ExprStatement expr | 152 | false | false | 0 | 8 | 61 | 29 | 12 | 17 | null | null |
smurphy8/backoffice | Application.hs | bsd-3-clause | -- This function allocates resources (such as a database connection pool),
-- performs initialization and creates a WAI application. This is also the
-- place to put your migrate statements to have automatic database
-- migrations handled by Yesod.
makeApplication :: AppConfig DefaultEnv Extra -> IO Application
makeApplication conf = do
foundation <- makeFoundation conf
-- Initialize the logging middleware
logWare <- mkRequestLogger def
{ outputFormat =
if development
then Detailed True
else Apache FromSocket
, destination = Logger $ appLogger foundation
}
-- Create the WAI application and apply middlewares
app <- toWaiAppPlain foundation
return $ logWare app
-- | Loads up any necessary settings, creates your foundation datatype, and
-- performs some initialization. | 871 | makeApplication :: AppConfig DefaultEnv Extra -> IO Application
makeApplication conf = do
foundation <- makeFoundation conf
-- Initialize the logging middleware
logWare <- mkRequestLogger def
{ outputFormat =
if development
then Detailed True
else Apache FromSocket
, destination = Logger $ appLogger foundation
}
-- Create the WAI application and apply middlewares
app <- toWaiAppPlain foundation
return $ logWare app
-- | Loads up any necessary settings, creates your foundation datatype, and
-- performs some initialization. | 622 | makeApplication conf = do
foundation <- makeFoundation conf
-- Initialize the logging middleware
logWare <- mkRequestLogger def
{ outputFormat =
if development
then Detailed True
else Apache FromSocket
, destination = Logger $ appLogger foundation
}
-- Create the WAI application and apply middlewares
app <- toWaiAppPlain foundation
return $ logWare app
-- | Loads up any necessary settings, creates your foundation datatype, and
-- performs some initialization. | 558 | true | true | 0 | 13 | 209 | 114 | 56 | 58 | null | null |
mahrz/hit | src/Numeric/Information/Model/IT.hs | mit | nodeSpecificInformation :: (Floating prob, Ord prob, Ord a)
=> [String]
-> [a]
-> [String]
-> ModelDistribution prob a
-> prob
nodeSpecificInformation sv s av m =
let p_s = (extract $ marginalize sv m) ?= s
p_ags = (extractC $ conditionalize av sv m) s
p_sga = (extractC $ conditionalize sv av m)
in expected p_ags (\a-> log2 ((p_sga a) ?= s / p_s)) | 500 | nodeSpecificInformation :: (Floating prob, Ord prob, Ord a)
=> [String]
-> [a]
-> [String]
-> ModelDistribution prob a
-> prob
nodeSpecificInformation sv s av m =
let p_s = (extract $ marginalize sv m) ?= s
p_ags = (extractC $ conditionalize av sv m) s
p_sga = (extractC $ conditionalize sv av m)
in expected p_ags (\a-> log2 ((p_sga a) ?= s / p_s)) | 500 | nodeSpecificInformation sv s av m =
let p_s = (extract $ marginalize sv m) ?= s
p_ags = (extractC $ conditionalize av sv m) s
p_sga = (extractC $ conditionalize sv av m)
in expected p_ags (\a-> log2 ((p_sga a) ?= s / p_s)) | 238 | false | true | 0 | 15 | 214 | 172 | 88 | 84 | null | null |
simhu/cubical | Eval.hs | mit | sndSVal (VSPair a b) = b | 27 | sndSVal (VSPair a b) = b | 27 | sndSVal (VSPair a b) = b | 27 | false | false | 0 | 6 | 8 | 18 | 8 | 10 | null | null |
sproctor/dirtywater | src/Location.hs | gpl-2.0 | getLocationDirections :: Location -> STM [Direction]
getLocationDirections loc = do
objs <- readTVar $ locationObjects loc
return $ mapMaybe onlyDirections objs
where
onlyDirections (ObjectDirection d _) = Just d
onlyDirections _ = Nothing | 253 | getLocationDirections :: Location -> STM [Direction]
getLocationDirections loc = do
objs <- readTVar $ locationObjects loc
return $ mapMaybe onlyDirections objs
where
onlyDirections (ObjectDirection d _) = Just d
onlyDirections _ = Nothing | 253 | getLocationDirections loc = do
objs <- readTVar $ locationObjects loc
return $ mapMaybe onlyDirections objs
where
onlyDirections (ObjectDirection d _) = Just d
onlyDirections _ = Nothing | 200 | false | true | 1 | 9 | 46 | 79 | 37 | 42 | null | null |
damoxc/ganeti | test/hs/Test/Ganeti/JQueue.hs | gpl-2.0 | prop_JobStatus :: Property
prop_JobStatus =
forAll genJobId $ \jid ->
forAll genQueuedOpCode $ \op ->
let job1 = QueuedJob jid [op] justNoTs justNoTs justNoTs
st1 = calcJobStatus job1
op_succ = op { qoStatus = OP_STATUS_SUCCESS }
op_err = op { qoStatus = OP_STATUS_ERROR }
op_cnl = op { qoStatus = OP_STATUS_CANCELING }
op_cnd = op { qoStatus = OP_STATUS_CANCELED }
-- computes status for a job with an added opcode before
st_pre_op pop = calcJobStatus (job1 { qjOps = pop:qjOps job1 })
-- computes status for a job with an added opcode after
st_post_op pop = calcJobStatus (job1 { qjOps = qjOps job1 ++ [pop] })
in conjoin
[ printTestCase "pre-success doesn't change status"
(st_pre_op op_succ ==? st1)
, printTestCase "post-success doesn't change status"
(st_post_op op_succ ==? st1)
, printTestCase "pre-error is error"
(st_pre_op op_err ==? JOB_STATUS_ERROR)
, printTestCase "pre-canceling is canceling"
(st_pre_op op_cnl ==? JOB_STATUS_CANCELING)
, printTestCase "pre-canceled is canceled"
(st_pre_op op_cnd ==? JOB_STATUS_CANCELED)
] | 1,169 | prop_JobStatus :: Property
prop_JobStatus =
forAll genJobId $ \jid ->
forAll genQueuedOpCode $ \op ->
let job1 = QueuedJob jid [op] justNoTs justNoTs justNoTs
st1 = calcJobStatus job1
op_succ = op { qoStatus = OP_STATUS_SUCCESS }
op_err = op { qoStatus = OP_STATUS_ERROR }
op_cnl = op { qoStatus = OP_STATUS_CANCELING }
op_cnd = op { qoStatus = OP_STATUS_CANCELED }
-- computes status for a job with an added opcode before
st_pre_op pop = calcJobStatus (job1 { qjOps = pop:qjOps job1 })
-- computes status for a job with an added opcode after
st_post_op pop = calcJobStatus (job1 { qjOps = qjOps job1 ++ [pop] })
in conjoin
[ printTestCase "pre-success doesn't change status"
(st_pre_op op_succ ==? st1)
, printTestCase "post-success doesn't change status"
(st_post_op op_succ ==? st1)
, printTestCase "pre-error is error"
(st_pre_op op_err ==? JOB_STATUS_ERROR)
, printTestCase "pre-canceling is canceling"
(st_pre_op op_cnl ==? JOB_STATUS_CANCELING)
, printTestCase "pre-canceled is canceled"
(st_pre_op op_cnd ==? JOB_STATUS_CANCELED)
] | 1,169 | prop_JobStatus =
forAll genJobId $ \jid ->
forAll genQueuedOpCode $ \op ->
let job1 = QueuedJob jid [op] justNoTs justNoTs justNoTs
st1 = calcJobStatus job1
op_succ = op { qoStatus = OP_STATUS_SUCCESS }
op_err = op { qoStatus = OP_STATUS_ERROR }
op_cnl = op { qoStatus = OP_STATUS_CANCELING }
op_cnd = op { qoStatus = OP_STATUS_CANCELED }
-- computes status for a job with an added opcode before
st_pre_op pop = calcJobStatus (job1 { qjOps = pop:qjOps job1 })
-- computes status for a job with an added opcode after
st_post_op pop = calcJobStatus (job1 { qjOps = qjOps job1 ++ [pop] })
in conjoin
[ printTestCase "pre-success doesn't change status"
(st_pre_op op_succ ==? st1)
, printTestCase "post-success doesn't change status"
(st_post_op op_succ ==? st1)
, printTestCase "pre-error is error"
(st_pre_op op_err ==? JOB_STATUS_ERROR)
, printTestCase "pre-canceling is canceling"
(st_pre_op op_cnl ==? JOB_STATUS_CANCELING)
, printTestCase "pre-canceled is canceled"
(st_pre_op op_cnd ==? JOB_STATUS_CANCELED)
] | 1,142 | false | true | 0 | 18 | 285 | 276 | 146 | 130 | null | null |
Paow/encore | src/ir/AST/Util.hs | bsd-3-clause | putChildren _ e@(IntLiteral {}) = error "'putChildren l IntLiteral' expects l to have 0 elements" | 97 | putChildren _ e@(IntLiteral {}) = error "'putChildren l IntLiteral' expects l to have 0 elements" | 97 | putChildren _ e@(IntLiteral {}) = error "'putChildren l IntLiteral' expects l to have 0 elements" | 97 | false | false | 0 | 8 | 14 | 27 | 13 | 14 | null | null |
kevinjardine/gruzeSnaplet | src/Snap/Snaplet/Gruze/Query.hs | gpl-2.0 | orderByToString _ = [] | 22 | orderByToString _ = [] | 22 | orderByToString _ = [] | 22 | false | false | 0 | 5 | 3 | 11 | 5 | 6 | null | null |
Ian-Stewart-Binks/courseography | dependencies/HaXml-1.25.3/src/Text/XML/HaXml/Validate.hs | gpl-3.0 | False `gives` _ = [] | 20 | False `gives` _ = [] | 20 | False `gives` _ = [] | 20 | false | false | 0 | 5 | 4 | 16 | 8 | 8 | null | null |
janschulz/pandoc | src/Text/Pandoc/Writers/ICML.hs | gpl-2.0 | blocksToICML :: WriterOptions -> Style -> [Block] -> WS Doc
blocksToICML opts style lst = do
docs <- mapM (blockToICML opts style) lst
return $ intersperseBrs docs
-- | Convert a Pandoc block element to ICML. | 213 | blocksToICML :: WriterOptions -> Style -> [Block] -> WS Doc
blocksToICML opts style lst = do
docs <- mapM (blockToICML opts style) lst
return $ intersperseBrs docs
-- | Convert a Pandoc block element to ICML. | 213 | blocksToICML opts style lst = do
docs <- mapM (blockToICML opts style) lst
return $ intersperseBrs docs
-- | Convert a Pandoc block element to ICML. | 153 | false | true | 0 | 10 | 40 | 67 | 32 | 35 | null | null |
chrra/iCalendar | Text/ICalendar/Parser/Content.hs | bsd-3-clause | componentalize f (x:xs) = x:componentalize f xs | 47 | componentalize f (x:xs) = x:componentalize f xs | 47 | componentalize f (x:xs) = x:componentalize f xs | 47 | false | false | 0 | 6 | 6 | 29 | 13 | 16 | null | null |
notogawa/haiji | src/Text/Haiji/Syntax/Expression.hs | bsd-3-clause | exprLevel5 :: Parser (Expr Internal Level5)
exprLevel5 = choice [ exprAddSub
] | 98 | exprLevel5 :: Parser (Expr Internal Level5)
exprLevel5 = choice [ exprAddSub
] | 98 | exprLevel5 = choice [ exprAddSub
] | 54 | false | true | 0 | 7 | 31 | 28 | 14 | 14 | null | null |
emwap/feldspar-language | src/Feldspar/Core/Constructs/Tuple.hs | bsd-3-clause | sel4Size Tup10Type{} = $(proj 10 3) | 35 | sel4Size Tup10Type{} = $(proj 10 3) | 35 | sel4Size Tup10Type{} = $(proj 10 3) | 35 | false | false | 0 | 7 | 5 | 22 | 10 | 12 | null | null |
GaloisInc/verification-game | web-prover/exes/Server.hs | bsd-3-clause | srvUngrab :: Session TaskState -> Snap ()
srvUngrab s =
do task <- srvCurrentTask s
liftIOC (ungrabExpression task)
sendJSON (JS.object [ "expr" .= show (ppE LTrue) ])
--------------------------------------------------------------------------------
-- Changing inputs | 286 | srvUngrab :: Session TaskState -> Snap ()
srvUngrab s =
do task <- srvCurrentTask s
liftIOC (ungrabExpression task)
sendJSON (JS.object [ "expr" .= show (ppE LTrue) ])
--------------------------------------------------------------------------------
-- Changing inputs | 286 | srvUngrab s =
do task <- srvCurrentTask s
liftIOC (ungrabExpression task)
sendJSON (JS.object [ "expr" .= show (ppE LTrue) ])
--------------------------------------------------------------------------------
-- Changing inputs | 244 | false | true | 0 | 14 | 49 | 80 | 37 | 43 | null | null |
joshbohde/hdr-histogram | test/Test/Expectations.hs | gpl-3.0 | compareWith :: (Show a) => (a -> a -> Bool) -> String -> a -> a -> Expectation
compareWith comparator errorDesc result expected = expectTrue errorMsg (comparator expected result)
where
errorMsg = show result ++ " " ++ errorDesc ++ " " ++ show expected | 257 | compareWith :: (Show a) => (a -> a -> Bool) -> String -> a -> a -> Expectation
compareWith comparator errorDesc result expected = expectTrue errorMsg (comparator expected result)
where
errorMsg = show result ++ " " ++ errorDesc ++ " " ++ show expected | 257 | compareWith comparator errorDesc result expected = expectTrue errorMsg (comparator expected result)
where
errorMsg = show result ++ " " ++ errorDesc ++ " " ++ show expected | 178 | false | true | 0 | 9 | 50 | 103 | 50 | 53 | null | null |
bamboo/idris-cil | src/IRTS/Cil/Types.hs | bsd-3-clause | isValueType _ = False | 27 | isValueType _ = False | 27 | isValueType _ = False | 27 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
ben-schulz/Idris-dev | src/Idris/Core/Elaborate.hs | bsd-3-clause | match_apply = apply' match_fill | 31 | match_apply = apply' match_fill | 31 | match_apply = apply' match_fill | 31 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
keera-studios/hsQt | Qtc/Gui/QPen.hs | bsd-2-clause | setDashOffset :: QPen a -> ((Double)) -> IO ()
setDashOffset x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QPen_setDashOffset cobj_x0 (toCDouble x1) | 153 | setDashOffset :: QPen a -> ((Double)) -> IO ()
setDashOffset x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QPen_setDashOffset cobj_x0 (toCDouble x1) | 153 | setDashOffset x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
qtc_QPen_setDashOffset cobj_x0 (toCDouble x1) | 106 | false | true | 0 | 9 | 27 | 64 | 32 | 32 | null | null |
fmapfmapfmap/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Instance' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'insPublicDNSName'
--
-- * 'insPlatform'
--
-- * 'insSecurityGroups'
--
-- * 'insClientToken'
--
-- * 'insSourceDestCheck'
--
-- * 'insVPCId'
--
-- * 'insKeyName'
--
-- * 'insNetworkInterfaces'
--
-- * 'insRAMDiskId'
--
-- * 'insSubnetId'
--
-- * 'insKernelId'
--
-- * 'insRootDeviceName'
--
-- * 'insSRIOVNetSupport'
--
-- * 'insEBSOptimized'
--
-- * 'insStateTransitionReason'
--
-- * 'insInstanceLifecycle'
--
-- * 'insIAMInstanceProfile'
--
-- * 'insPrivateIPAddress'
--
-- * 'insProductCodes'
--
-- * 'insSpotInstanceRequestId'
--
-- * 'insPrivateDNSName'
--
-- * 'insStateReason'
--
-- * 'insBlockDeviceMappings'
--
-- * 'insPublicIPAddress'
--
-- * 'insTags'
--
-- * 'insInstanceId'
--
-- * 'insImageId'
--
-- * 'insAMILaunchIndex'
--
-- * 'insInstanceType'
--
-- * 'insLaunchTime'
--
-- * 'insPlacement'
--
-- * 'insMonitoring'
--
-- * 'insArchitecture'
--
-- * 'insRootDeviceType'
--
-- * 'insVirtualizationType'
--
-- * 'insHypervisor'
--
-- * 'insState'
instance'
:: Text -- ^ 'insInstanceId'
-> Text -- ^ 'insImageId'
-> Int -- ^ 'insAMILaunchIndex'
-> InstanceType -- ^ 'insInstanceType'
-> UTCTime -- ^ 'insLaunchTime'
-> Placement -- ^ 'insPlacement'
-> Monitoring -- ^ 'insMonitoring'
-> ArchitectureValues -- ^ 'insArchitecture'
-> DeviceType -- ^ 'insRootDeviceType'
-> VirtualizationType -- ^ 'insVirtualizationType'
-> HypervisorType -- ^ 'insHypervisor'
-> InstanceState -- ^ 'insState'
-> Instance
instance' pInstanceId_ pImageId_ pAMILaunchIndex_ pInstanceType_ pLaunchTime_ pPlacement_ pMonitoring_ pArchitecture_ pRootDeviceType_ pVirtualizationType_ pHypervisor_ pState_ =
Instance'
{ _insPublicDNSName = Nothing
, _insPlatform = Nothing
, _insSecurityGroups = Nothing
, _insClientToken = Nothing
, _insSourceDestCheck = Nothing
, _insVPCId = Nothing
, _insKeyName = Nothing
, _insNetworkInterfaces = Nothing
, _insRAMDiskId = Nothing
, _insSubnetId = Nothing
, _insKernelId = Nothing
, _insRootDeviceName = Nothing
, _insSRIOVNetSupport = Nothing
, _insEBSOptimized = Nothing
, _insStateTransitionReason = Nothing
, _insInstanceLifecycle = Nothing
, _insIAMInstanceProfile = Nothing
, _insPrivateIPAddress = Nothing
, _insProductCodes = Nothing
, _insSpotInstanceRequestId = Nothing
, _insPrivateDNSName = Nothing
, _insStateReason = Nothing
, _insBlockDeviceMappings = Nothing
, _insPublicIPAddress = Nothing
, _insTags = Nothing
, _insInstanceId = pInstanceId_
, _insImageId = pImageId_
, _insAMILaunchIndex = pAMILaunchIndex_
, _insInstanceType = pInstanceType_
, _insLaunchTime = _Time # pLaunchTime_
, _insPlacement = pPlacement_
, _insMonitoring = pMonitoring_
, _insArchitecture = pArchitecture_
, _insRootDeviceType = pRootDeviceType_
, _insVirtualizationType = pVirtualizationType_
, _insHypervisor = pHypervisor_
, _insState = pState_
} | 3,149 | instance'
:: Text -- ^ 'insInstanceId'
-> Text -- ^ 'insImageId'
-> Int -- ^ 'insAMILaunchIndex'
-> InstanceType -- ^ 'insInstanceType'
-> UTCTime -- ^ 'insLaunchTime'
-> Placement -- ^ 'insPlacement'
-> Monitoring -- ^ 'insMonitoring'
-> ArchitectureValues -- ^ 'insArchitecture'
-> DeviceType -- ^ 'insRootDeviceType'
-> VirtualizationType -- ^ 'insVirtualizationType'
-> HypervisorType -- ^ 'insHypervisor'
-> InstanceState -- ^ 'insState'
-> Instance
instance' pInstanceId_ pImageId_ pAMILaunchIndex_ pInstanceType_ pLaunchTime_ pPlacement_ pMonitoring_ pArchitecture_ pRootDeviceType_ pVirtualizationType_ pHypervisor_ pState_ =
Instance'
{ _insPublicDNSName = Nothing
, _insPlatform = Nothing
, _insSecurityGroups = Nothing
, _insClientToken = Nothing
, _insSourceDestCheck = Nothing
, _insVPCId = Nothing
, _insKeyName = Nothing
, _insNetworkInterfaces = Nothing
, _insRAMDiskId = Nothing
, _insSubnetId = Nothing
, _insKernelId = Nothing
, _insRootDeviceName = Nothing
, _insSRIOVNetSupport = Nothing
, _insEBSOptimized = Nothing
, _insStateTransitionReason = Nothing
, _insInstanceLifecycle = Nothing
, _insIAMInstanceProfile = Nothing
, _insPrivateIPAddress = Nothing
, _insProductCodes = Nothing
, _insSpotInstanceRequestId = Nothing
, _insPrivateDNSName = Nothing
, _insStateReason = Nothing
, _insBlockDeviceMappings = Nothing
, _insPublicIPAddress = Nothing
, _insTags = Nothing
, _insInstanceId = pInstanceId_
, _insImageId = pImageId_
, _insAMILaunchIndex = pAMILaunchIndex_
, _insInstanceType = pInstanceType_
, _insLaunchTime = _Time # pLaunchTime_
, _insPlacement = pPlacement_
, _insMonitoring = pMonitoring_
, _insArchitecture = pArchitecture_
, _insRootDeviceType = pRootDeviceType_
, _insVirtualizationType = pVirtualizationType_
, _insHypervisor = pHypervisor_
, _insState = pState_
} | 2,016 | instance' pInstanceId_ pImageId_ pAMILaunchIndex_ pInstanceType_ pLaunchTime_ pPlacement_ pMonitoring_ pArchitecture_ pRootDeviceType_ pVirtualizationType_ pHypervisor_ pState_ =
Instance'
{ _insPublicDNSName = Nothing
, _insPlatform = Nothing
, _insSecurityGroups = Nothing
, _insClientToken = Nothing
, _insSourceDestCheck = Nothing
, _insVPCId = Nothing
, _insKeyName = Nothing
, _insNetworkInterfaces = Nothing
, _insRAMDiskId = Nothing
, _insSubnetId = Nothing
, _insKernelId = Nothing
, _insRootDeviceName = Nothing
, _insSRIOVNetSupport = Nothing
, _insEBSOptimized = Nothing
, _insStateTransitionReason = Nothing
, _insInstanceLifecycle = Nothing
, _insIAMInstanceProfile = Nothing
, _insPrivateIPAddress = Nothing
, _insProductCodes = Nothing
, _insSpotInstanceRequestId = Nothing
, _insPrivateDNSName = Nothing
, _insStateReason = Nothing
, _insBlockDeviceMappings = Nothing
, _insPublicIPAddress = Nothing
, _insTags = Nothing
, _insInstanceId = pInstanceId_
, _insImageId = pImageId_
, _insAMILaunchIndex = pAMILaunchIndex_
, _insInstanceType = pInstanceType_
, _insLaunchTime = _Time # pLaunchTime_
, _insPlacement = pPlacement_
, _insMonitoring = pMonitoring_
, _insArchitecture = pArchitecture_
, _insRootDeviceType = pRootDeviceType_
, _insVirtualizationType = pVirtualizationType_
, _insHypervisor = pHypervisor_
, _insState = pState_
} | 1,509 | true | true | 0 | 16 | 614 | 401 | 282 | 119 | null | null |
advancedtelematic/quickcheck-state-machine-model | test/RQlite.hs | bsd-3-clause | putStrLnM :: String -> IO ()
putStrLnM str = when isDebugging $ putStrLn str | 76 | putStrLnM :: String -> IO ()
putStrLnM str = when isDebugging $ putStrLn str | 76 | putStrLnM str = when isDebugging $ putStrLn str | 47 | false | true | 0 | 7 | 13 | 33 | 15 | 18 | null | null |
paulkeene/FP101x | chapter06/Lab.hs | bsd-3-clause | -- ===================================
-- Ex. 8
-- ===================================
coords :: Integer -> Integer -> [(Integer,Integer)]
coords m n = [(x, y) | x <- [0..m], y <- [0..n]] | 188 | coords :: Integer -> Integer -> [(Integer,Integer)]
coords m n = [(x, y) | x <- [0..m], y <- [0..n]] | 100 | coords m n = [(x, y) | x <- [0..m], y <- [0..n]] | 48 | true | true | 0 | 8 | 27 | 71 | 41 | 30 | null | null |
facebookincubator/duckling | Duckling/Rules/EL.hs | bsd-3-clause | localeRules _ _ = [] | 20 | localeRules _ _ = [] | 20 | localeRules _ _ = [] | 20 | false | false | 0 | 5 | 4 | 13 | 6 | 7 | null | null |
ktvoelker/hydrogen | src/H/Prelude/Core.hs | gpl-3.0 | -- | Get the first element of a triple
fst3 :: (a, b, c) -> a
fst3 (x, _, _) = x | 80 | fst3 :: (a, b, c) -> a
fst3 (x, _, _) = x | 41 | fst3 (x, _, _) = x | 18 | true | true | 0 | 6 | 21 | 41 | 23 | 18 | null | null |
ganeti-github-testing/ganeti-test-1 | src/Ganeti/Types.hs | bsd-2-clause | -- | The description of the node role.
roleDescription :: NodeRole -> String
roleDescription NROffline = "offline" | 116 | roleDescription :: NodeRole -> String
roleDescription NROffline = "offline" | 77 | roleDescription NROffline = "offline" | 39 | true | true | 0 | 5 | 18 | 19 | 10 | 9 | null | null |
ezyang/ghc | compiler/deSugar/DsBinds.hs | bsd-3-clause | dictArity :: [Var] -> Arity
-- Don't count coercion variables in arity
dictArity dicts = count isId dicts | 105 | dictArity :: [Var] -> Arity
dictArity dicts = count isId dicts | 62 | dictArity dicts = count isId dicts | 34 | true | true | 0 | 7 | 17 | 34 | 15 | 19 | null | null |
NicolasDP/hit | Data/Git/Storage.hs | bsd-3-clause | -- | open a new git repository context
openRepo :: FilePath -> IO Git
openRepo path = Git path <$> newIORef []
<*> newIORef []
<*> packedRef
<*> (readConfigs >>= newIORef)
where packedRef = newCacheVal (packedRefsPath path)
(readPackedRefs path M.fromList)
(PackedRefs M.empty M.empty M.empty)
readConfigs = do
global <- E.try readGlobalConfig :: IO (Either IOException Config)
local <- E.try (readConfig path)
return $ snd $ partitionEithers [local,global]
-- | close a git repository context, closing all remaining fileReaders. | 716 | openRepo :: FilePath -> IO Git
openRepo path = Git path <$> newIORef []
<*> newIORef []
<*> packedRef
<*> (readConfigs >>= newIORef)
where packedRef = newCacheVal (packedRefsPath path)
(readPackedRefs path M.fromList)
(PackedRefs M.empty M.empty M.empty)
readConfigs = do
global <- E.try readGlobalConfig :: IO (Either IOException Config)
local <- E.try (readConfig path)
return $ snd $ partitionEithers [local,global]
-- | close a git repository context, closing all remaining fileReaders. | 677 | openRepo path = Git path <$> newIORef []
<*> newIORef []
<*> packedRef
<*> (readConfigs >>= newIORef)
where packedRef = newCacheVal (packedRefsPath path)
(readPackedRefs path M.fromList)
(PackedRefs M.empty M.empty M.empty)
readConfigs = do
global <- E.try readGlobalConfig :: IO (Either IOException Config)
local <- E.try (readConfig path)
return $ snd $ partitionEithers [local,global]
-- | close a git repository context, closing all remaining fileReaders. | 646 | true | true | 1 | 11 | 264 | 176 | 85 | 91 | null | null |
UBMLtonGroup/timberc | src/Derive.hs | bsd-3-clause | ttup n ts = foldl TAp (TId (tuple n)) ts | 68 | ttup n ts = foldl TAp (TId (tuple n)) ts | 68 | ttup n ts = foldl TAp (TId (tuple n)) ts | 68 | false | false | 0 | 9 | 37 | 30 | 14 | 16 | null | null |
emwap/feldspar-compiler | lib/Feldspar/Compiler/Imperative/ExternalProgram.hs | bsd-3-clause | blockToBlock :: TPEnv -> [BlockItem] -> (TPEnv, R.Block ())
blockToBlock env bis = (env'', R.Block (concat ds) (Sequence bs))
where (env', ds) = mapAccumL blockDeclToDecl env decls
(env'', bs) = blockItemsToProgram env' rest
(decls, rest) = span isBlockDecl bis
isBlockDecl BlockDecl{} = True
isBlockDecl _ = False | 358 | blockToBlock :: TPEnv -> [BlockItem] -> (TPEnv, R.Block ())
blockToBlock env bis = (env'', R.Block (concat ds) (Sequence bs))
where (env', ds) = mapAccumL blockDeclToDecl env decls
(env'', bs) = blockItemsToProgram env' rest
(decls, rest) = span isBlockDecl bis
isBlockDecl BlockDecl{} = True
isBlockDecl _ = False | 358 | blockToBlock env bis = (env'', R.Block (concat ds) (Sequence bs))
where (env', ds) = mapAccumL blockDeclToDecl env decls
(env'', bs) = blockItemsToProgram env' rest
(decls, rest) = span isBlockDecl bis
isBlockDecl BlockDecl{} = True
isBlockDecl _ = False | 298 | false | true | 4 | 9 | 90 | 131 | 72 | 59 | null | null |
tjakway/ghcjvm | compiler/basicTypes/OccName.hs | bsd-3-clause | isEmptyOccSet = isEmptyUniqSet | 34 | isEmptyOccSet = isEmptyUniqSet | 34 | isEmptyOccSet = isEmptyUniqSet | 34 | false | false | 0 | 4 | 6 | 6 | 3 | 3 | null | null |
phonohawk/HsOpenSSL | OpenSSL/BIO.hs | cc0-1.0 | -- Return value of BIO_reset is not
-- consistent in every BIO's so we
-- can't do error-checking.
-- |@'bioEOF' bio@ returns 1 if @bio@ has read EOF, the precise
-- meaning of EOF varies according to the BIO type.
bioEOF :: BIO -> IO Bool
bioEOF bio
= withBioPtr bio $ \ bioPtr ->
fmap (==1) (_eof bioPtr) | 383 | bioEOF :: BIO -> IO Bool
bioEOF bio
= withBioPtr bio $ \ bioPtr ->
fmap (==1) (_eof bioPtr) | 101 | bioEOF bio
= withBioPtr bio $ \ bioPtr ->
fmap (==1) (_eof bioPtr) | 76 | true | true | 0 | 7 | 135 | 58 | 30 | 28 | null | null |
boothead/free-channels | Channel.hs | bsd-3-clause | newChan :: IO (Chan a)
newChan = do
q <- newIORef S.empty
return $ Chan (putQ q) (getQ q) -- (putQ _) (getQ q) | 114 | newChan :: IO (Chan a)
newChan = do
q <- newIORef S.empty
return $ Chan (putQ q) (getQ q) -- (putQ _) (getQ q) | 114 | newChan = do
q <- newIORef S.empty
return $ Chan (putQ q) (getQ q) -- (putQ _) (getQ q) | 91 | false | true | 1 | 11 | 27 | 61 | 27 | 34 | null | null |
grandpascorpion/canon | Math/NumberTheory/Canon/Additive.hs | gpl-3.0 | crSubtract = crApplyAdtvOpt False | 35 | crSubtract = crApplyAdtvOpt False | 35 | crSubtract = crApplyAdtvOpt False | 35 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
sjakobi/brick | src/Brick/Widgets/Edit.hs | bsd-3-clause | -- | The attribute assigned to the editor when it does not have focus.
editAttr :: AttrName
editAttr = "edit" | 109 | editAttr :: AttrName
editAttr = "edit" | 38 | editAttr = "edit" | 17 | true | true | 0 | 4 | 19 | 12 | 7 | 5 | null | null |
tonyday567/chart-svg | src/Chart/Hud.hs | bsd-3-clause | placeGridLines :: Place -> HudBox -> Double -> Double -> [Point Double]
placeGridLines pl (Rect x z y w) a b
| pl == PlaceTop || pl == PlaceBottom = [Point a (y - b), Point a (w + b)]
| otherwise = [Point (x - b) a, Point (z + b) a] | 236 | placeGridLines :: Place -> HudBox -> Double -> Double -> [Point Double]
placeGridLines pl (Rect x z y w) a b
| pl == PlaceTop || pl == PlaceBottom = [Point a (y - b), Point a (w + b)]
| otherwise = [Point (x - b) a, Point (z + b) a] | 236 | placeGridLines pl (Rect x z y w) a b
| pl == PlaceTop || pl == PlaceBottom = [Point a (y - b), Point a (w + b)]
| otherwise = [Point (x - b) a, Point (z + b) a] | 164 | false | true | 1 | 10 | 56 | 140 | 71 | 69 | null | null |
snoyberg/ghc | compiler/basicTypes/Name.hs | bsd-3-clause | nameSrcSpan :: Name -> SrcSpan
nameUnique name = mkUniqueGrimily (n_uniq name) | 92 | nameSrcSpan :: Name -> SrcSpan
nameUnique name = mkUniqueGrimily (n_uniq name) | 91 | nameUnique name = mkUniqueGrimily (n_uniq name) | 48 | false | true | 0 | 7 | 24 | 27 | 13 | 14 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2017/M04/D05/Exercise.hs | mit | -- What is your investment growth for
-- 1. investing a lump-sum a year ago?
lumpSumInvestmentGrowth :: BitCoinPrices -> USD -> USD
lumpSumInvestmentGrowth btcData investment = undefined | 188 | lumpSumInvestmentGrowth :: BitCoinPrices -> USD -> USD
lumpSumInvestmentGrowth btcData investment = undefined | 109 | lumpSumInvestmentGrowth btcData investment = undefined | 54 | true | true | 0 | 6 | 28 | 31 | 15 | 16 | null | null |
brendanhay/gogol | gogol-runtimeconfig/gen/Network/Google/Resource/RuntimeConfig/Operations/Cancel.hs | mpl-2.0 | -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
ocUploadProtocol :: Lens' OperationsCancel (Maybe Text)
ocUploadProtocol
= lens _ocUploadProtocol
(\ s a -> s{_ocUploadProtocol = a}) | 203 | ocUploadProtocol :: Lens' OperationsCancel (Maybe Text)
ocUploadProtocol
= lens _ocUploadProtocol
(\ s a -> s{_ocUploadProtocol = a}) | 141 | ocUploadProtocol
= lens _ocUploadProtocol
(\ s a -> s{_ocUploadProtocol = a}) | 85 | true | true | 1 | 9 | 33 | 51 | 25 | 26 | null | null |
ndmitchell/hlint | src/Test/Annotations.hs | bsd-3-clause | -- Skip refactoring test if there is no hint.
testRefactor _ Nothing _ = pure [] | 80 | testRefactor _ Nothing _ = pure [] | 34 | testRefactor _ Nothing _ = pure [] | 34 | true | false | 1 | 6 | 15 | 20 | 9 | 11 | null | null |
massudaw/mtk | Test.hs | bsd-3-clause | propCovariance (Square re0 ) ye1 s1 (Square s2) = nearEqual (snd sc2) (squareT $ snd se2)
where
se2 = sqrtMeasure he1 (sqrtM re0) ye1 (s1,sqrtM s2)
sc2 = measure he1 re0 ye1 (s1,s2) | 204 | propCovariance (Square re0 ) ye1 s1 (Square s2) = nearEqual (snd sc2) (squareT $ snd se2)
where
se2 = sqrtMeasure he1 (sqrtM re0) ye1 (s1,sqrtM s2)
sc2 = measure he1 re0 ye1 (s1,s2) | 204 | propCovariance (Square re0 ) ye1 s1 (Square s2) = nearEqual (snd sc2) (squareT $ snd se2)
where
se2 = sqrtMeasure he1 (sqrtM re0) ye1 (s1,sqrtM s2)
sc2 = measure he1 re0 ye1 (s1,s2) | 204 | false | false | 3 | 8 | 55 | 109 | 50 | 59 | null | null |
supermario/stack | src/Stack/Types/Config.hs | bsd-3-clause | explicitSetupDeps :: (MonadReader env m, HasConfig env) => PackageName -> m Bool
explicitSetupDeps name = do
m <- asks $ configExplicitSetupDeps . getConfig
return $
-- Yes there are far cleverer ways to write this. I honestly consider
-- the explicit pattern matching much easier to parse at a glance.
case Map.lookup (Just name) m of
Just b -> b
Nothing ->
case Map.lookup Nothing m of
Just b -> b
Nothing -> False -- default value | 545 | explicitSetupDeps :: (MonadReader env m, HasConfig env) => PackageName -> m Bool
explicitSetupDeps name = do
m <- asks $ configExplicitSetupDeps . getConfig
return $
-- Yes there are far cleverer ways to write this. I honestly consider
-- the explicit pattern matching much easier to parse at a glance.
case Map.lookup (Just name) m of
Just b -> b
Nothing ->
case Map.lookup Nothing m of
Just b -> b
Nothing -> False -- default value | 545 | explicitSetupDeps name = do
m <- asks $ configExplicitSetupDeps . getConfig
return $
-- Yes there are far cleverer ways to write this. I honestly consider
-- the explicit pattern matching much easier to parse at a glance.
case Map.lookup (Just name) m of
Just b -> b
Nothing ->
case Map.lookup Nothing m of
Just b -> b
Nothing -> False -- default value | 464 | false | true | 0 | 14 | 188 | 121 | 59 | 62 | null | null |
fonzerelly/diamondKata | Diamond.hs | mit | createDiamond :: Char -> String
createDiamond 'A' = "A" | 56 | createDiamond :: Char -> String
createDiamond 'A' = "A" | 55 | createDiamond 'A' = "A" | 23 | false | true | 0 | 5 | 9 | 18 | 9 | 9 | null | null |
erochest/york-scripts | lib/Types.hs | apache-2.0 | resultMetric Failed = -1 | 55 | resultMetric Failed = -1 | 55 | resultMetric Failed = -1 | 55 | false | false | 0 | 5 | 34 | 11 | 5 | 6 | null | null |
rueshyna/gogol | gogol-identity-toolkit/gen/Network/Google/IdentityToolkit/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'IdentitytoolkitRelyingPartySignOutUserResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'irpsourLocalId'
identitytoolkitRelyingPartySignOutUserResponse
:: IdentitytoolkitRelyingPartySignOutUserResponse
identitytoolkitRelyingPartySignOutUserResponse =
IdentitytoolkitRelyingPartySignOutUserResponse'
{ _irpsourLocalId = Nothing
} | 462 | identitytoolkitRelyingPartySignOutUserResponse
:: IdentitytoolkitRelyingPartySignOutUserResponse
identitytoolkitRelyingPartySignOutUserResponse =
IdentitytoolkitRelyingPartySignOutUserResponse'
{ _irpsourLocalId = Nothing
} | 239 | identitytoolkitRelyingPartySignOutUserResponse =
IdentitytoolkitRelyingPartySignOutUserResponse'
{ _irpsourLocalId = Nothing
} | 138 | true | true | 1 | 7 | 60 | 31 | 17 | 14 | null | null |
alphaHeavy/cassandra-cql | tests/test-pool.hs | bsd-3-clause | createThings :: Query Schema () ()
createThings = "create table if not exists things (id uuid PRIMARY KEY, val text)" | 117 | createThings :: Query Schema () ()
createThings = "create table if not exists things (id uuid PRIMARY KEY, val text)" | 117 | createThings = "create table if not exists things (id uuid PRIMARY KEY, val text)" | 82 | false | true | 1 | 6 | 19 | 27 | 11 | 16 | null | null |
shangaslammi/haskeroids | Haskeroids/State.hs | mit | tickState kb s@(GameState pl a b p t g f) = s'
{ stateParticles = p'
, stateRandom = g'
} where
np' = initNewParticles np (stateParticles s')
(p', g') = runRandom np' $ stateRandom s'
(s',np) = runParticleGen $ do
let a' = map updateAsteroid a
pl' <- tickPlayer kb pl >>= collidePlayer a'
let b' = updateBullets $ case playerBullet pl' of
Nothing -> b
Just x -> x:b
(b'', a'') <- collideAsteroids b' a'
let (aa, ad) = partition asteroidAlive a''
na <- mapM spawnNewAsteroids ad
let (na', g') = runRandom (sequence $ concat na) g
t'
| not (playerAlive pl') && null t = [gameOverText]
| otherwise = t
gameOverText = setTextCenter (400,300) $ mkText f 50 "game over"
return s
{ statePlayer = pl'
, stateAsteroids = na' ++ aa
, stateBullets = b''
, stateParticles = tickParticles p
, stateTexts = t'
, stateRandom = g'
, stateFont = f
} | 1,149 | tickState kb s@(GameState pl a b p t g f) = s'
{ stateParticles = p'
, stateRandom = g'
} where
np' = initNewParticles np (stateParticles s')
(p', g') = runRandom np' $ stateRandom s'
(s',np) = runParticleGen $ do
let a' = map updateAsteroid a
pl' <- tickPlayer kb pl >>= collidePlayer a'
let b' = updateBullets $ case playerBullet pl' of
Nothing -> b
Just x -> x:b
(b'', a'') <- collideAsteroids b' a'
let (aa, ad) = partition asteroidAlive a''
na <- mapM spawnNewAsteroids ad
let (na', g') = runRandom (sequence $ concat na) g
t'
| not (playerAlive pl') && null t = [gameOverText]
| otherwise = t
gameOverText = setTextCenter (400,300) $ mkText f 50 "game over"
return s
{ statePlayer = pl'
, stateAsteroids = na' ++ aa
, stateBullets = b''
, stateParticles = tickParticles p
, stateTexts = t'
, stateRandom = g'
, stateFont = f
} | 1,149 | tickState kb s@(GameState pl a b p t g f) = s'
{ stateParticles = p'
, stateRandom = g'
} where
np' = initNewParticles np (stateParticles s')
(p', g') = runRandom np' $ stateRandom s'
(s',np) = runParticleGen $ do
let a' = map updateAsteroid a
pl' <- tickPlayer kb pl >>= collidePlayer a'
let b' = updateBullets $ case playerBullet pl' of
Nothing -> b
Just x -> x:b
(b'', a'') <- collideAsteroids b' a'
let (aa, ad) = partition asteroidAlive a''
na <- mapM spawnNewAsteroids ad
let (na', g') = runRandom (sequence $ concat na) g
t'
| not (playerAlive pl') && null t = [gameOverText]
| otherwise = t
gameOverText = setTextCenter (400,300) $ mkText f 50 "game over"
return s
{ statePlayer = pl'
, stateAsteroids = na' ++ aa
, stateBullets = b''
, stateParticles = tickParticles p
, stateTexts = t'
, stateRandom = g'
, stateFont = f
} | 1,149 | false | false | 0 | 19 | 473 | 377 | 190 | 187 | null | null |
isaacazuelos/cryptogram | src/Toy/Cryptogram/Dictionary.hs | mit | -- | Look up a word in the dictionary, to get all other words which it could be
-- under application of some key.
lookup :: Dictionary -> Text.Text -> [Text.Text]
lookup (Dictionary m) t = filter (/= t)
$ fromMaybe [] (fingerprint t >>= flip Map.lookup m) | 279 | lookup :: Dictionary -> Text.Text -> [Text.Text]
lookup (Dictionary m) t = filter (/= t)
$ fromMaybe [] (fingerprint t >>= flip Map.lookup m) | 165 | lookup (Dictionary m) t = filter (/= t)
$ fromMaybe [] (fingerprint t >>= flip Map.lookup m) | 116 | true | true | 0 | 10 | 71 | 74 | 38 | 36 | null | null |
talanis85/rechord | haScales/src/Data/Music/Scales.hs | gpl-3.0 | -- | Addition of accidentals
(<+>) :: Accidental -> Accidental -> Accidental
(Accidental a) <+> (Accidental b) = Accidental (a + b) | 131 | (<+>) :: Accidental -> Accidental -> Accidental
(Accidental a) <+> (Accidental b) = Accidental (a + b) | 102 | (Accidental a) <+> (Accidental b) = Accidental (a + b) | 54 | true | true | 0 | 11 | 21 | 54 | 27 | 27 | null | null |
naoto-ogawa/h-xproto-mysql | src/DataBase/MySQLX/Model.hs | mit | getTypedRow :: (MonadThrow m) => B.ByteString -> m PITR.TypedRow
getTypedRow = getMessage | 163 | getTypedRow :: (MonadThrow m) => B.ByteString -> m PITR.TypedRow
getTypedRow = getMessage | 143 | getTypedRow = getMessage | 51 | false | true | 0 | 8 | 85 | 31 | 16 | 15 | null | null |
spechub/Hets | PGIP/GraphQL/Resolver/OMS.hs | gpl-2.0 | resolveProofAttempts :: MonadIO m
=> LocIdBaseId
-> DBMonad m [GraphQLResultReasoningAttempt.ReasoningAttempt]
resolveProofAttempts conjectureKey = do
proofAttemptL <-
select $ from $ \(reasoning_attempts `InnerJoin` proof_attempts
`InnerJoin` reasoner_configurations
`LeftOuterJoin` reasoners) -> do
on (reasoners ?. ReasonerId ==.
reasoning_attempts ^. ReasoningAttemptUsedReasonerId)
on (reasoner_configurations ^. ReasonerConfigurationId ==.
reasoning_attempts ^. ReasoningAttemptReasonerConfigurationId)
on (coerceId (proof_attempts ^. ProofAttemptId) ==.
reasoning_attempts ^. ReasoningAttemptId)
where_ (proof_attempts ^. ProofAttemptConjectureId ==.
just (val conjectureKey))
return (reasoning_attempts, reasoners, reasoner_configurations)
mapM resolveReasoningAttempt proofAttemptL | 1,004 | resolveProofAttempts :: MonadIO m
=> LocIdBaseId
-> DBMonad m [GraphQLResultReasoningAttempt.ReasoningAttempt]
resolveProofAttempts conjectureKey = do
proofAttemptL <-
select $ from $ \(reasoning_attempts `InnerJoin` proof_attempts
`InnerJoin` reasoner_configurations
`LeftOuterJoin` reasoners) -> do
on (reasoners ?. ReasonerId ==.
reasoning_attempts ^. ReasoningAttemptUsedReasonerId)
on (reasoner_configurations ^. ReasonerConfigurationId ==.
reasoning_attempts ^. ReasoningAttemptReasonerConfigurationId)
on (coerceId (proof_attempts ^. ProofAttemptId) ==.
reasoning_attempts ^. ReasoningAttemptId)
where_ (proof_attempts ^. ProofAttemptConjectureId ==.
just (val conjectureKey))
return (reasoning_attempts, reasoners, reasoner_configurations)
mapM resolveReasoningAttempt proofAttemptL | 1,004 | resolveProofAttempts conjectureKey = do
proofAttemptL <-
select $ from $ \(reasoning_attempts `InnerJoin` proof_attempts
`InnerJoin` reasoner_configurations
`LeftOuterJoin` reasoners) -> do
on (reasoners ?. ReasonerId ==.
reasoning_attempts ^. ReasoningAttemptUsedReasonerId)
on (reasoner_configurations ^. ReasonerConfigurationId ==.
reasoning_attempts ^. ReasoningAttemptReasonerConfigurationId)
on (coerceId (proof_attempts ^. ProofAttemptId) ==.
reasoning_attempts ^. ReasoningAttemptId)
where_ (proof_attempts ^. ProofAttemptConjectureId ==.
just (val conjectureKey))
return (reasoning_attempts, reasoners, reasoner_configurations)
mapM resolveReasoningAttempt proofAttemptL | 851 | false | true | 0 | 18 | 282 | 194 | 97 | 97 | null | null |
nevrenato/Hets_Fork | HasCASL/HToken.hs | gpl-2.0 | -- | simple 'Id' possibly with compound list
classId :: GenParser Char st Id
classId = do
s <- pToken scanHCWords
(c, p) <- option ([], nullRange) $ comps hcKeys
return $ Id [s] c p | 193 | classId :: GenParser Char st Id
classId = do
s <- pToken scanHCWords
(c, p) <- option ([], nullRange) $ comps hcKeys
return $ Id [s] c p | 148 | classId = do
s <- pToken scanHCWords
(c, p) <- option ([], nullRange) $ comps hcKeys
return $ Id [s] c p | 116 | true | true | 1 | 12 | 47 | 81 | 38 | 43 | null | null |
danstiner/clod | src/Dupes.hs | mit | mergeOrderedStreamsWye :: (Monad m, Ord a) => MachineT m (MY a a) (MergedOperation a)
mergeOrderedStreamsWye= repeatedly start
where
start :: (Ord a) => PlanT (MY a a) (MergedOperation a) m ()
start = do
x <- awaits MaybeX
case x of
Just l -> right l
Nothing -> awaits JustY >>= yield . RightOnly
left :: (Ord a) => a -> PlanT (MY a a) (MergedOperation a) m ()
left r = do
x <- awaits MaybeX
case x of
Just l -> mergeStep l r
Nothing -> yield (RightOnly r) >> awaits JustY >>= yield . RightOnly
right :: (Ord a) => a -> PlanT (MY a a) (MergedOperation a) m ()
right l = do
y <- awaits MaybeY
case y of
Just r -> mergeStep l r
Nothing -> yield (LeftOnly l) >> awaits JustX >>= yield . LeftOnly
mergeStep :: (Ord a) => a -> a -> PlanT (MY a a) (MergedOperation a) m ()
mergeStep l r =
if l == r
then yield (Both l)
else if l < r
then do
yield (LeftOnly l)
left r
else do
yield (RightOnly r)
right l | 1,107 | mergeOrderedStreamsWye :: (Monad m, Ord a) => MachineT m (MY a a) (MergedOperation a)
mergeOrderedStreamsWye= repeatedly start
where
start :: (Ord a) => PlanT (MY a a) (MergedOperation a) m ()
start = do
x <- awaits MaybeX
case x of
Just l -> right l
Nothing -> awaits JustY >>= yield . RightOnly
left :: (Ord a) => a -> PlanT (MY a a) (MergedOperation a) m ()
left r = do
x <- awaits MaybeX
case x of
Just l -> mergeStep l r
Nothing -> yield (RightOnly r) >> awaits JustY >>= yield . RightOnly
right :: (Ord a) => a -> PlanT (MY a a) (MergedOperation a) m ()
right l = do
y <- awaits MaybeY
case y of
Just r -> mergeStep l r
Nothing -> yield (LeftOnly l) >> awaits JustX >>= yield . LeftOnly
mergeStep :: (Ord a) => a -> a -> PlanT (MY a a) (MergedOperation a) m ()
mergeStep l r =
if l == r
then yield (Both l)
else if l < r
then do
yield (LeftOnly l)
left r
else do
yield (RightOnly r)
right l | 1,107 | mergeOrderedStreamsWye= repeatedly start
where
start :: (Ord a) => PlanT (MY a a) (MergedOperation a) m ()
start = do
x <- awaits MaybeX
case x of
Just l -> right l
Nothing -> awaits JustY >>= yield . RightOnly
left :: (Ord a) => a -> PlanT (MY a a) (MergedOperation a) m ()
left r = do
x <- awaits MaybeX
case x of
Just l -> mergeStep l r
Nothing -> yield (RightOnly r) >> awaits JustY >>= yield . RightOnly
right :: (Ord a) => a -> PlanT (MY a a) (MergedOperation a) m ()
right l = do
y <- awaits MaybeY
case y of
Just r -> mergeStep l r
Nothing -> yield (LeftOnly l) >> awaits JustX >>= yield . LeftOnly
mergeStep :: (Ord a) => a -> a -> PlanT (MY a a) (MergedOperation a) m ()
mergeStep l r =
if l == r
then yield (Both l)
else if l < r
then do
yield (LeftOnly l)
left r
else do
yield (RightOnly r)
right l | 1,021 | false | true | 27 | 13 | 400 | 480 | 239 | 241 | null | null |
alexander-at-github/eta | compiler/ETA/HsSyn/HsTypes.hs | bsd-3-clause | -- | Do all type variables in this 'LHsTyVarBndr' come with kind annotations?
hsTvbAllKinded :: LHsTyVarBndrs name -> Bool
hsTvbAllKinded = all (isHsKindedTyVar . unLoc) . hsQTvBndrs | 182 | hsTvbAllKinded :: LHsTyVarBndrs name -> Bool
hsTvbAllKinded = all (isHsKindedTyVar . unLoc) . hsQTvBndrs | 104 | hsTvbAllKinded = all (isHsKindedTyVar . unLoc) . hsQTvBndrs | 59 | true | true | 0 | 8 | 26 | 40 | 18 | 22 | null | null |
thoughtpolice/cabal | Cabal/Distribution/Simple/Command.hs | bsd-3-clause | viewAsFieldDescr :: OptionField a -> FieldDescr a
viewAsFieldDescr (OptionField _n []) =
error "Distribution.command.viewAsFieldDescr: unexpected" | 148 | viewAsFieldDescr :: OptionField a -> FieldDescr a
viewAsFieldDescr (OptionField _n []) =
error "Distribution.command.viewAsFieldDescr: unexpected" | 148 | viewAsFieldDescr (OptionField _n []) =
error "Distribution.command.viewAsFieldDescr: unexpected" | 98 | false | true | 0 | 10 | 16 | 42 | 18 | 24 | null | null |
logistark/haskellbookexercises | 4 - BasicDatatypes/chapter4.hs | apache-2.0 | isPalindrome :: (Eq a) => [a] -> Bool
isPalindrome x = reverse x == x | 71 | isPalindrome :: (Eq a) => [a] -> Bool
isPalindrome x = reverse x == x | 69 | isPalindrome x = reverse x == x | 31 | false | true | 0 | 7 | 16 | 37 | 19 | 18 | null | null |
luispedro/alist | AListTest.hs | mit | case_take4undefined = (take 4 . F.toList . AL.fromList) [0,1,2,3,undefined] @?= [0,1,2,3] | 89 | case_take4undefined = (take 4 . F.toList . AL.fromList) [0,1,2,3,undefined] @?= [0,1,2,3] | 89 | case_take4undefined = (take 4 . F.toList . AL.fromList) [0,1,2,3,undefined] @?= [0,1,2,3] | 89 | false | false | 0 | 10 | 10 | 58 | 33 | 25 | null | null |
danidiaz/foldl-transduce-pipes | src/Pipes/Transduce/Internal.hs | bsd-3-clause | transduce1 (F f) (Fold1 (Other s)) = (Fold1 (Other (case s of
TrueFold x -> TrueFold (Foldl.handlesM (folding f) x)
ExhaustiveCont x -> ExhaustiveCont (\producer -> x (producer >-> Pipes.mapFoldable f))
NonexhaustiveCont x -> NonexhaustiveCont (\producer -> x (producer >-> Pipes.mapFoldable f))))) | 310 | transduce1 (F f) (Fold1 (Other s)) = (Fold1 (Other (case s of
TrueFold x -> TrueFold (Foldl.handlesM (folding f) x)
ExhaustiveCont x -> ExhaustiveCont (\producer -> x (producer >-> Pipes.mapFoldable f))
NonexhaustiveCont x -> NonexhaustiveCont (\producer -> x (producer >-> Pipes.mapFoldable f))))) | 310 | transduce1 (F f) (Fold1 (Other s)) = (Fold1 (Other (case s of
TrueFold x -> TrueFold (Foldl.handlesM (folding f) x)
ExhaustiveCont x -> ExhaustiveCont (\producer -> x (producer >-> Pipes.mapFoldable f))
NonexhaustiveCont x -> NonexhaustiveCont (\producer -> x (producer >-> Pipes.mapFoldable f))))) | 310 | false | false | 0 | 20 | 53 | 146 | 71 | 75 | null | null |
mikehat/blaze-all | benchmarks/BenchmarkUtils.hs | bsd-3-clause | id :: AttributeValue -- ^ Attribute value.
-> Attribute -- ^ Resulting attribute.
id = attribute "id" " id=\"" | 120 | id :: AttributeValue -- ^ Attribute value.
-> Attribute
id = attribute "id" " id=\"" | 88 | id = attribute "id" " id=\"" | 28 | true | true | 0 | 7 | 28 | 28 | 13 | 15 | null | null |
siddhanathan/ghc | compiler/basicTypes/Id.hs | bsd-3-clause | idRuleMatchInfo :: Id -> RuleMatchInfo
idRuleMatchInfo id = inlinePragmaRuleMatchInfo (idInlinePragma id) | 105 | idRuleMatchInfo :: Id -> RuleMatchInfo
idRuleMatchInfo id = inlinePragmaRuleMatchInfo (idInlinePragma id) | 105 | idRuleMatchInfo id = inlinePragmaRuleMatchInfo (idInlinePragma id) | 66 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
prl-tokyo/bigul-configuration-adaptation | Transformations/src/BiFlux/XPath/HXT/XPathParser.hs | mit | -- Booleans (3.4)
--
-- [21] OrExpr
orExpr :: XPathParser Expr
orExpr
= do
e1 <- andExpr
eRest <- many (exprRest orOp andExpr)
return (mkExprNode e1 eRest)
<?> "orExpr" | 196 | orExpr :: XPathParser Expr
orExpr
= do
e1 <- andExpr
eRest <- many (exprRest orOp andExpr)
return (mkExprNode e1 eRest)
<?> "orExpr" | 160 | orExpr
= do
e1 <- andExpr
eRest <- many (exprRest orOp andExpr)
return (mkExprNode e1 eRest)
<?> "orExpr" | 133 | true | true | 2 | 10 | 56 | 67 | 30 | 37 | null | null |
jtojnar/haste-compiler | src/Data/JSTarget/Print.hs | bsd-3-clause | norm (BinOp Neq a (Lit (LBool False))) = norm a | 47 | norm (BinOp Neq a (Lit (LBool False))) = norm a | 47 | norm (BinOp Neq a (Lit (LBool False))) = norm a | 47 | false | false | 0 | 10 | 9 | 35 | 16 | 19 | null | null |
ony/Yampa-core | src/FRP/Yampa/Basic.hs | bsd-3-clause | -- | Override initial value of input signal.
initially :: a -> SF a a
initially = (--> identity) | 96 | initially :: a -> SF a a
initially = (--> identity) | 51 | initially = (--> identity) | 26 | true | true | 0 | 6 | 18 | 25 | 14 | 11 | null | null |
Paulo-Janrain/timeparsers | Data/Time/Parsers/Util.hs | bsd-3-clause | -- | Return whether a given flag is set.
isFlagSet :: Flag -> OptionedParser Bool
isFlagSet f = asks $ Set.member f . flags | 123 | isFlagSet :: Flag -> OptionedParser Bool
isFlagSet f = asks $ Set.member f . flags | 82 | isFlagSet f = asks $ Set.member f . flags | 41 | true | true | 2 | 7 | 23 | 41 | 18 | 23 | null | null |
SamirTalwar/Smoke | src/lib/Test/Smoke/Plan.hs | mit | readStdErr :: ResolvedPath Dir -> Test -> Planning (Vector (Assert StdErr))
readStdErr location test = mapM (readTestOutput location) (testStdErr test) | 151 | readStdErr :: ResolvedPath Dir -> Test -> Planning (Vector (Assert StdErr))
readStdErr location test = mapM (readTestOutput location) (testStdErr test) | 151 | readStdErr location test = mapM (readTestOutput location) (testStdErr test) | 75 | false | true | 0 | 11 | 19 | 59 | 28 | 31 | null | null |
haasn/hsbooru | src/HsBooru/Types.hs | gpl-3.0 | subdivide ss as = subdivide sl al ++ subdivide sr ar
where (sl, sr) = splitIS ss
[al, ar] = transpose $ chunksOf 2 as
-- Try to fairly split an intervalset in half by splitting along the estimated
-- median | 221 | subdivide ss as = subdivide sl al ++ subdivide sr ar
where (sl, sr) = splitIS ss
[al, ar] = transpose $ chunksOf 2 as
-- Try to fairly split an intervalset in half by splitting along the estimated
-- median | 221 | subdivide ss as = subdivide sl al ++ subdivide sr ar
where (sl, sr) = splitIS ss
[al, ar] = transpose $ chunksOf 2 as
-- Try to fairly split an intervalset in half by splitting along the estimated
-- median | 221 | false | false | 5 | 5 | 55 | 73 | 33 | 40 | null | null |
fmapfmapfmap/amazonka | amazonka-datapipeline/gen/Network/AWS/DataPipeline/SetStatus.hs | mpl-2.0 | -- | Creates a value of 'SetStatus' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ssPipelineId'
--
-- * 'ssObjectIds'
--
-- * 'ssStatus'
setStatus
:: Text -- ^ 'ssPipelineId'
-> Text -- ^ 'ssStatus'
-> SetStatus
setStatus pPipelineId_ pStatus_ =
SetStatus'
{ _ssPipelineId = pPipelineId_
, _ssObjectIds = mempty
, _ssStatus = pStatus_
} | 456 | setStatus
:: Text -- ^ 'ssPipelineId'
-> Text -- ^ 'ssStatus'
-> SetStatus
setStatus pPipelineId_ pStatus_ =
SetStatus'
{ _ssPipelineId = pPipelineId_
, _ssObjectIds = mempty
, _ssStatus = pStatus_
} | 231 | setStatus pPipelineId_ pStatus_ =
SetStatus'
{ _ssPipelineId = pPipelineId_
, _ssObjectIds = mempty
, _ssStatus = pStatus_
} | 144 | true | true | 0 | 6 | 104 | 55 | 36 | 19 | null | null |
edgarklerks/dotfiles | .xmonad/xmonad.hs | bsd-2-clause | -- modMask lets you specify which modkey you want to use. The default
-- is mod1Mask ("left alt"). You may also consider using mod3Mask
-- ("right alt"), which does not conflict with emacs keybindings. The
-- "windows key" is usually mod4Mask.
--
myModMask = mod4Mask | 274 | myModMask = mod4Mask | 26 | myModMask = mod4Mask | 26 | true | false | 0 | 4 | 51 | 11 | 8 | 3 | null | null |
tolysz/vector-algorithms | bench/Blocks.hs | bsd-3-clause | modulo :: Integral e => e -> Int -> IO e
modulo m n = return $ fromIntegral n `mod` m | 85 | modulo :: Integral e => e -> Int -> IO e
modulo m n = return $ fromIntegral n `mod` m | 85 | modulo m n = return $ fromIntegral n `mod` m | 44 | false | true | 0 | 8 | 20 | 47 | 23 | 24 | null | null |
jbetzend/statMusic | src/Parser.hs | gpl-3.0 | parseStaff :: Parser Staff
parseStaff = do string "<staff>"
s <- decimal
string "</staff>"
pure s
-- ex: <voice>1</voice> | 170 | parseStaff :: Parser Staff
parseStaff = do string "<staff>"
s <- decimal
string "</staff>"
pure s
-- ex: <voice>1</voice> | 170 | parseStaff = do string "<staff>"
s <- decimal
string "</staff>"
pure s
-- ex: <voice>1</voice> | 143 | false | true | 0 | 8 | 67 | 46 | 18 | 28 | null | null |
agrafix/Spock | Spock-core/src/Web/Spock/Internal/Cookies.hs | bsd-3-clause | -- | Default cookie settings, equals
--
-- > CookieSettings
-- > { cs_EOL = CookieValidForSession
-- > , cs_HTTPOnly = False
-- > , cs_secure = False
-- > , cs_domain = Nothing
-- > , cs_path = Just "/"
-- > }
defaultCookieSettings :: CookieSettings
defaultCookieSettings =
CookieSettings
{ cs_EOL = CookieValidForSession,
cs_HTTPOnly = False,
cs_secure = False,
cs_domain = Nothing,
cs_path = Just "/"
} | 463 | defaultCookieSettings :: CookieSettings
defaultCookieSettings =
CookieSettings
{ cs_EOL = CookieValidForSession,
cs_HTTPOnly = False,
cs_secure = False,
cs_domain = Nothing,
cs_path = Just "/"
} | 228 | defaultCookieSettings =
CookieSettings
{ cs_EOL = CookieValidForSession,
cs_HTTPOnly = False,
cs_secure = False,
cs_domain = Nothing,
cs_path = Just "/"
} | 188 | true | true | 0 | 8 | 126 | 59 | 38 | 21 | null | null |
maxigit/sql-fragment | tests/Database/SQLFragment/LensSpec.hs | bsd-3-clause | c = "c.x" :: SQLFragment '[Tagged xL String] '[] | 48 | c = "c.x" :: SQLFragment '[Tagged xL String] '[] | 48 | c = "c.x" :: SQLFragment '[Tagged xL String] '[] | 48 | false | false | 0 | 8 | 8 | 31 | 15 | 16 | null | null |
Cahu/krpc-hs | src/KRPCHS/SpaceCenter.hs | gpl-3.0 | getParachuteArmedStreamReq :: KRPCHS.SpaceCenter.Parachute -> KRPCStreamReq (Bool)
getParachuteArmedStreamReq thisArg =
let req = makeRequest "SpaceCenter" "Parachute_get_Armed" [makeArgument 0 thisArg]
in makeStream req | 229 | getParachuteArmedStreamReq :: KRPCHS.SpaceCenter.Parachute -> KRPCStreamReq (Bool)
getParachuteArmedStreamReq thisArg =
let req = makeRequest "SpaceCenter" "Parachute_get_Armed" [makeArgument 0 thisArg]
in makeStream req | 229 | getParachuteArmedStreamReq thisArg =
let req = makeRequest "SpaceCenter" "Parachute_get_Armed" [makeArgument 0 thisArg]
in makeStream req | 146 | false | true | 0 | 11 | 29 | 60 | 28 | 32 | null | null |
ekmett/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | -- Address of a (presumably static) GC object
isCFunctionLabel :: CLabel -> Bool
isCFunctionLabel lbl = case labelType lbl of
CodeLabel -> True
_other -> False | 211 | isCFunctionLabel :: CLabel -> Bool
isCFunctionLabel lbl = case labelType lbl of
CodeLabel -> True
_other -> False | 164 | isCFunctionLabel lbl = case labelType lbl of
CodeLabel -> True
_other -> False | 129 | true | true | 0 | 7 | 77 | 38 | 19 | 19 | null | null |
ekmett/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | genCCall
:: Bool -- 32 bit platform?
-> ForeignTarget -- function to call
-> [CmmFormal] -- where to put the result
-> [CmmActual] -- arguments (of mixed type)
-> NatM InstrBlock
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-- Unroll memcpy calls if the source and destination pointers are at
-- least DWORD aligned and the number of bytes to copy isn't too
-- large. Otherwise, call C's memcpy.
genCCall is32Bit (PrimTarget MO_Memcpy) _
[dst, src,
(CmmLit (CmmInt n _)),
(CmmLit (CmmInt align _))]
| n <= maxInlineSizeThreshold && align .&. 3 == 0 = do
code_dst <- getAnyReg dst
dst_r <- getNewRegNat size
code_src <- getAnyReg src
src_r <- getNewRegNat size
tmp_r <- getNewRegNat size
return $ code_dst dst_r `appOL` code_src src_r `appOL`
go dst_r src_r tmp_r n
where
size = if align .&. 4 /= 0 then II32 else (archWordSize is32Bit)
sizeBytes = fromIntegral (sizeInBytes size)
go :: Reg -> Reg -> Reg -> Integer -> OrdList Instr
go dst src tmp i
| i >= sizeBytes =
unitOL (MOV size (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV size (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - sizeBytes)
-- Deal with remaining bytes.
| i >= 4 = -- Will never happen on 32-bit
unitOL (MOV II32 (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV II32 (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - 4)
| i >= 2 =
unitOL (MOVZxL II16 (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV II16 (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - 2)
| i >= 1 =
unitOL (MOVZxL II8 (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV II8 (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - 1)
| otherwise = nilOL
where
src_addr = AddrBaseIndex (EABaseReg src) EAIndexNone
(ImmInteger (n - i))
dst_addr = AddrBaseIndex (EABaseReg dst) EAIndexNone
(ImmInteger (n - i)) | 2,241 | genCCall
:: Bool -- 32 bit platform?
-> ForeignTarget -- function to call
-> [CmmFormal] -- where to put the result
-> [CmmActual] -- arguments (of mixed type)
-> NatM InstrBlock
genCCall is32Bit (PrimTarget MO_Memcpy) _
[dst, src,
(CmmLit (CmmInt n _)),
(CmmLit (CmmInt align _))]
| n <= maxInlineSizeThreshold && align .&. 3 == 0 = do
code_dst <- getAnyReg dst
dst_r <- getNewRegNat size
code_src <- getAnyReg src
src_r <- getNewRegNat size
tmp_r <- getNewRegNat size
return $ code_dst dst_r `appOL` code_src src_r `appOL`
go dst_r src_r tmp_r n
where
size = if align .&. 4 /= 0 then II32 else (archWordSize is32Bit)
sizeBytes = fromIntegral (sizeInBytes size)
go :: Reg -> Reg -> Reg -> Integer -> OrdList Instr
go dst src tmp i
| i >= sizeBytes =
unitOL (MOV size (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV size (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - sizeBytes)
-- Deal with remaining bytes.
| i >= 4 = -- Will never happen on 32-bit
unitOL (MOV II32 (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV II32 (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - 4)
| i >= 2 =
unitOL (MOVZxL II16 (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV II16 (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - 2)
| i >= 1 =
unitOL (MOVZxL II8 (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV II8 (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - 1)
| otherwise = nilOL
where
src_addr = AddrBaseIndex (EABaseReg src) EAIndexNone
(ImmInteger (n - i))
dst_addr = AddrBaseIndex (EABaseReg dst) EAIndexNone
(ImmInteger (n - i)) | 2,001 | genCCall is32Bit (PrimTarget MO_Memcpy) _
[dst, src,
(CmmLit (CmmInt n _)),
(CmmLit (CmmInt align _))]
| n <= maxInlineSizeThreshold && align .&. 3 == 0 = do
code_dst <- getAnyReg dst
dst_r <- getNewRegNat size
code_src <- getAnyReg src
src_r <- getNewRegNat size
tmp_r <- getNewRegNat size
return $ code_dst dst_r `appOL` code_src src_r `appOL`
go dst_r src_r tmp_r n
where
size = if align .&. 4 /= 0 then II32 else (archWordSize is32Bit)
sizeBytes = fromIntegral (sizeInBytes size)
go :: Reg -> Reg -> Reg -> Integer -> OrdList Instr
go dst src tmp i
| i >= sizeBytes =
unitOL (MOV size (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV size (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - sizeBytes)
-- Deal with remaining bytes.
| i >= 4 = -- Will never happen on 32-bit
unitOL (MOV II32 (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV II32 (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - 4)
| i >= 2 =
unitOL (MOVZxL II16 (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV II16 (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - 2)
| i >= 1 =
unitOL (MOVZxL II8 (OpAddr src_addr) (OpReg tmp)) `appOL`
unitOL (MOV II8 (OpReg tmp) (OpAddr dst_addr)) `appOL`
go dst src tmp (i - 1)
| otherwise = nilOL
where
src_addr = AddrBaseIndex (EABaseReg src) EAIndexNone
(ImmInteger (n - i))
dst_addr = AddrBaseIndex (EABaseReg dst) EAIndexNone
(ImmInteger (n - i)) | 1,757 | true | true | 4 | 15 | 771 | 769 | 372 | 397 | null | null |
spoqa/nirum | src/Nirum/Constructs/Identifier.hs | gpl-3.0 | toSnakeCaseText :: Identifier -> T.Text
toSnakeCaseText identifier = T.intercalate "_" $ tokens identifier | 106 | toSnakeCaseText :: Identifier -> T.Text
toSnakeCaseText identifier = T.intercalate "_" $ tokens identifier | 106 | toSnakeCaseText identifier = T.intercalate "_" $ tokens identifier | 66 | false | true | 0 | 7 | 12 | 32 | 15 | 17 | null | null |
afcowie/http-common | lib/Network/Http/RequestBuilder.hs | bsd-3-clause | setContentMultipart :: Boundary -> RequestBuilder ()
setContentMultipart boundary = do
setHeader "Content-Type" (S.append "multipart/form-data; boundary=" (unBoundary boundary))
setBoundary boundary | 206 | setContentMultipart :: Boundary -> RequestBuilder ()
setContentMultipart boundary = do
setHeader "Content-Type" (S.append "multipart/form-data; boundary=" (unBoundary boundary))
setBoundary boundary | 206 | setContentMultipart boundary = do
setHeader "Content-Type" (S.append "multipart/form-data; boundary=" (unBoundary boundary))
setBoundary boundary | 153 | false | true | 0 | 12 | 26 | 57 | 25 | 32 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.