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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
janschulz/pandoc | src/Text/Pandoc/Readers/MediaWiki.hs | gpl-2.0 | doubleQuotes :: MWParser Inlines
doubleQuotes = B.doubleQuoted . trimInlines . mconcat <$> try
((getState >>= guard . readerSmart . mwOptions) *>
openDoubleQuote *> manyTill inline closeDoubleQuote )
where openDoubleQuote = char '"' <* lookAhead alphaNum
closeDoubleQuote = char '"' <* notFollowedBy alphaNum | 326 | doubleQuotes :: MWParser Inlines
doubleQuotes = B.doubleQuoted . trimInlines . mconcat <$> try
((getState >>= guard . readerSmart . mwOptions) *>
openDoubleQuote *> manyTill inline closeDoubleQuote )
where openDoubleQuote = char '"' <* lookAhead alphaNum
closeDoubleQuote = char '"' <* notFollowedBy alphaNum | 326 | doubleQuotes = B.doubleQuoted . trimInlines . mconcat <$> try
((getState >>= guard . readerSmart . mwOptions) *>
openDoubleQuote *> manyTill inline closeDoubleQuote )
where openDoubleQuote = char '"' <* lookAhead alphaNum
closeDoubleQuote = char '"' <* notFollowedBy alphaNum | 293 | false | true | 1 | 11 | 59 | 95 | 46 | 49 | null | null |
OS2World/DEV-UTIL-HUGS | libraries/Graphics/Rendering/OpenGL/GLU/Quadrics.hs | bsd-3-clause | renderPrimitive quadricObj (Cylinder b t h s n) =
gluCylinder quadricObj b t h s n | 85 | renderPrimitive quadricObj (Cylinder b t h s n) =
gluCylinder quadricObj b t h s n | 85 | renderPrimitive quadricObj (Cylinder b t h s n) =
gluCylinder quadricObj b t h s n | 85 | false | false | 0 | 7 | 18 | 38 | 18 | 20 | null | null |
charlesrosenbauer/Bzo-Compiler | src/BzoParserRules.hs | gpl-3.0 | parserIter fname tokens ((BzS_Token _ (TkNewline _))
:x@(BzS_PolyHead p0 xs):stk) = parserIter fname tokens (x:stk) | 158 | parserIter fname tokens ((BzS_Token _ (TkNewline _))
:x@(BzS_PolyHead p0 xs):stk) = parserIter fname tokens (x:stk) | 158 | parserIter fname tokens ((BzS_Token _ (TkNewline _))
:x@(BzS_PolyHead p0 xs):stk) = parserIter fname tokens (x:stk) | 158 | false | false | 0 | 11 | 57 | 63 | 32 | 31 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/course/2014-10-edx-delft-fp101x-intro-to-fp-erik-meijer/lab6.hs | unlicense | e21 :: [Test]
e21 = U.t "e21"
ex21
82 | 52 | e21 :: [Test]
e21 = U.t "e21"
ex21
82 | 52 | e21 = U.t "e21"
ex21
82 | 38 | false | true | 1 | 6 | 23 | 26 | 12 | 14 | null | null |
feliposz/learning-stuff | haskell/c9lectures-ch9.hs | mit | example1 = do s <- fsGetLine
fsPutStrLn s
{-------------------------------
Hangman
one player types secret word
the other player enters a sequence of guesses
for each guess, the computer says which letter in the secret word occur in the guess(?)
--------------------------------}
-- Hugs originaly had a primitive getCh :: IO Char, but that doesn't work
-- This should work with GHCI (needs import System.IO)
-- Check also FFI (foreign function interface) for importing/exporting external functions from C | 522 | example1 = do s <- fsGetLine
fsPutStrLn s
{-------------------------------
Hangman
one player types secret word
the other player enters a sequence of guesses
for each guess, the computer says which letter in the secret word occur in the guess(?)
--------------------------------}
-- Hugs originaly had a primitive getCh :: IO Char, but that doesn't work
-- This should work with GHCI (needs import System.IO)
-- Check also FFI (foreign function interface) for importing/exporting external functions from C | 522 | example1 = do s <- fsGetLine
fsPutStrLn s
{-------------------------------
Hangman
one player types secret word
the other player enters a sequence of guesses
for each guess, the computer says which letter in the secret word occur in the guess(?)
--------------------------------}
-- Hugs originaly had a primitive getCh :: IO Char, but that doesn't work
-- This should work with GHCI (needs import System.IO)
-- Check also FFI (foreign function interface) for importing/exporting external functions from C | 522 | false | false | 1 | 8 | 92 | 27 | 12 | 15 | null | null |
alanz/Blobs | lib/DData/IntMap.hs | lgpl-2.1 | unionWithKey f (Tip k x) t = insertWithKey f k x t | 50 | unionWithKey f (Tip k x) t = insertWithKey f k x t | 50 | unionWithKey f (Tip k x) t = insertWithKey f k x t | 50 | false | false | 1 | 6 | 11 | 35 | 14 | 21 | null | null |
ThoughtLeadr/neo4j-haskell-http-client | src/Database/Neo4j/Node.hs | bsd-3-clause | nodeFromResponseBody body = do
case Attoparsec.parse json body of
Attoparsec.Done _ r -> case fromJSON r of
Error err -> Nothing
Success n@(Node {..}) -> Just n
Attoparsec.Fail _ _ _ -> Nothing | 237 | nodeFromResponseBody body = do
case Attoparsec.parse json body of
Attoparsec.Done _ r -> case fromJSON r of
Error err -> Nothing
Success n@(Node {..}) -> Just n
Attoparsec.Fail _ _ _ -> Nothing | 237 | nodeFromResponseBody body = do
case Attoparsec.parse json body of
Attoparsec.Done _ r -> case fromJSON r of
Error err -> Nothing
Success n@(Node {..}) -> Just n
Attoparsec.Fail _ _ _ -> Nothing | 237 | false | false | 1 | 18 | 76 | 96 | 42 | 54 | null | null |
purebred-mua/purebred | src/Purebred/Types.hs | agpl-3.0 | mvMailListOfAttachmentsKeybindings :: Lens' MailViewSettings [Keybinding 'ViewMail 'MailListOfAttachments]
mvMailListOfAttachmentsKeybindings = lens _mvMailListOfAttachmentsKeybindings (\s x -> s { _mvMailListOfAttachmentsKeybindings = x }) | 240 | mvMailListOfAttachmentsKeybindings :: Lens' MailViewSettings [Keybinding 'ViewMail 'MailListOfAttachments]
mvMailListOfAttachmentsKeybindings = lens _mvMailListOfAttachmentsKeybindings (\s x -> s { _mvMailListOfAttachmentsKeybindings = x }) | 240 | mvMailListOfAttachmentsKeybindings = lens _mvMailListOfAttachmentsKeybindings (\s x -> s { _mvMailListOfAttachmentsKeybindings = x }) | 133 | false | true | 0 | 9 | 19 | 51 | 27 | 24 | null | null |
nevrenato/Hets_Fork | OWL2/Function.hs | gpl-2.0 | maybeDo :: (Function a) => Action -> AMap -> Maybe a -> Maybe a
maybeDo t mp = fmap $ function t mp | 99 | maybeDo :: (Function a) => Action -> AMap -> Maybe a -> Maybe a
maybeDo t mp = fmap $ function t mp | 99 | maybeDo t mp = fmap $ function t mp | 35 | false | true | 2 | 10 | 22 | 57 | 26 | 31 | null | null |
gdevanla/scotty-from-ground-up | app/Main3.hs | bsd-3-clause | cond :: Eq t => t -> t -> Bool
cond condition_str = f where
f i = i == condition_str | 86 | cond :: Eq t => t -> t -> Bool
cond condition_str = f where
f i = i == condition_str | 86 | cond condition_str = f where
f i = i == condition_str | 55 | false | true | 2 | 9 | 22 | 56 | 23 | 33 | null | null |
mcschroeder/ghc | compiler/iface/IfaceType.hs | bsd-3-clause | toIfaceCoercion (TransCo co1 co2) = IfaceTransCo (toIfaceCoercion co1)
(toIfaceCoercion co2) | 145 | toIfaceCoercion (TransCo co1 co2) = IfaceTransCo (toIfaceCoercion co1)
(toIfaceCoercion co2) | 145 | toIfaceCoercion (TransCo co1 co2) = IfaceTransCo (toIfaceCoercion co1)
(toIfaceCoercion co2) | 145 | false | false | 0 | 7 | 62 | 34 | 16 | 18 | null | null |
mainland/dph | dph-lifted-vseg/Data/Array/Parallel/Lifted/Combinators.hs | bsd-3-clause | mapPP_v :: (PA a, PA b)
=> (a :-> b) -> PArray a -> PArray b
mapPP_v f as
= PA.replicate (PA.length as) f $:^ as | 130 | mapPP_v :: (PA a, PA b)
=> (a :-> b) -> PArray a -> PArray b
mapPP_v f as
= PA.replicate (PA.length as) f $:^ as | 130 | mapPP_v f as
= PA.replicate (PA.length as) f $:^ as | 61 | false | true | 0 | 9 | 43 | 71 | 35 | 36 | null | null |
dschoepe/tud-mensa | TUDMensa.hs | bsd-3-clause | -- | Retrieve and parse menu for current week
getMenu :: Date -> Location -> IO WeekMenu
getMenu = (.) (fmap parseWeek) . getWeekly | 131 | getMenu :: Date -> Location -> IO WeekMenu
getMenu = (.) (fmap parseWeek) . getWeekly | 85 | getMenu = (.) (fmap parseWeek) . getWeekly | 42 | true | true | 0 | 8 | 23 | 38 | 20 | 18 | null | null |
yliu120/K3 | src/Language/K3/Analysis/Provenance/Inference.hs | apache-2.0 | {- Analysis entry point -}
inferProgramProvenance :: K3 Declaration -> Either String (K3 Declaration, PIEnv)
inferProgramProvenance prog = do
lcenv <- lambdaClosures prog
liftEitherTM $ runPInfE (pienv0 lcenv) $ doInference prog
where
liftEitherTM = either (Left . T.unpack) Right
doInference p = do
np <- globalsProv p
np' <- mapExpression inferExprProvenance np
np'' <- simplifyProgramProvenance np'
markAllGlobals np''
globalsProv :: K3 Declaration -> PInfM (K3 Declaration)
globalsProv p = inferAllRcrDecls p >>= inferAllDecls
inferAllRcrDecls p = mapProgram initializeRcrDeclProv return return Nothing p
inferAllDecls p = mapProgram inferDeclProv return return Nothing p
markAllGlobals p = mapProgram markGlobalProv return return Nothing p
-- | Repeat provenance inference on a global with an initializer. | 882 | inferProgramProvenance :: K3 Declaration -> Either String (K3 Declaration, PIEnv)
inferProgramProvenance prog = do
lcenv <- lambdaClosures prog
liftEitherTM $ runPInfE (pienv0 lcenv) $ doInference prog
where
liftEitherTM = either (Left . T.unpack) Right
doInference p = do
np <- globalsProv p
np' <- mapExpression inferExprProvenance np
np'' <- simplifyProgramProvenance np'
markAllGlobals np''
globalsProv :: K3 Declaration -> PInfM (K3 Declaration)
globalsProv p = inferAllRcrDecls p >>= inferAllDecls
inferAllRcrDecls p = mapProgram initializeRcrDeclProv return return Nothing p
inferAllDecls p = mapProgram inferDeclProv return return Nothing p
markAllGlobals p = mapProgram markGlobalProv return return Nothing p
-- | Repeat provenance inference on a global with an initializer. | 855 | inferProgramProvenance prog = do
lcenv <- lambdaClosures prog
liftEitherTM $ runPInfE (pienv0 lcenv) $ doInference prog
where
liftEitherTM = either (Left . T.unpack) Right
doInference p = do
np <- globalsProv p
np' <- mapExpression inferExprProvenance np
np'' <- simplifyProgramProvenance np'
markAllGlobals np''
globalsProv :: K3 Declaration -> PInfM (K3 Declaration)
globalsProv p = inferAllRcrDecls p >>= inferAllDecls
inferAllRcrDecls p = mapProgram initializeRcrDeclProv return return Nothing p
inferAllDecls p = mapProgram inferDeclProv return return Nothing p
markAllGlobals p = mapProgram markGlobalProv return return Nothing p
-- | Repeat provenance inference on a global with an initializer. | 773 | true | true | 8 | 11 | 182 | 227 | 108 | 119 | null | null |
enolan/whiteout | src/Test/Network/BitTorrent/Whiteout.hs | bsd-3-clause | verifyMultiFileShouldSucceed :: Assertion
verifyMultiFileShouldSucceed = verifyGeneric
"test-data/larry lessig - code v2.torrent"
"test-data/Larry Lessig - Code V2"
True | 181 | verifyMultiFileShouldSucceed :: Assertion
verifyMultiFileShouldSucceed = verifyGeneric
"test-data/larry lessig - code v2.torrent"
"test-data/Larry Lessig - Code V2"
True | 181 | verifyMultiFileShouldSucceed = verifyGeneric
"test-data/larry lessig - code v2.torrent"
"test-data/Larry Lessig - Code V2"
True | 139 | false | true | 0 | 4 | 28 | 20 | 9 | 11 | null | null |
zenhack/haskell-capnp | tests/Util.hs | mit | interactCapnpWithSchema :: String -> String -> LBS.ByteString -> [String] -> ResourceT IO (ExitCode, LBS.ByteString, LBS.ByteString)
interactCapnpWithSchema subCommand msgSchema stdInBytes args = do
let writeTempFile = runResourceT $ do
(_, (path, hndl)) <- allocate
(openTempFile "/tmp" "schema.capnp")
(\(_, hndl) -> hClose hndl)
lift $ hPutStr hndl msgSchema
return path
schemaFile <- snd <$> allocate writeTempFile removeFile
lift $ readCreateProcessWithExitCode (proc "capnp" ([subCommand, schemaFile] ++ args)) stdInBytes
-- | @'decodeValue' schema typename message@ decodes the value at the root of
-- the message and converts it to text. This is a thin wrapper around
-- 'capnpDecode'. | 774 | interactCapnpWithSchema :: String -> String -> LBS.ByteString -> [String] -> ResourceT IO (ExitCode, LBS.ByteString, LBS.ByteString)
interactCapnpWithSchema subCommand msgSchema stdInBytes args = do
let writeTempFile = runResourceT $ do
(_, (path, hndl)) <- allocate
(openTempFile "/tmp" "schema.capnp")
(\(_, hndl) -> hClose hndl)
lift $ hPutStr hndl msgSchema
return path
schemaFile <- snd <$> allocate writeTempFile removeFile
lift $ readCreateProcessWithExitCode (proc "capnp" ([subCommand, schemaFile] ++ args)) stdInBytes
-- | @'decodeValue' schema typename message@ decodes the value at the root of
-- the message and converts it to text. This is a thin wrapper around
-- 'capnpDecode'. | 774 | interactCapnpWithSchema subCommand msgSchema stdInBytes args = do
let writeTempFile = runResourceT $ do
(_, (path, hndl)) <- allocate
(openTempFile "/tmp" "schema.capnp")
(\(_, hndl) -> hClose hndl)
lift $ hPutStr hndl msgSchema
return path
schemaFile <- snd <$> allocate writeTempFile removeFile
lift $ readCreateProcessWithExitCode (proc "capnp" ([subCommand, schemaFile] ++ args)) stdInBytes
-- | @'decodeValue' schema typename message@ decodes the value at the root of
-- the message and converts it to text. This is a thin wrapper around
-- 'capnpDecode'. | 641 | false | true | 0 | 17 | 174 | 191 | 98 | 93 | null | null |
SimSaladin/haikubot | Tavutus.hs | bsd-3-clause | sana :: Parser Sana
sana = concat <$> sequence
[ pure <$> tavuFirst
, (concat <$>) . many . try $ sequence [tavuNth, tavuFirst]
, many tavuNth ] | 168 | sana :: Parser Sana
sana = concat <$> sequence
[ pure <$> tavuFirst
, (concat <$>) . many . try $ sequence [tavuNth, tavuFirst]
, many tavuNth ] | 168 | sana = concat <$> sequence
[ pure <$> tavuFirst
, (concat <$>) . many . try $ sequence [tavuNth, tavuFirst]
, many tavuNth ] | 148 | false | true | 2 | 10 | 51 | 69 | 34 | 35 | null | null |
ribag/ganeti-experiments | src/Ganeti/Query/Node.hs | gpl-2.0 | nodeLiveFieldExtract "cnodes" res =
jsonHead (rpcResNodeInfoHvInfo res) hvInfoCpuNodes | 88 | nodeLiveFieldExtract "cnodes" res =
jsonHead (rpcResNodeInfoHvInfo res) hvInfoCpuNodes | 88 | nodeLiveFieldExtract "cnodes" res =
jsonHead (rpcResNodeInfoHvInfo res) hvInfoCpuNodes | 88 | false | false | 0 | 7 | 9 | 22 | 10 | 12 | null | null |
rootzlevel/hledger-add | src/Model.hs | bsd-3-clause | context _ _ _ _ (FinalQuestion _ _) = return [] | 48 | context _ _ _ _ (FinalQuestion _ _) = return [] | 48 | context _ _ _ _ (FinalQuestion _ _) = return [] | 48 | false | false | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
yoo-e/yesod-helpers | Yesod/Helpers/Form.hs | bsd-3-clause | encodedListTextareaField :: ( Monad m
, RenderMessage (HandlerSite m) msg
, RenderMessage (HandlerSite m) FormMessage
)
=> (Parsec Text () b, Text) -- ^ separator: parser and its 'standard' representation
-> (Parsec Text () a, a -> Text)
-- ^ parse a single value and render a single value
-> (String -> msg) -- ^ a function to generate a error message
-> Field m [a]
-- {{{1
encodedListTextareaField (p_sep, sep) (p, render) mk_msg =
checkMMap f (Textarea . T.intercalate sep . map render) textareaField
where
f t = case parse (manySepEndBy p_sep p <* eof) "" (unTextarea t) of
Left err -> return $ Left $ mk_msg $ show err
Right x -> return $ Right x
-- }}}1
-- | parse every line in textarea, each nonempty line parsed as a single value | 1,032 | encodedListTextareaField :: ( Monad m
, RenderMessage (HandlerSite m) msg
, RenderMessage (HandlerSite m) FormMessage
)
=> (Parsec Text () b, Text) -- ^ separator: parser and its 'standard' representation
-> (Parsec Text () a, a -> Text)
-- ^ parse a single value and render a single value
-> (String -> msg) -- ^ a function to generate a error message
-> Field m [a]
encodedListTextareaField (p_sep, sep) (p, render) mk_msg =
checkMMap f (Textarea . T.intercalate sep . map render) textareaField
where
f t = case parse (manySepEndBy p_sep p <* eof) "" (unTextarea t) of
Left err -> return $ Left $ mk_msg $ show err
Right x -> return $ Right x
-- }}}1
-- | parse every line in textarea, each nonempty line parsed as a single value | 1,024 | encodedListTextareaField (p_sep, sep) (p, render) mk_msg =
checkMMap f (Textarea . T.intercalate sep . map render) textareaField
where
f t = case parse (manySepEndBy p_sep p <* eof) "" (unTextarea t) of
Left err -> return $ Left $ mk_msg $ show err
Right x -> return $ Right x
-- }}}1
-- | parse every line in textarea, each nonempty line parsed as a single value | 413 | true | true | 1 | 11 | 427 | 249 | 124 | 125 | null | null |
tonyday567/web-play | src/Web/Play/Css.hs | mit | cssPlay :: Css
cssPlay = ".play" ? do
fontSize (px 10)
fontFamily ["Arial", "Helvetica"] [sansSerif]
marginLeft (px 30)
marginTop (px 12)
marginBottom (px 12)
"#spinner" ?
marginLeft (px 6)
".btn" ?
marginLeft (px 6)
"#buttons" ? do
marginTop (px 2)
marginBottom (px 6)
"#btnGo.on" ?
color green
"#btnStop.on" ?
color red
".slider" ? do
float floatLeft
width (px 100)
".box" ? do
width (px 40)
textAlign end
".label" ? do
position relative
float floatLeft
marginRight (px 20)
width (px 100)
".ctrl" ? do
marginTop (px 8)
marginBottom (px 8)
"#paramSpeed" ? do
width (px 60)
height (px 6)
"#textSpeed" ?
width (px 30)
"#textFrame" ? do
width (px 30)
marginLeft (px 6)
marginRight (px 6)
"#textTotalFrame" ? do
width (px 30)
marginLeft (px 6)
"input" ? do
backgroundColor transparent
border solid (px 0) wheat
-- width (100::Size Rel)
"#sliders, #framecount" ?
float floatLeft | 1,082 | cssPlay :: Css
cssPlay = ".play" ? do
fontSize (px 10)
fontFamily ["Arial", "Helvetica"] [sansSerif]
marginLeft (px 30)
marginTop (px 12)
marginBottom (px 12)
"#spinner" ?
marginLeft (px 6)
".btn" ?
marginLeft (px 6)
"#buttons" ? do
marginTop (px 2)
marginBottom (px 6)
"#btnGo.on" ?
color green
"#btnStop.on" ?
color red
".slider" ? do
float floatLeft
width (px 100)
".box" ? do
width (px 40)
textAlign end
".label" ? do
position relative
float floatLeft
marginRight (px 20)
width (px 100)
".ctrl" ? do
marginTop (px 8)
marginBottom (px 8)
"#paramSpeed" ? do
width (px 60)
height (px 6)
"#textSpeed" ?
width (px 30)
"#textFrame" ? do
width (px 30)
marginLeft (px 6)
marginRight (px 6)
"#textTotalFrame" ? do
width (px 30)
marginLeft (px 6)
"input" ? do
backgroundColor transparent
border solid (px 0) wheat
-- width (100::Size Rel)
"#sliders, #framecount" ?
float floatLeft | 1,082 | cssPlay = ".play" ? do
fontSize (px 10)
fontFamily ["Arial", "Helvetica"] [sansSerif]
marginLeft (px 30)
marginTop (px 12)
marginBottom (px 12)
"#spinner" ?
marginLeft (px 6)
".btn" ?
marginLeft (px 6)
"#buttons" ? do
marginTop (px 2)
marginBottom (px 6)
"#btnGo.on" ?
color green
"#btnStop.on" ?
color red
".slider" ? do
float floatLeft
width (px 100)
".box" ? do
width (px 40)
textAlign end
".label" ? do
position relative
float floatLeft
marginRight (px 20)
width (px 100)
".ctrl" ? do
marginTop (px 8)
marginBottom (px 8)
"#paramSpeed" ? do
width (px 60)
height (px 6)
"#textSpeed" ?
width (px 30)
"#textFrame" ? do
width (px 30)
marginLeft (px 6)
marginRight (px 6)
"#textTotalFrame" ? do
width (px 30)
marginLeft (px 6)
"input" ? do
backgroundColor transparent
border solid (px 0) wheat
-- width (100::Size Rel)
"#sliders, #framecount" ?
float floatLeft | 1,067 | false | true | 0 | 14 | 350 | 455 | 191 | 264 | null | null |
akhileshs/stack | src/Stack/Constants.hs | bsd-3-clause | hpcDirFromDir
:: (MonadThrow m, MonadReader env m, HasPlatform env, HasEnvConfig env)
=> Path Abs Dir -- ^ Package directory.
-> m (Path Abs Dir)
hpcDirFromDir fp =
liftM (fp </>) hpcRelativeDir | 211 | hpcDirFromDir
:: (MonadThrow m, MonadReader env m, HasPlatform env, HasEnvConfig env)
=> Path Abs Dir -- ^ Package directory.
-> m (Path Abs Dir)
hpcDirFromDir fp =
liftM (fp </>) hpcRelativeDir | 211 | hpcDirFromDir fp =
liftM (fp </>) hpcRelativeDir | 52 | false | true | 0 | 10 | 47 | 77 | 38 | 39 | null | null |
sgillespie/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | isFunLike :: RuleMatchInfo -> Bool
isFunLike FunLike = True | 59 | isFunLike :: RuleMatchInfo -> Bool
isFunLike FunLike = True | 59 | isFunLike FunLike = True | 24 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
ademinn/JavaWithClasses | src/Analyzer.hs | bsd-3-clause | findField :: (WithProgram s, MonadState s m) => ObjectType -> String -> m (Either String (Type, Int))
findField typeName fieldName = do
cls <- findClass typeName
return $ cls >>= \cls' -> do
let mfl = List.find (\f -> varName f == fieldName) $ classFields cls'
case mfl of
Just fl -> Right (varType fl, fromJust . List.elemIndex fl $ classFields cls')
Nothing -> Left $ "class " ++ typeName ++ " has no field " ++ fieldName | 471 | findField :: (WithProgram s, MonadState s m) => ObjectType -> String -> m (Either String (Type, Int))
findField typeName fieldName = do
cls <- findClass typeName
return $ cls >>= \cls' -> do
let mfl = List.find (\f -> varName f == fieldName) $ classFields cls'
case mfl of
Just fl -> Right (varType fl, fromJust . List.elemIndex fl $ classFields cls')
Nothing -> Left $ "class " ++ typeName ++ " has no field " ++ fieldName | 471 | findField typeName fieldName = do
cls <- findClass typeName
return $ cls >>= \cls' -> do
let mfl = List.find (\f -> varName f == fieldName) $ classFields cls'
case mfl of
Just fl -> Right (varType fl, fromJust . List.elemIndex fl $ classFields cls')
Nothing -> Left $ "class " ++ typeName ++ " has no field " ++ fieldName | 369 | false | true | 0 | 19 | 125 | 186 | 90 | 96 | null | null |
ThoughtLeadr/TLDR-Client-Haskell | Network/TLDR/Client.hs | bsd-3-clause | getAd :: Client -> String -> IO (Either String Ad)
getAd client adID = do
timestamp <- fmap truncate getPOSIXTime
let uri = buildURI client adID timestamp
let auth = BSC.unpack $ Base16.encode $ hmac SHA256.hash 64
(privateKey client) (BSC.pack (uriPath uri ++ uriQuery uri))
let headers = [mkHeader HdrAuthorization auth]
r <- tryHTTPRequest $ Request {rqURI = uri, rqMethod = GET, rqHeaders =
headers, rqBody = BLC.empty}
return $ case r of
Left err -> Left err
Right resp -> case rspCode resp of
(2, 0, 0) -> case Aeson.decode $ rspBody resp of
Just ad -> Right ad
Nothing -> Left "JSON response could not be decoded"
(4, 0, 1) -> Left "Not authorized"
(4, 0, 4) -> Left "Ad not found"
_ -> Left "Unknown server response" | 864 | getAd :: Client -> String -> IO (Either String Ad)
getAd client adID = do
timestamp <- fmap truncate getPOSIXTime
let uri = buildURI client adID timestamp
let auth = BSC.unpack $ Base16.encode $ hmac SHA256.hash 64
(privateKey client) (BSC.pack (uriPath uri ++ uriQuery uri))
let headers = [mkHeader HdrAuthorization auth]
r <- tryHTTPRequest $ Request {rqURI = uri, rqMethod = GET, rqHeaders =
headers, rqBody = BLC.empty}
return $ case r of
Left err -> Left err
Right resp -> case rspCode resp of
(2, 0, 0) -> case Aeson.decode $ rspBody resp of
Just ad -> Right ad
Nothing -> Left "JSON response could not be decoded"
(4, 0, 1) -> Left "Not authorized"
(4, 0, 4) -> Left "Ad not found"
_ -> Left "Unknown server response" | 864 | getAd client adID = do
timestamp <- fmap truncate getPOSIXTime
let uri = buildURI client adID timestamp
let auth = BSC.unpack $ Base16.encode $ hmac SHA256.hash 64
(privateKey client) (BSC.pack (uriPath uri ++ uriQuery uri))
let headers = [mkHeader HdrAuthorization auth]
r <- tryHTTPRequest $ Request {rqURI = uri, rqMethod = GET, rqHeaders =
headers, rqBody = BLC.empty}
return $ case r of
Left err -> Left err
Right resp -> case rspCode resp of
(2, 0, 0) -> case Aeson.decode $ rspBody resp of
Just ad -> Right ad
Nothing -> Left "JSON response could not be decoded"
(4, 0, 1) -> Left "Not authorized"
(4, 0, 4) -> Left "Ad not found"
_ -> Left "Unknown server response" | 813 | false | true | 0 | 18 | 269 | 316 | 154 | 162 | null | null |
thoferon/cric | src/Cric/TypeDefs.hs | mit | traceLogger lvl msg = debugLogger lvl msg | 43 | traceLogger lvl msg = debugLogger lvl msg | 43 | traceLogger lvl msg = debugLogger lvl msg | 43 | false | false | 0 | 5 | 8 | 16 | 7 | 9 | null | null |
urbanslug/ghc | compiler/parser/ApiAnnotation.hs | bsd-3-clause | getAnnotationComments :: ApiAnns -> SrcSpan -> [Located AnnotationComment]
getAnnotationComments (_,anns) span =
case Map.lookup span anns of
Just cs -> cs
Nothing -> []
-- |Retrieve the comments allocated to the current 'SrcSpan', and
-- remove them from the annotations | 282 | getAnnotationComments :: ApiAnns -> SrcSpan -> [Located AnnotationComment]
getAnnotationComments (_,anns) span =
case Map.lookup span anns of
Just cs -> cs
Nothing -> []
-- |Retrieve the comments allocated to the current 'SrcSpan', and
-- remove them from the annotations | 282 | getAnnotationComments (_,anns) span =
case Map.lookup span anns of
Just cs -> cs
Nothing -> []
-- |Retrieve the comments allocated to the current 'SrcSpan', and
-- remove them from the annotations | 207 | false | true | 0 | 8 | 50 | 66 | 34 | 32 | null | null |
bitemyapp/persistent | persistent-mongoDB/Database/Persist/MongoDB.hs | mit | andDollar = "$and" | 18 | andDollar = "$and" | 18 | andDollar = "$and" | 18 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
phischu/fragnix | builtins/ghc-prim/GHC.Prim.hs | bsd-3-clause | double2Float# :: Double# -> Float#
double2Float# = double2Float# | 64 | double2Float# :: Double# -> Float#
double2Float# = double2Float# | 64 | double2Float# = double2Float# | 29 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
urv/fixhs | src/Data/FIX/Spec/FIX43.hs | lgpl-2.1 | tMassCancelResponse :: FIXTag
tMassCancelResponse = FIXTag
{ tName = "MassCancelResponse"
, tnum = 531
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 183 | tMassCancelResponse :: FIXTag
tMassCancelResponse = FIXTag
{ tName = "MassCancelResponse"
, tnum = 531
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 183 | tMassCancelResponse = FIXTag
{ tName = "MassCancelResponse"
, tnum = 531
, tparser = toFIXChar
, arbitraryValue = FIXChar <$> (return 'A') } | 153 | false | true | 0 | 10 | 38 | 51 | 29 | 22 | null | null |
patrickboe/artery | Box.hs | mit | area (Box (Point x1 y1) (Point x2 y2)) = (x2 - x1) * (y2 - y1) | 62 | area (Box (Point x1 y1) (Point x2 y2)) = (x2 - x1) * (y2 - y1) | 62 | area (Box (Point x1 y1) (Point x2 y2)) = (x2 - x1) * (y2 - y1) | 62 | false | false | 0 | 9 | 15 | 51 | 26 | 25 | null | null |
ksaveljev/hake-2 | src/Game/Monsters/MGladiator.hs | bsd-3-clause | gladiatorFramesStand :: V.Vector MFrameT
gladiatorFramesStand =
V.fromList [ MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
] | 479 | gladiatorFramesStand :: V.Vector MFrameT
gladiatorFramesStand =
V.fromList [ MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
] | 479 | gladiatorFramesStand =
V.fromList [ MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
, MFrameT (Just GameAI.aiStand) 0 Nothing
] | 438 | false | true | 0 | 10 | 158 | 153 | 74 | 79 | null | null |
bitemyapp/ganeti | src/Ganeti/HTools/Program/Hcheck.hs | bsd-2-clause | -- | Print all the statistics on a group level.
printGroupStats :: Options -> Bool -> Phase -> GroupStats -> IO ()
printGroupStats opts machineread phase ((grp, score), stats) = do
let values = prepareGroupValues stats score
extradata = extractGroupData machineread grp
printStats opts machineread (GroupLvl extradata) phase values
-- | Print all the statistics on a cluster (global) level. | 401 | printGroupStats :: Options -> Bool -> Phase -> GroupStats -> IO ()
printGroupStats opts machineread phase ((grp, score), stats) = do
let values = prepareGroupValues stats score
extradata = extractGroupData machineread grp
printStats opts machineread (GroupLvl extradata) phase values
-- | Print all the statistics on a cluster (global) level. | 353 | printGroupStats opts machineread phase ((grp, score), stats) = do
let values = prepareGroupValues stats score
extradata = extractGroupData machineread grp
printStats opts machineread (GroupLvl extradata) phase values
-- | Print all the statistics on a cluster (global) level. | 286 | true | true | 0 | 10 | 70 | 99 | 50 | 49 | null | null |
mrakgr/futhark | src/Futhark/CodeGen/Backends/SimpleRepresentation.hs | bsd-3-clause | sameRepresentation' (Mem _ space1) (Mem _ space2) = space1 == space2 | 68 | sameRepresentation' (Mem _ space1) (Mem _ space2) = space1 == space2 | 68 | sameRepresentation' (Mem _ space1) (Mem _ space2) = space1 == space2 | 68 | false | false | 0 | 7 | 10 | 35 | 16 | 19 | null | null |
philipcraig/hutton | src/Exercises/ChapterOneToFive.hs | bsd-3-clause | _ch2_ex3 :: Int
_ch2_ex3 = a `div` length xs
where
a = 10
xs = [1, 2, 3, 4, 5] :: [Int] | 97 | _ch2_ex3 :: Int
_ch2_ex3 = a `div` length xs
where
a = 10
xs = [1, 2, 3, 4, 5] :: [Int] | 97 | _ch2_ex3 = a `div` length xs
where
a = 10
xs = [1, 2, 3, 4, 5] :: [Int] | 81 | false | true | 0 | 6 | 31 | 54 | 32 | 22 | null | null |
mcschroeder/ghc | compiler/prelude/TysPrim.hs | bsd-3-clause | int64PrimTyCon :: TyCon
int64PrimTyCon = pcPrimTyCon0 int64PrimTyConName Int64Rep | 82 | int64PrimTyCon :: TyCon
int64PrimTyCon = pcPrimTyCon0 int64PrimTyConName Int64Rep | 82 | int64PrimTyCon = pcPrimTyCon0 int64PrimTyConName Int64Rep | 58 | false | true | 0 | 5 | 8 | 16 | 8 | 8 | null | null |
rueshyna/gogol | gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs | mpl-2.0 | -- | URL of this landing page. This is a required field.
lpURL :: Lens' LandingPage (Maybe Text)
lpURL = lens _lpURL (\ s a -> s{_lpURL = a}) | 141 | lpURL :: Lens' LandingPage (Maybe Text)
lpURL = lens _lpURL (\ s a -> s{_lpURL = a}) | 84 | lpURL = lens _lpURL (\ s a -> s{_lpURL = a}) | 44 | true | true | 1 | 9 | 28 | 51 | 25 | 26 | null | null |
diagrams/potrace-diagrams | examples/colours.hs | gpl-2.0 | fromColourImage :: (Colour Double -> Bool) -> Image PixelRGBA8 -> Bitmap
fromColourImage f img@(Image w h _) =
generate w h $ \i j -> f . rgb8ToColour $ pixelAt img i (h - j - 1) | 180 | fromColourImage :: (Colour Double -> Bool) -> Image PixelRGBA8 -> Bitmap
fromColourImage f img@(Image w h _) =
generate w h $ \i j -> f . rgb8ToColour $ pixelAt img i (h - j - 1) | 180 | fromColourImage f img@(Image w h _) =
generate w h $ \i j -> f . rgb8ToColour $ pixelAt img i (h - j - 1) | 107 | false | true | 0 | 11 | 38 | 92 | 46 | 46 | null | null |
gallais/typing-with-leftovers | src/linear/Surface/Parser.hs | gpl-3.0 | pRCut :: Parser RInfer
pRCut = Cut <$> (string "(" *> betweenSpace pRCheck)
<*> (string ":" *> betweenSpace pRType <* string ")") | 141 | pRCut :: Parser RInfer
pRCut = Cut <$> (string "(" *> betweenSpace pRCheck)
<*> (string ":" *> betweenSpace pRType <* string ")") | 141 | pRCut = Cut <$> (string "(" *> betweenSpace pRCheck)
<*> (string ":" *> betweenSpace pRType <* string ")") | 118 | false | true | 5 | 9 | 33 | 65 | 29 | 36 | null | null |
freizl/freizl.github.com-old | tests/Hakyll/Core/Rules/Tests.hs | bsd-3-clause | rules01 :: IORef Bool -> Rules ()
rules01 ioref = do
-- Compile some posts
match "*.md" $ do
route $ setExtension "html"
compile pandocCompiler
-- Yeah. I don't know how else to test this stuff?
preprocess $ writeIORef ioref True
-- Compile them, raw
match "*.md" $ version "raw" $ do
route idRoute
compile getResourceString
-- Regression test
version "nav" $ match (fromList ["example.md"]) $ do
route idRoute
compile copyFileCompiler
-- Another edge case: different versions in one match
match "*.md" $ do
version "mv1" $ do
route $ setExtension "mv1"
compile getResourceString
version "mv2" $ do
route $ setExtension "mv2"
compile getResourceString | 807 | rules01 :: IORef Bool -> Rules ()
rules01 ioref = do
-- Compile some posts
match "*.md" $ do
route $ setExtension "html"
compile pandocCompiler
-- Yeah. I don't know how else to test this stuff?
preprocess $ writeIORef ioref True
-- Compile them, raw
match "*.md" $ version "raw" $ do
route idRoute
compile getResourceString
-- Regression test
version "nav" $ match (fromList ["example.md"]) $ do
route idRoute
compile copyFileCompiler
-- Another edge case: different versions in one match
match "*.md" $ do
version "mv1" $ do
route $ setExtension "mv1"
compile getResourceString
version "mv2" $ do
route $ setExtension "mv2"
compile getResourceString | 807 | rules01 ioref = do
-- Compile some posts
match "*.md" $ do
route $ setExtension "html"
compile pandocCompiler
-- Yeah. I don't know how else to test this stuff?
preprocess $ writeIORef ioref True
-- Compile them, raw
match "*.md" $ version "raw" $ do
route idRoute
compile getResourceString
-- Regression test
version "nav" $ match (fromList ["example.md"]) $ do
route idRoute
compile copyFileCompiler
-- Another edge case: different versions in one match
match "*.md" $ do
version "mv1" $ do
route $ setExtension "mv1"
compile getResourceString
version "mv2" $ do
route $ setExtension "mv2"
compile getResourceString | 773 | false | true | 0 | 14 | 259 | 198 | 83 | 115 | null | null |
rueshyna/gogol | gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/ContentCategories/List.hs | mpl-2.0 | -- | Creates a value of 'ContentCategoriesList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cclSearchString'
--
-- * 'cclIds'
--
-- * 'cclProFileId'
--
-- * 'cclSortOrder'
--
-- * 'cclPageToken'
--
-- * 'cclSortField'
--
-- * 'cclMaxResults'
contentCategoriesList
:: Int64 -- ^ 'cclProFileId'
-> ContentCategoriesList
contentCategoriesList pCclProFileId_ =
ContentCategoriesList'
{ _cclSearchString = Nothing
, _cclIds = Nothing
, _cclProFileId = _Coerce # pCclProFileId_
, _cclSortOrder = Nothing
, _cclPageToken = Nothing
, _cclSortField = Nothing
, _cclMaxResults = Nothing
} | 712 | contentCategoriesList
:: Int64 -- ^ 'cclProFileId'
-> ContentCategoriesList
contentCategoriesList pCclProFileId_ =
ContentCategoriesList'
{ _cclSearchString = Nothing
, _cclIds = Nothing
, _cclProFileId = _Coerce # pCclProFileId_
, _cclSortOrder = Nothing
, _cclPageToken = Nothing
, _cclSortField = Nothing
, _cclMaxResults = Nothing
} | 380 | contentCategoriesList pCclProFileId_ =
ContentCategoriesList'
{ _cclSearchString = Nothing
, _cclIds = Nothing
, _cclProFileId = _Coerce # pCclProFileId_
, _cclSortOrder = Nothing
, _cclPageToken = Nothing
, _cclSortField = Nothing
, _cclMaxResults = Nothing
} | 296 | true | true | 0 | 8 | 144 | 93 | 60 | 33 | null | null |
kindohm/tidal-midi-rack | Sound/Tidal/MIDI/Kindohm/CustomParams.hs | gpl-3.0 | (egint, egint_p) = pF "egint" (Just 0.5) | 40 | (egint, egint_p) = pF "egint" (Just 0.5) | 40 | (egint, egint_p) = pF "egint" (Just 0.5) | 40 | false | false | 0 | 7 | 6 | 24 | 12 | 12 | null | null |
kosmikus/cabal | cabal-install/Distribution/Client/Setup.hs | bsd-3-clause | defaultListFlags :: ListFlags
defaultListFlags = ListFlags {
listInstalled = Flag False,
listSimpleOutput = Flag False,
listVerbosity = toFlag normal,
listPackageDBs = []
} | 198 | defaultListFlags :: ListFlags
defaultListFlags = ListFlags {
listInstalled = Flag False,
listSimpleOutput = Flag False,
listVerbosity = toFlag normal,
listPackageDBs = []
} | 198 | defaultListFlags = ListFlags {
listInstalled = Flag False,
listSimpleOutput = Flag False,
listVerbosity = toFlag normal,
listPackageDBs = []
} | 168 | false | true | 0 | 7 | 48 | 48 | 27 | 21 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpInfo Int64SrlOp =
mkGenPrimOp (fsLit "uncheckedIShiftRL64#") [] [int64PrimTy, intPrimTy] int64PrimTy | 117 | primOpInfo Int64SrlOp =
mkGenPrimOp (fsLit "uncheckedIShiftRL64#") [] [int64PrimTy, intPrimTy] int64PrimTy | 117 | primOpInfo Int64SrlOp =
mkGenPrimOp (fsLit "uncheckedIShiftRL64#") [] [int64PrimTy, intPrimTy] int64PrimTy | 117 | false | false | 0 | 7 | 20 | 32 | 16 | 16 | null | null |
gergoerdi/brainfuck | language-registermachine/src/Language/RegisterMachine/Parser.hs | bsd-3-clause | arg = try int <|> sym
where int = lexeme $ do
s <- optionMaybe $ char '-'
ds <- many1 digit
let n = read ds :: Int
n' = case s of
Nothing -> n
Just _ -> -n
return $ Int n'
sym = liftM Symbol symbol | 304 | arg = try int <|> sym
where int = lexeme $ do
s <- optionMaybe $ char '-'
ds <- many1 digit
let n = read ds :: Int
n' = case s of
Nothing -> n
Just _ -> -n
return $ Int n'
sym = liftM Symbol symbol | 304 | arg = try int <|> sym
where int = lexeme $ do
s <- optionMaybe $ char '-'
ds <- many1 digit
let n = read ds :: Int
n' = case s of
Nothing -> n
Just _ -> -n
return $ Int n'
sym = liftM Symbol symbol | 304 | false | false | 5 | 15 | 156 | 122 | 53 | 69 | null | null |
piyush-kurur/yesod | yesod/Build.hs | mit | determineDeps :: FilePath -> IO [(ComparisonType, FilePath)]
determineDeps x = do
y <- TIO.readFile x -- FIXME catch IO exceptions
let z = A.parse (many $ (parser <|> (A.anyChar >> return Nothing))) y
case z of
A.Fail{} -> return []
A.Done _ r -> mapM go r >>= filterM (doesFileExist . snd) . concat
where
go (Just (StaticFiles fp, _)) = map ((,) AlwaysOutdated) <$> getFolderContents fp
go (Just (Hamlet, f)) = return [(AlwaysOutdated, f)]
go (Just (Widget, f)) = return
[ (AlwaysOutdated, "templates/" ++ f ++ ".hamlet")
, (CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, "templates/" ++ f ++ ".julius")
, (CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, "templates/" ++ f ++ ".lucius")
, (CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, "templates/" ++ f ++ ".cassius")
]
go (Just (Julius, f)) = return [(CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, f)]
go (Just (Cassius, f)) = return [(CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, f)]
go (Just (Lucius, f)) = return [(CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, f)]
go (Just (Verbatim, f)) = return [(AlwaysOutdated, f)]
go (Just (Messages f, _)) = map ((,) AlwaysOutdated) <$> getFolderContents f
go Nothing = return []
parser = do
ty <- (do _ <- A.string "\nstaticFiles \""
x' <- A.many1 $ A.satisfy (/= '"')
return $ StaticFiles x')
<|> (A.string "$(parseRoutesFile " >> return Verbatim)
<|> (A.string "$(hamletFile " >> return Hamlet)
<|> (A.string "$(ihamletFile " >> return Hamlet)
<|> (A.string "$(whamletFile " >> return Hamlet)
<|> (A.string "$(html " >> return Hamlet)
<|> (A.string "$(widgetFile " >> return Widget)
<|> (A.string "$(Settings.hamletFile " >> return Hamlet)
<|> (A.string "$(Settings.widgetFile " >> return Widget)
<|> (A.string "$(juliusFile " >> return Julius)
<|> (A.string "$(cassiusFile " >> return Cassius)
<|> (A.string "$(luciusFile " >> return Lucius)
<|> (A.string "$(persistFile " >> return Verbatim)
<|> (
A.string "$(persistFileWith " >>
A.many1 (A.satisfy (/= '"')) >>
return Verbatim)
<|> (do
_ <- A.string "\nmkMessage \""
A.skipWhile (/= '"')
_ <- A.string "\" \""
x' <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\" \""
_y <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\""
return $ Messages x')
case ty of
Messages{} -> return $ Just (ty, "")
StaticFiles{} -> return $ Just (ty, "")
_ -> do
A.skipWhile isSpace
_ <- A.char '"'
y <- A.many1 $ A.satisfy (/= '"')
_ <- A.char '"'
A.skipWhile isSpace
_ <- A.char ')'
return $ Just (ty, y)
getFolderContents :: FilePath -> IO [FilePath]
getFolderContents fp = do
cs <- getDirectoryContents fp
let notHidden ('.':_) = False
notHidden ('t':"mp") = False
notHidden ('f':"ay") = False
notHidden _ = True
fmap concat $ forM (filter notHidden cs) $ \c -> do
let f = fp ++ '/' : c
isFile <- doesFileExist f
if isFile then return [f] else getFolderContents f | 3,655 | determineDeps :: FilePath -> IO [(ComparisonType, FilePath)]
determineDeps x = do
y <- TIO.readFile x -- FIXME catch IO exceptions
let z = A.parse (many $ (parser <|> (A.anyChar >> return Nothing))) y
case z of
A.Fail{} -> return []
A.Done _ r -> mapM go r >>= filterM (doesFileExist . snd) . concat
where
go (Just (StaticFiles fp, _)) = map ((,) AlwaysOutdated) <$> getFolderContents fp
go (Just (Hamlet, f)) = return [(AlwaysOutdated, f)]
go (Just (Widget, f)) = return
[ (AlwaysOutdated, "templates/" ++ f ++ ".hamlet")
, (CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, "templates/" ++ f ++ ".julius")
, (CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, "templates/" ++ f ++ ".lucius")
, (CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, "templates/" ++ f ++ ".cassius")
]
go (Just (Julius, f)) = return [(CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, f)]
go (Just (Cassius, f)) = return [(CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, f)]
go (Just (Lucius, f)) = return [(CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, f)]
go (Just (Verbatim, f)) = return [(AlwaysOutdated, f)]
go (Just (Messages f, _)) = map ((,) AlwaysOutdated) <$> getFolderContents f
go Nothing = return []
parser = do
ty <- (do _ <- A.string "\nstaticFiles \""
x' <- A.many1 $ A.satisfy (/= '"')
return $ StaticFiles x')
<|> (A.string "$(parseRoutesFile " >> return Verbatim)
<|> (A.string "$(hamletFile " >> return Hamlet)
<|> (A.string "$(ihamletFile " >> return Hamlet)
<|> (A.string "$(whamletFile " >> return Hamlet)
<|> (A.string "$(html " >> return Hamlet)
<|> (A.string "$(widgetFile " >> return Widget)
<|> (A.string "$(Settings.hamletFile " >> return Hamlet)
<|> (A.string "$(Settings.widgetFile " >> return Widget)
<|> (A.string "$(juliusFile " >> return Julius)
<|> (A.string "$(cassiusFile " >> return Cassius)
<|> (A.string "$(luciusFile " >> return Lucius)
<|> (A.string "$(persistFile " >> return Verbatim)
<|> (
A.string "$(persistFileWith " >>
A.many1 (A.satisfy (/= '"')) >>
return Verbatim)
<|> (do
_ <- A.string "\nmkMessage \""
A.skipWhile (/= '"')
_ <- A.string "\" \""
x' <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\" \""
_y <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\""
return $ Messages x')
case ty of
Messages{} -> return $ Just (ty, "")
StaticFiles{} -> return $ Just (ty, "")
_ -> do
A.skipWhile isSpace
_ <- A.char '"'
y <- A.many1 $ A.satisfy (/= '"')
_ <- A.char '"'
A.skipWhile isSpace
_ <- A.char ')'
return $ Just (ty, y)
getFolderContents :: FilePath -> IO [FilePath]
getFolderContents fp = do
cs <- getDirectoryContents fp
let notHidden ('.':_) = False
notHidden ('t':"mp") = False
notHidden ('f':"ay") = False
notHidden _ = True
fmap concat $ forM (filter notHidden cs) $ \c -> do
let f = fp ++ '/' : c
isFile <- doesFileExist f
if isFile then return [f] else getFolderContents f | 3,655 | determineDeps x = do
y <- TIO.readFile x -- FIXME catch IO exceptions
let z = A.parse (many $ (parser <|> (A.anyChar >> return Nothing))) y
case z of
A.Fail{} -> return []
A.Done _ r -> mapM go r >>= filterM (doesFileExist . snd) . concat
where
go (Just (StaticFiles fp, _)) = map ((,) AlwaysOutdated) <$> getFolderContents fp
go (Just (Hamlet, f)) = return [(AlwaysOutdated, f)]
go (Just (Widget, f)) = return
[ (AlwaysOutdated, "templates/" ++ f ++ ".hamlet")
, (CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, "templates/" ++ f ++ ".julius")
, (CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, "templates/" ++ f ++ ".lucius")
, (CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, "templates/" ++ f ++ ".cassius")
]
go (Just (Julius, f)) = return [(CompareUsedIdentifiers $ map fst . juliusUsedIdentifiers, f)]
go (Just (Cassius, f)) = return [(CompareUsedIdentifiers $ map fst . cassiusUsedIdentifiers, f)]
go (Just (Lucius, f)) = return [(CompareUsedIdentifiers $ map fst . luciusUsedIdentifiers, f)]
go (Just (Verbatim, f)) = return [(AlwaysOutdated, f)]
go (Just (Messages f, _)) = map ((,) AlwaysOutdated) <$> getFolderContents f
go Nothing = return []
parser = do
ty <- (do _ <- A.string "\nstaticFiles \""
x' <- A.many1 $ A.satisfy (/= '"')
return $ StaticFiles x')
<|> (A.string "$(parseRoutesFile " >> return Verbatim)
<|> (A.string "$(hamletFile " >> return Hamlet)
<|> (A.string "$(ihamletFile " >> return Hamlet)
<|> (A.string "$(whamletFile " >> return Hamlet)
<|> (A.string "$(html " >> return Hamlet)
<|> (A.string "$(widgetFile " >> return Widget)
<|> (A.string "$(Settings.hamletFile " >> return Hamlet)
<|> (A.string "$(Settings.widgetFile " >> return Widget)
<|> (A.string "$(juliusFile " >> return Julius)
<|> (A.string "$(cassiusFile " >> return Cassius)
<|> (A.string "$(luciusFile " >> return Lucius)
<|> (A.string "$(persistFile " >> return Verbatim)
<|> (
A.string "$(persistFileWith " >>
A.many1 (A.satisfy (/= '"')) >>
return Verbatim)
<|> (do
_ <- A.string "\nmkMessage \""
A.skipWhile (/= '"')
_ <- A.string "\" \""
x' <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\" \""
_y <- A.many1 $ A.satisfy (/= '"')
_ <- A.string "\""
return $ Messages x')
case ty of
Messages{} -> return $ Just (ty, "")
StaticFiles{} -> return $ Just (ty, "")
_ -> do
A.skipWhile isSpace
_ <- A.char '"'
y <- A.many1 $ A.satisfy (/= '"')
_ <- A.char '"'
A.skipWhile isSpace
_ <- A.char ')'
return $ Just (ty, y)
getFolderContents :: FilePath -> IO [FilePath]
getFolderContents fp = do
cs <- getDirectoryContents fp
let notHidden ('.':_) = False
notHidden ('t':"mp") = False
notHidden ('f':"ay") = False
notHidden _ = True
fmap concat $ forM (filter notHidden cs) $ \c -> do
let f = fp ++ '/' : c
isFile <- doesFileExist f
if isFile then return [f] else getFolderContents f | 3,594 | false | true | 28 | 30 | 1,246 | 1,302 | 655 | 647 | null | null |
frp-arduino/frp-arduino | src/Arduino/Nano.hs | gpl-3.0 | analogRead :: AnalogInput -> Stream Word
analogRead an = createInput
(analogName an)
(setBit "ADCSRA" "ADEN" $
setBit "ADMUX" "REFS0" $
setBit "ADCSRA" "ADPS2" $
setBit "ADCSRA" "ADPS1" $
setBit "ADCSRA" "ADPS0" $
end)
((if (testBit (mux an) 3) then setBit else clearBit) "ADMUX" "MUX3" $
(if (testBit (mux an) 2) then setBit else clearBit) "ADMUX" "MUX2" $
(if (testBit (mux an) 1) then setBit else clearBit) "ADMUX" "MUX1" $
(if (testBit (mux an) 0) then setBit else clearBit) "ADMUX" "MUX0" $
setBit "ADCSRA" "ADSC" $
waitBitCleared "ADCSRA" "ADSC" $
readTwoPartWord "ADCL" "ADCH" $
end) | 662 | analogRead :: AnalogInput -> Stream Word
analogRead an = createInput
(analogName an)
(setBit "ADCSRA" "ADEN" $
setBit "ADMUX" "REFS0" $
setBit "ADCSRA" "ADPS2" $
setBit "ADCSRA" "ADPS1" $
setBit "ADCSRA" "ADPS0" $
end)
((if (testBit (mux an) 3) then setBit else clearBit) "ADMUX" "MUX3" $
(if (testBit (mux an) 2) then setBit else clearBit) "ADMUX" "MUX2" $
(if (testBit (mux an) 1) then setBit else clearBit) "ADMUX" "MUX1" $
(if (testBit (mux an) 0) then setBit else clearBit) "ADMUX" "MUX0" $
setBit "ADCSRA" "ADSC" $
waitBitCleared "ADCSRA" "ADSC" $
readTwoPartWord "ADCL" "ADCH" $
end) | 662 | analogRead an = createInput
(analogName an)
(setBit "ADCSRA" "ADEN" $
setBit "ADMUX" "REFS0" $
setBit "ADCSRA" "ADPS2" $
setBit "ADCSRA" "ADPS1" $
setBit "ADCSRA" "ADPS0" $
end)
((if (testBit (mux an) 3) then setBit else clearBit) "ADMUX" "MUX3" $
(if (testBit (mux an) 2) then setBit else clearBit) "ADMUX" "MUX2" $
(if (testBit (mux an) 1) then setBit else clearBit) "ADMUX" "MUX1" $
(if (testBit (mux an) 0) then setBit else clearBit) "ADMUX" "MUX0" $
setBit "ADCSRA" "ADSC" $
waitBitCleared "ADCSRA" "ADSC" $
readTwoPartWord "ADCL" "ADCH" $
end) | 621 | false | true | 0 | 20 | 165 | 255 | 125 | 130 | null | null |
harendra-kumar/asyncly | src/Streamly/Internal/Data/Unfold.hs | bsd-3-clause | enumerateFromToIntegral :: (Monad m, Integral a) => a -> Unfold m a a
enumerateFromToIntegral to =
takeWhile (<= to) $ supplySecond enumerateFromStepIntegral 1 | 163 | enumerateFromToIntegral :: (Monad m, Integral a) => a -> Unfold m a a
enumerateFromToIntegral to =
takeWhile (<= to) $ supplySecond enumerateFromStepIntegral 1 | 163 | enumerateFromToIntegral to =
takeWhile (<= to) $ supplySecond enumerateFromStepIntegral 1 | 93 | false | true | 0 | 7 | 26 | 56 | 28 | 28 | null | null |
erikd/yesod | yesod-core/Yesod/Core/Handler.hs | mit | msgKey :: Text
msgKey = "_MSG" | 30 | msgKey :: Text
msgKey = "_MSG" | 30 | msgKey = "_MSG" | 15 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
betaveros/bcodex | Text/Bcodex/Alpha.hs | mit | isVowel :: Char -> Bool
isVowel 'a' = True | 42 | isVowel :: Char -> Bool
isVowel 'a' = True | 42 | isVowel 'a' = True | 18 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
yyotti/99Haskell | src/main/Lists.hs | mit | {-
- 3 Problem 3
- (*) Find the K'th element of a list. The first element in the list is number 1.
-
- Example in Haskell:
- Prelude> elementAt [1,2,3] 2
- 2
- Prelude> elementAt "haskell" 5
- 'e'
-}
elementAt :: [a] -> Int -> a
elementAt [] _ = error "list is empty" | 289 | elementAt :: [a] -> Int -> a
elementAt [] _ = error "list is empty" | 67 | elementAt [] _ = error "list is empty" | 38 | true | true | 0 | 6 | 79 | 33 | 17 | 16 | null | null |
PipocaQuemada/ermine | src/Ermine/Inference/Type.hs | bsd-2-clause | inferType d cxt (Term.Lam ps e) = do
(skss, pts, ppts) <- unzip3 <$> traverse (inferPatternType d) ps
let pcxt (ArgPP i pp)
| Just f <- ppts ^? ix (fromIntegral i) = f pp
pcxt _ = error "panic: bad argument reference in lambda term"
Witness rcs t c <- inferTypeInScope (d+1) pcxt cxt e
let cc = Pattern.compileLambda ps (splitScope c) dummyPatternEnv
skss' <- traverse checkDistinct skss
rt <- checkSkolems (Just d) id (join skss') $ foldr (~~>) t pts
pccs <- traverse conventionForType pts
return $ Witness rcs rt (lambda pccs cc) | 561 | inferType d cxt (Term.Lam ps e) = do
(skss, pts, ppts) <- unzip3 <$> traverse (inferPatternType d) ps
let pcxt (ArgPP i pp)
| Just f <- ppts ^? ix (fromIntegral i) = f pp
pcxt _ = error "panic: bad argument reference in lambda term"
Witness rcs t c <- inferTypeInScope (d+1) pcxt cxt e
let cc = Pattern.compileLambda ps (splitScope c) dummyPatternEnv
skss' <- traverse checkDistinct skss
rt <- checkSkolems (Just d) id (join skss') $ foldr (~~>) t pts
pccs <- traverse conventionForType pts
return $ Witness rcs rt (lambda pccs cc) | 561 | inferType d cxt (Term.Lam ps e) = do
(skss, pts, ppts) <- unzip3 <$> traverse (inferPatternType d) ps
let pcxt (ArgPP i pp)
| Just f <- ppts ^? ix (fromIntegral i) = f pp
pcxt _ = error "panic: bad argument reference in lambda term"
Witness rcs t c <- inferTypeInScope (d+1) pcxt cxt e
let cc = Pattern.compileLambda ps (splitScope c) dummyPatternEnv
skss' <- traverse checkDistinct skss
rt <- checkSkolems (Just d) id (join skss') $ foldr (~~>) t pts
pccs <- traverse conventionForType pts
return $ Witness rcs rt (lambda pccs cc) | 561 | false | false | 0 | 17 | 124 | 253 | 117 | 136 | null | null |
notogawa/haskell-graceful-debian | src/System/Posix/Graceful/Worker.hs | bsd-3-clause | -- | Worker process action
workerProcess :: GracefulWorker -> Socket -> IO ()
workerProcess GracefulWorker { gracefulWorkerInitialize = initialize
, gracefulWorkerApplication = application
, gracefulWorkerFinalize = finalize
} sock = do
void $ installHandler sigQUIT (CatchOnce $ close sock) Nothing
count <- newTVarIO (0 :: Int)
void $ tryIO $ bracket initialize finalize $ \resource ->
void $ forever $ do
(s, _) <- accept sock
let app = application s resource
forkIO $ bracket_
(atomically $ modifyTVar' count succ)
(atomically $ modifyTVar' count pred)
(app `finally` close s)
waitAllAction count
close sock
exitImmediately ExitSuccess
where
waitAllAction count = do
active <- atomically $ readTVar count
when (0 /= active) $ do
threadDelay 1000
waitAllAction count | 989 | workerProcess :: GracefulWorker -> Socket -> IO ()
workerProcess GracefulWorker { gracefulWorkerInitialize = initialize
, gracefulWorkerApplication = application
, gracefulWorkerFinalize = finalize
} sock = do
void $ installHandler sigQUIT (CatchOnce $ close sock) Nothing
count <- newTVarIO (0 :: Int)
void $ tryIO $ bracket initialize finalize $ \resource ->
void $ forever $ do
(s, _) <- accept sock
let app = application s resource
forkIO $ bracket_
(atomically $ modifyTVar' count succ)
(atomically $ modifyTVar' count pred)
(app `finally` close s)
waitAllAction count
close sock
exitImmediately ExitSuccess
where
waitAllAction count = do
active <- atomically $ readTVar count
when (0 /= active) $ do
threadDelay 1000
waitAllAction count | 962 | workerProcess GracefulWorker { gracefulWorkerInitialize = initialize
, gracefulWorkerApplication = application
, gracefulWorkerFinalize = finalize
} sock = do
void $ installHandler sigQUIT (CatchOnce $ close sock) Nothing
count <- newTVarIO (0 :: Int)
void $ tryIO $ bracket initialize finalize $ \resource ->
void $ forever $ do
(s, _) <- accept sock
let app = application s resource
forkIO $ bracket_
(atomically $ modifyTVar' count succ)
(atomically $ modifyTVar' count pred)
(app `finally` close s)
waitAllAction count
close sock
exitImmediately ExitSuccess
where
waitAllAction count = do
active <- atomically $ readTVar count
when (0 /= active) $ do
threadDelay 1000
waitAllAction count | 911 | true | true | 2 | 17 | 335 | 288 | 133 | 155 | null | null |
fibsifan/pandoc | src/Text/Pandoc/Readers/Markdown.hs | gpl-2.0 | isHruleChar :: Char -> Bool
isHruleChar '*' = True | 50 | isHruleChar :: Char -> Bool
isHruleChar '*' = True | 50 | isHruleChar '*' = True | 22 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
nzok/decimal | FixedTest.hs | mit | ssGen :: Gen (Scale R) -- scale
ssGen = choose (0,4) >>= (return . Scale) | 74 | ssGen :: Gen (Scale R)
ssGen = choose (0,4) >>= (return . Scale) | 64 | ssGen = choose (0,4) >>= (return . Scale) | 41 | true | true | 1 | 8 | 15 | 45 | 22 | 23 | null | null |
martinvlk/cabal | Cabal/Distribution/Simple/JHC.hs | bsd-3-clause | jhcLanguages :: [(Language, Flag)]
jhcLanguages = [(Haskell98, "")] | 67 | jhcLanguages :: [(Language, Flag)]
jhcLanguages = [(Haskell98, "")] | 67 | jhcLanguages = [(Haskell98, "")] | 32 | false | true | 0 | 6 | 7 | 29 | 18 | 11 | null | null |
rueshyna/gogol | gogol-compute/gen/Network/Google/Resource/Compute/RegionAutoscalers/Delete.hs | mpl-2.0 | -- | Name of the autoscaler to delete.
radAutoscaler :: Lens' RegionAutoscalersDelete Text
radAutoscaler
= lens _radAutoscaler
(\ s a -> s{_radAutoscaler = a}) | 167 | radAutoscaler :: Lens' RegionAutoscalersDelete Text
radAutoscaler
= lens _radAutoscaler
(\ s a -> s{_radAutoscaler = a}) | 128 | radAutoscaler
= lens _radAutoscaler
(\ s a -> s{_radAutoscaler = a}) | 76 | true | true | 0 | 9 | 31 | 42 | 22 | 20 | null | null |
rootzlevel/hledger-add | src/main/Main.hs | bsd-3-clause | setContext :: AppState -> IO AppState
setContext as = do
ctx <- flip listSimpleReplace (asContext as) . V.fromList <$>
context (asJournal as) (asMatchAlgo as) (asDateFormat as) (editText as) (asStep as)
return as { asContext = ctx } | 245 | setContext :: AppState -> IO AppState
setContext as = do
ctx <- flip listSimpleReplace (asContext as) . V.fromList <$>
context (asJournal as) (asMatchAlgo as) (asDateFormat as) (editText as) (asStep as)
return as { asContext = ctx } | 245 | setContext as = do
ctx <- flip listSimpleReplace (asContext as) . V.fromList <$>
context (asJournal as) (asMatchAlgo as) (asDateFormat as) (editText as) (asStep as)
return as { asContext = ctx } | 207 | false | true | 0 | 12 | 49 | 104 | 50 | 54 | null | null |
acowley/ghc | utils/genprimopcode/Main.hs | bsd-3-clause | ppTyVar "o" = "openAlphaTyVar" | 30 | ppTyVar "o" = "openAlphaTyVar" | 30 | ppTyVar "o" = "openAlphaTyVar" | 30 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
icetortoise/ftphs | src/Network/FTP/Server.hs | lgpl-2.1 | s_crlf = "\r\n" | 15 | s_crlf = "\r\n" | 15 | s_crlf = "\r\n" | 15 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
hamsal/DM-AtariAI | src/ConvolveGPU.hs | mit | conv4D
:: T.Handle
-> T.Handle
-> RU.Array R.D R.DIM4 Float
-> RU.Array R.D R.DIM4 Float
-> Int
-> IO (RU.Array R.D R.DIM4 Float)
conv4D toC fromC !img !fltr !strd = do
-- 1 x imageDepth x imageWidth x imageHeight
let _:(!imgDpth):(!imgWdth):(!imgHght):_ = R.deepSeqArrays [img, fltr]
(reverse $ U.los
$ R.extent img)
-- numFilters x filterDepth x filterWidth x filterHeight
(!numFltrs):(!fltrDpth):(!fltrWdth):_ = reverse $ U.los $ R.extent fltr
!imgList = [R.unsafeSlice img (R.Any R.:. (0 :: Int) R.:. i R.:. R.All
R.:. R.All)
| i <- [0..(imgDpth - 1)]]
!signalVector = V.fromList imgList
!fltrSlcInd = [(a,b) | a <- [0..(numFltrs - 1)],
b <- [0..(fltrDpth - 1)]]
!fltrList = [R.unsafeSlice fltr (R.Any R.:. d1 R.:. d2 R.:. R.All
R.:. R.All)
| (d1, d2) <- fltrSlcInd]
!convResults <- conv2D signalVector fltrList strd
let !resChunks = chunksOf imgDpth convResults
addRepaArrLst !ls = foldl' (R.+^) (head ls) (tail ls)
!summedRes = map (\e -> flatten (addRepaArrLst e)) resChunks
!appendedRes = foldl' R.append (head summedRes) (tail summedRes)
!outWdthHght = 1 + quot (imgWdth - fltrWdth) strd
!resTensor = R.reshape (U.sol $ reverse [1, numFltrs, outWdthHght,
outWdthHght])
appendedRes
return resTensor | 1,653 | conv4D
:: T.Handle
-> T.Handle
-> RU.Array R.D R.DIM4 Float
-> RU.Array R.D R.DIM4 Float
-> Int
-> IO (RU.Array R.D R.DIM4 Float)
conv4D toC fromC !img !fltr !strd = do
-- 1 x imageDepth x imageWidth x imageHeight
let _:(!imgDpth):(!imgWdth):(!imgHght):_ = R.deepSeqArrays [img, fltr]
(reverse $ U.los
$ R.extent img)
-- numFilters x filterDepth x filterWidth x filterHeight
(!numFltrs):(!fltrDpth):(!fltrWdth):_ = reverse $ U.los $ R.extent fltr
!imgList = [R.unsafeSlice img (R.Any R.:. (0 :: Int) R.:. i R.:. R.All
R.:. R.All)
| i <- [0..(imgDpth - 1)]]
!signalVector = V.fromList imgList
!fltrSlcInd = [(a,b) | a <- [0..(numFltrs - 1)],
b <- [0..(fltrDpth - 1)]]
!fltrList = [R.unsafeSlice fltr (R.Any R.:. d1 R.:. d2 R.:. R.All
R.:. R.All)
| (d1, d2) <- fltrSlcInd]
!convResults <- conv2D signalVector fltrList strd
let !resChunks = chunksOf imgDpth convResults
addRepaArrLst !ls = foldl' (R.+^) (head ls) (tail ls)
!summedRes = map (\e -> flatten (addRepaArrLst e)) resChunks
!appendedRes = foldl' R.append (head summedRes) (tail summedRes)
!outWdthHght = 1 + quot (imgWdth - fltrWdth) strd
!resTensor = R.reshape (U.sol $ reverse [1, numFltrs, outWdthHght,
outWdthHght])
appendedRes
return resTensor | 1,653 | conv4D toC fromC !img !fltr !strd = do
-- 1 x imageDepth x imageWidth x imageHeight
let _:(!imgDpth):(!imgWdth):(!imgHght):_ = R.deepSeqArrays [img, fltr]
(reverse $ U.los
$ R.extent img)
-- numFilters x filterDepth x filterWidth x filterHeight
(!numFltrs):(!fltrDpth):(!fltrWdth):_ = reverse $ U.los $ R.extent fltr
!imgList = [R.unsafeSlice img (R.Any R.:. (0 :: Int) R.:. i R.:. R.All
R.:. R.All)
| i <- [0..(imgDpth - 1)]]
!signalVector = V.fromList imgList
!fltrSlcInd = [(a,b) | a <- [0..(numFltrs - 1)],
b <- [0..(fltrDpth - 1)]]
!fltrList = [R.unsafeSlice fltr (R.Any R.:. d1 R.:. d2 R.:. R.All
R.:. R.All)
| (d1, d2) <- fltrSlcInd]
!convResults <- conv2D signalVector fltrList strd
let !resChunks = chunksOf imgDpth convResults
addRepaArrLst !ls = foldl' (R.+^) (head ls) (tail ls)
!summedRes = map (\e -> flatten (addRepaArrLst e)) resChunks
!appendedRes = foldl' R.append (head summedRes) (tail summedRes)
!outWdthHght = 1 + quot (imgWdth - fltrWdth) strd
!resTensor = R.reshape (U.sol $ reverse [1, numFltrs, outWdthHght,
outWdthHght])
appendedRes
return resTensor | 1,511 | false | true | 0 | 18 | 630 | 613 | 303 | 310 | null | null |
jfoutz/language-bash | src/Language/Bash/Parse/Builder.hs | bsd-3-clause | -- | Concat zero or more monoidal results.
many :: (Alternative f, Monoid a) => f a -> f a
many = fmap mconcat . Applicative.many | 129 | many :: (Alternative f, Monoid a) => f a -> f a
many = fmap mconcat . Applicative.many | 86 | many = fmap mconcat . Applicative.many | 38 | true | true | 0 | 7 | 25 | 46 | 23 | 23 | null | null |
andyarvanitis/Idris-dev | src/Idris/IdeSlave.hs | bsd-3-clause | encodeTerm :: [(Name, Bool)] -> Term -> String
encodeTerm bnd tm = UTF8.toString . Base64.encode . Lazy.toStrict . Binary.encode $
(bnd, tm) | 160 | encodeTerm :: [(Name, Bool)] -> Term -> String
encodeTerm bnd tm = UTF8.toString . Base64.encode . Lazy.toStrict . Binary.encode $
(bnd, tm) | 160 | encodeTerm bnd tm = UTF8.toString . Base64.encode . Lazy.toStrict . Binary.encode $
(bnd, tm) | 113 | false | true | 0 | 9 | 41 | 63 | 34 | 29 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 1108 = 1107 | 11 | 1108 = 1107 | 11 | 1108 = 1107 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
bananu7/Turnip | src/Turnip/Eval/TH.hs | mit | genLibLoadFunction :: [Entry] -> Q [Dec]
genLibLoadFunction entries = do
let funs = ListE <$> mapM toModuleItem entries
[d|
loadBaseLibraryGen :: String -> Eval.LuaM ()
loadBaseLibraryGen modName = addNativeModule modName $(funs)
|]
where
toModuleItem :: Entry -> Q Exp
toModuleItem (_, luaName, tempName, _) = [e| (luaName, Eval.BuiltinFunction $(varE tempName)) |]
-- |Generates a declaration of a function compatible with Lua interface
-- @param tempName - the new name | 527 | genLibLoadFunction :: [Entry] -> Q [Dec]
genLibLoadFunction entries = do
let funs = ListE <$> mapM toModuleItem entries
[d|
loadBaseLibraryGen :: String -> Eval.LuaM ()
loadBaseLibraryGen modName = addNativeModule modName $(funs)
|]
where
toModuleItem :: Entry -> Q Exp
toModuleItem (_, luaName, tempName, _) = [e| (luaName, Eval.BuiltinFunction $(varE tempName)) |]
-- |Generates a declaration of a function compatible with Lua interface
-- @param tempName - the new name | 527 | genLibLoadFunction entries = do
let funs = ListE <$> mapM toModuleItem entries
[d|
loadBaseLibraryGen :: String -> Eval.LuaM ()
loadBaseLibraryGen modName = addNativeModule modName $(funs)
|]
where
toModuleItem :: Entry -> Q Exp
toModuleItem (_, luaName, tempName, _) = [e| (luaName, Eval.BuiltinFunction $(varE tempName)) |]
-- |Generates a declaration of a function compatible with Lua interface
-- @param tempName - the new name | 486 | false | true | 0 | 11 | 123 | 92 | 52 | 40 | null | null |
corajr/cataskell | src/Cataskell/GameData/Resources.hs | bsd-3-clause | genericHarborDiscount :: Int -> Set HarborDiscount
genericHarborDiscount i
= Set.fromList $ map (mkDiscount i) [Lumber, Wool, Wheat, Brick, Ore] | 146 | genericHarborDiscount :: Int -> Set HarborDiscount
genericHarborDiscount i
= Set.fromList $ map (mkDiscount i) [Lumber, Wool, Wheat, Brick, Ore] | 146 | genericHarborDiscount i
= Set.fromList $ map (mkDiscount i) [Lumber, Wool, Wheat, Brick, Ore] | 95 | false | true | 0 | 8 | 20 | 53 | 28 | 25 | null | null |
nushio3/ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickLCmdStmts' :: [LStmt Id (LHsCmd Id)] -> TM a -> TM ([LStmt Id (LHsCmd Id)], a)
addTickLCmdStmts' lstmts res
= bindLocals binders $ do
lstmts' <- mapM (liftL addTickCmdStmt) lstmts
a <- res
return (lstmts', a)
where
binders = collectLStmtsBinders lstmts | 295 | addTickLCmdStmts' :: [LStmt Id (LHsCmd Id)] -> TM a -> TM ([LStmt Id (LHsCmd Id)], a)
addTickLCmdStmts' lstmts res
= bindLocals binders $ do
lstmts' <- mapM (liftL addTickCmdStmt) lstmts
a <- res
return (lstmts', a)
where
binders = collectLStmtsBinders lstmts | 295 | addTickLCmdStmts' lstmts res
= bindLocals binders $ do
lstmts' <- mapM (liftL addTickCmdStmt) lstmts
a <- res
return (lstmts', a)
where
binders = collectLStmtsBinders lstmts | 209 | false | true | 0 | 12 | 76 | 119 | 57 | 62 | null | null |
fmthoma/ghc | compiler/hsSyn/HsExpr.hs | bsd-3-clause | isTypedBracket :: HsBracket id -> Bool
isTypedBracket (TExpBr {}) = True | 72 | isTypedBracket :: HsBracket id -> Bool
isTypedBracket (TExpBr {}) = True | 72 | isTypedBracket (TExpBr {}) = True | 33 | false | true | 0 | 7 | 10 | 28 | 14 | 14 | null | null |
input-output-hk/pos-haskell-prototype | infra/src/Pos/Infra/Network/Policy.hs | mit | defaultDequeuePolicyEdgeBehindNat :: DequeuePolicy
defaultDequeuePolicyEdgeBehindNat = go
where
go :: DequeuePolicy
go NodeCore = error "defaultDequeuePolicy: edge to core not applicable"
go NodeRelay = Dequeue (MaxMsgPerSec 1) (MaxInFlight 2)
go NodeEdge = error "defaultDequeuePolicy: edge to edge not applicable"
-- | Dequeueing policy for the Auxx CLI tool. | 382 | defaultDequeuePolicyEdgeBehindNat :: DequeuePolicy
defaultDequeuePolicyEdgeBehindNat = go
where
go :: DequeuePolicy
go NodeCore = error "defaultDequeuePolicy: edge to core not applicable"
go NodeRelay = Dequeue (MaxMsgPerSec 1) (MaxInFlight 2)
go NodeEdge = error "defaultDequeuePolicy: edge to edge not applicable"
-- | Dequeueing policy for the Auxx CLI tool. | 382 | defaultDequeuePolicyEdgeBehindNat = go
where
go :: DequeuePolicy
go NodeCore = error "defaultDequeuePolicy: edge to core not applicable"
go NodeRelay = Dequeue (MaxMsgPerSec 1) (MaxInFlight 2)
go NodeEdge = error "defaultDequeuePolicy: edge to edge not applicable"
-- | Dequeueing policy for the Auxx CLI tool. | 331 | false | true | 3 | 7 | 67 | 65 | 33 | 32 | null | null |
anttisalonen/economics | src/Curve.hs | mit | lookupY' (QuadraticFunction a b c) x = a * (x ^ (2 :: Int)) + b * x + c | 71 | lookupY' (QuadraticFunction a b c) x = a * (x ^ (2 :: Int)) + b * x + c | 71 | lookupY' (QuadraticFunction a b c) x = a * (x ^ (2 :: Int)) + b * x + c | 71 | false | false | 0 | 11 | 19 | 50 | 26 | 24 | null | null |
nedervold/context-free-grammar | src/Data/Graph/Inductive/ULGraph.hs | bsd-3-clause | matchAny :: (G.Graph gr, Ord n) => ULGraph gr n e -> GDecomp gr n e
matchAny gr = (fromFglContext gr ctxt, fromGraph gr')
where
(ctxt, gr') = G.matchAny $ toGraph gr
-- | Creates a 'ULGraph' from the list of nodes and labeled edges.
-- Nodes need not appear in the list of nodes; it's enough to appear
-- as one end of an edge. | 336 | matchAny :: (G.Graph gr, Ord n) => ULGraph gr n e -> GDecomp gr n e
matchAny gr = (fromFglContext gr ctxt, fromGraph gr')
where
(ctxt, gr') = G.matchAny $ toGraph gr
-- | Creates a 'ULGraph' from the list of nodes and labeled edges.
-- Nodes need not appear in the list of nodes; it's enough to appear
-- as one end of an edge. | 336 | matchAny gr = (fromFglContext gr ctxt, fromGraph gr')
where
(ctxt, gr') = G.matchAny $ toGraph gr
-- | Creates a 'ULGraph' from the list of nodes and labeled edges.
-- Nodes need not appear in the list of nodes; it's enough to appear
-- as one end of an edge. | 268 | false | true | 0 | 8 | 74 | 94 | 47 | 47 | null | null |
jml/difftodo | cmd/git-todo/Main.hs | apache-2.0 | commentsFromDiff :: [FilePath] -> IO [Comment]
commentsFromDiff args =
either abort pure . Fixme.newCommentsFromDiff =<< gitDiff args
where
abort e = do
hPutStrLn stderr $ "ERROR: " <> e
exitWith (ExitFailure 1) | 231 | commentsFromDiff :: [FilePath] -> IO [Comment]
commentsFromDiff args =
either abort pure . Fixme.newCommentsFromDiff =<< gitDiff args
where
abort e = do
hPutStrLn stderr $ "ERROR: " <> e
exitWith (ExitFailure 1) | 231 | commentsFromDiff args =
either abort pure . Fixme.newCommentsFromDiff =<< gitDiff args
where
abort e = do
hPutStrLn stderr $ "ERROR: " <> e
exitWith (ExitFailure 1) | 184 | false | true | 2 | 10 | 51 | 92 | 39 | 53 | null | null |
NICTA/lets-lens | src/Lets/GetSetLens.hs | bsd-3-clause | stateL ::
Lens Locality String
stateL =
Lens
(\(Locality c _ y) t -> Locality c t y)
(\(Locality _ t _) -> t) | 121 | stateL ::
Lens Locality String
stateL =
Lens
(\(Locality c _ y) t -> Locality c t y)
(\(Locality _ t _) -> t) | 121 | stateL =
Lens
(\(Locality c _ y) t -> Locality c t y)
(\(Locality _ t _) -> t) | 88 | false | true | 0 | 9 | 35 | 66 | 34 | 32 | null | null |
mpickering/HaRe | old/testing/rmOneParameter/FunIn4_TokOut.hs | bsd-3-clause | --Any unused parameter to a definition can be removed.
--In this example: remove 'x' will fail, as (x,y) is treated as one parameter and 'y' is used.
foo (x,y) = h + t where (h,t) = head $ zip [1..7] [3..y] | 210 | foo (x,y) = h + t where (h,t) = head $ zip [1..7] [3..y] | 58 | foo (x,y) = h + t where (h,t) = head $ zip [1..7] [3..y] | 58 | true | false | 0 | 9 | 44 | 55 | 30 | 25 | null | null |
aisamanra/matterhorn | src/State/Async.hs | bsd-3-clause | -- | Try to run a computation, posting an informative error
-- message if it fails with a 'MattermostServerError'.
tryMM :: IO a
-- ^ The action to try (usually a MM API call)
-> (a -> IO (MH ()))
-- ^ What to do on success
-> IO (MH ())
tryMM act onSuccess = do
result <- liftIO $ try act
case result of
Left e -> return $ mhError $ ServerError e
Right value -> liftIO $ onSuccess value
-- * Background Computation
-- $background_computation
--
-- The main context for Matterhorn is the EventM context provided by
-- the 'Brick' library. This context is normally waiting for user
-- input (or terminal resizing, etc.) which gets turned into an
-- MHEvent and the 'onEvent' event handler is called to process that
-- event, after which the display is redrawn as necessary and brick
-- awaits the next input.
--
-- However, it is often convenient to communicate with the Mattermost
-- server in the background, so that large numbers of
-- synchronously-blocking events (e.g. on startup) or refreshes can
-- occur whenever needed and without negatively impacting the UI
-- updates or responsiveness. This is handled by a 'forkIO' context
-- that waits on an STM channel for work to do, performs the work, and
-- then sends brick an MHEvent containing the completion or failure
-- information for that work.
--
-- The /doAsyncWith/ family of functions here facilitates that
-- asynchronous functionality. This is typically used in the
-- following fashion:
--
-- > doSomething :: MH ()
-- > doSomething = do
-- > got <- something
-- > doAsyncWith Normal $ do
-- > r <- mmFetchR ....
-- > return $ do
-- > csSomething.here %= processed r
--
-- The second argument is an IO monad operation (because 'forkIO' runs
-- in the IO Monad context), but it returns an MH monad operation.
-- The IO monad has access to the closure of 'doSomething' (e.g. the
-- 'got' value), but it should be aware that the state of the MH monad
-- may have been changed by the time the IO monad runs in the
-- background, so the closure is a snapshot of information at the time
-- the 'doAsyncWith' was called.
--
-- Similarly, the returned MH monad operation is *not* run in the
-- context of the 'forkIO' background, but it is instead passed via an
-- MHEvent back to the main brick thread, where it is executed in an
-- EventM handler's MH monad context. This operation therefore has
-- access to the combined closure of the pre- 'doAsyncWith' code and
-- the closure of the IO operation. It is important that the final MH
-- monad operation should *re-obtain* state information from the MH
-- monad instead of using or setting the state obtained prior to the
-- 'doAsyncWith' call.
-- | Priority setting for asynchronous work items. Preempt means that
-- the queued item will be the next work item begun (i.e. it goes to the
-- front of the queue); normal means it will go last in the queue. | 2,950 | tryMM :: IO a
-- ^ The action to try (usually a MM API call)
-> (a -> IO (MH ()))
-- ^ What to do on success
-> IO (MH ())
tryMM act onSuccess = do
result <- liftIO $ try act
case result of
Left e -> return $ mhError $ ServerError e
Right value -> liftIO $ onSuccess value
-- * Background Computation
-- $background_computation
--
-- The main context for Matterhorn is the EventM context provided by
-- the 'Brick' library. This context is normally waiting for user
-- input (or terminal resizing, etc.) which gets turned into an
-- MHEvent and the 'onEvent' event handler is called to process that
-- event, after which the display is redrawn as necessary and brick
-- awaits the next input.
--
-- However, it is often convenient to communicate with the Mattermost
-- server in the background, so that large numbers of
-- synchronously-blocking events (e.g. on startup) or refreshes can
-- occur whenever needed and without negatively impacting the UI
-- updates or responsiveness. This is handled by a 'forkIO' context
-- that waits on an STM channel for work to do, performs the work, and
-- then sends brick an MHEvent containing the completion or failure
-- information for that work.
--
-- The /doAsyncWith/ family of functions here facilitates that
-- asynchronous functionality. This is typically used in the
-- following fashion:
--
-- > doSomething :: MH ()
-- > doSomething = do
-- > got <- something
-- > doAsyncWith Normal $ do
-- > r <- mmFetchR ....
-- > return $ do
-- > csSomething.here %= processed r
--
-- The second argument is an IO monad operation (because 'forkIO' runs
-- in the IO Monad context), but it returns an MH monad operation.
-- The IO monad has access to the closure of 'doSomething' (e.g. the
-- 'got' value), but it should be aware that the state of the MH monad
-- may have been changed by the time the IO monad runs in the
-- background, so the closure is a snapshot of information at the time
-- the 'doAsyncWith' was called.
--
-- Similarly, the returned MH monad operation is *not* run in the
-- context of the 'forkIO' background, but it is instead passed via an
-- MHEvent back to the main brick thread, where it is executed in an
-- EventM handler's MH monad context. This operation therefore has
-- access to the combined closure of the pre- 'doAsyncWith' code and
-- the closure of the IO operation. It is important that the final MH
-- monad operation should *re-obtain* state information from the MH
-- monad instead of using or setting the state obtained prior to the
-- 'doAsyncWith' call.
-- | Priority setting for asynchronous work items. Preempt means that
-- the queued item will be the next work item begun (i.e. it goes to the
-- front of the queue); normal means it will go last in the queue. | 2,833 | tryMM act onSuccess = do
result <- liftIO $ try act
case result of
Left e -> return $ mhError $ ServerError e
Right value -> liftIO $ onSuccess value
-- * Background Computation
-- $background_computation
--
-- The main context for Matterhorn is the EventM context provided by
-- the 'Brick' library. This context is normally waiting for user
-- input (or terminal resizing, etc.) which gets turned into an
-- MHEvent and the 'onEvent' event handler is called to process that
-- event, after which the display is redrawn as necessary and brick
-- awaits the next input.
--
-- However, it is often convenient to communicate with the Mattermost
-- server in the background, so that large numbers of
-- synchronously-blocking events (e.g. on startup) or refreshes can
-- occur whenever needed and without negatively impacting the UI
-- updates or responsiveness. This is handled by a 'forkIO' context
-- that waits on an STM channel for work to do, performs the work, and
-- then sends brick an MHEvent containing the completion or failure
-- information for that work.
--
-- The /doAsyncWith/ family of functions here facilitates that
-- asynchronous functionality. This is typically used in the
-- following fashion:
--
-- > doSomething :: MH ()
-- > doSomething = do
-- > got <- something
-- > doAsyncWith Normal $ do
-- > r <- mmFetchR ....
-- > return $ do
-- > csSomething.here %= processed r
--
-- The second argument is an IO monad operation (because 'forkIO' runs
-- in the IO Monad context), but it returns an MH monad operation.
-- The IO monad has access to the closure of 'doSomething' (e.g. the
-- 'got' value), but it should be aware that the state of the MH monad
-- may have been changed by the time the IO monad runs in the
-- background, so the closure is a snapshot of information at the time
-- the 'doAsyncWith' was called.
--
-- Similarly, the returned MH monad operation is *not* run in the
-- context of the 'forkIO' background, but it is instead passed via an
-- MHEvent back to the main brick thread, where it is executed in an
-- EventM handler's MH monad context. This operation therefore has
-- access to the combined closure of the pre- 'doAsyncWith' code and
-- the closure of the IO operation. It is important that the final MH
-- monad operation should *re-obtain* state information from the MH
-- monad instead of using or setting the state obtained prior to the
-- 'doAsyncWith' call.
-- | Priority setting for asynchronous work items. Preempt means that
-- the queued item will be the next work item begun (i.e. it goes to the
-- front of the queue); normal means it will go last in the queue. | 2,686 | true | true | 0 | 13 | 609 | 173 | 108 | 65 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | tagOf_PrimOp DoubleAcosOp = _ILIT(104) | 38 | tagOf_PrimOp DoubleAcosOp = _ILIT(104) | 38 | tagOf_PrimOp DoubleAcosOp = _ILIT(104) | 38 | false | false | 0 | 6 | 3 | 15 | 7 | 8 | null | null |
olsner/ghc | testsuite/tests/perf/compiler/T10370.hs | bsd-3-clause | a528 :: IO (); a528 = forever $ putStrLn "a528" | 47 | a528 :: IO ()
a528 = forever $ putStrLn "a528" | 46 | a528 = forever $ putStrLn "a528" | 32 | false | true | 0 | 6 | 9 | 24 | 12 | 12 | null | null |
bitemyapp/ghc | libraries/base/GHC/Event/IntTable.hs | bsd-3-clause | new :: Int -> IO (IntTable a)
new capacity = IntTable `liftM` (newIORef =<< new_ capacity) | 90 | new :: Int -> IO (IntTable a)
new capacity = IntTable `liftM` (newIORef =<< new_ capacity) | 90 | new capacity = IntTable `liftM` (newIORef =<< new_ capacity) | 60 | false | true | 0 | 9 | 15 | 48 | 23 | 25 | null | null |
bkoropoff/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | -- | Pretty printing options with default verbosity.
defaultPPOption :: PPOption
defaultPPOption = PPOption { ppopt_impl = False , ppopt_depth = Just 200 } | 155 | defaultPPOption :: PPOption
defaultPPOption = PPOption { ppopt_impl = False , ppopt_depth = Just 200 } | 102 | defaultPPOption = PPOption { ppopt_impl = False , ppopt_depth = Just 200 } | 74 | true | true | 0 | 7 | 23 | 29 | 17 | 12 | null | null |
kawamuray/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | cvEnodesharedfilestoragepathunusable :: (String, String, String)
cvEnodesharedfilestoragepathunusable =
("node",
Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
"Shared file storage path unusable") | 218 | cvEnodesharedfilestoragepathunusable :: (String, String, String)
cvEnodesharedfilestoragepathunusable =
("node",
Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
"Shared file storage path unusable") | 218 | cvEnodesharedfilestoragepathunusable =
("node",
Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
"Shared file storage path unusable") | 153 | false | true | 0 | 7 | 22 | 34 | 20 | 14 | null | null |
libscott/quickson | test/Benchmark.hs | bsd-3-clause | main :: IO ()
main = defaultMain
-- TODO: Refactor such that "bench" also tests
[ bench "quickGetSimple" $ nf quickGetSimple jsonSimple
, bench "aesonGetSimple" $ nf aesonGetSimple jsonSimple
, bench "quickGetComplex" $ nf quickGetComplex jsonComplex
, bench "aesonGetComplex" $ nf aesonGetComplex jsonComplex
, bench "quickSetSimple" $ nf quickSetSimple simple
, bench "aesonSetSimple" $ nf aesonSetSimple simple
, bench "quickSetComplex" $ nf quickSetComplex complex
, bench "aesonSetComplex" $ nf aesonSetComplex complex
, bench "parseSimple" $ nf parseStructure "{a}"
, bench "parseComplex" $ nf parseStructure "{a,b:[{c,d:[{e,f}]}]}"
]
where
jsonSimple = d "{\"a\":2,\"b\":[1,1]}" :: Value
jsonComplex = d $ unsafePerformIO $ BL.readFile "test/complex.json"
check :: (Value -> Maybe a) -> Value -> a
check f = maybe (error "Nothing") id . f
quickGetSimple, aesonGetSimple :: Value -> Integer
quickGetSimple = check (.? "{a}")
aesonGetSimple = check $ parseMaybe $ withObject "" (.: "a")
quickGetComplex, aesonGetComplex :: Value -> [(Text,Float,[Text],[Text])]
quickGetComplex = check (.! "[{id,ppu,batters:{batter:[{id}]},topping:[{id}]}]")
aesonGetComplex = check $ parseMaybe $ parseJSON >=> mapM (\o ->
(,,,) <$> o .: "id" <*> o .: "ppu" <*> batters o <*> toppings o)
where
batters = (.:"batters") >=> withObject "" (.:"batter")
>=> mapM (withObject "" (.:"id"))
toppings = (.:"topping") >=> mapM (withObject "" (.:"id"))
simple = object ["a" .= Number 1]
quickSetSimple, aesonSetSimple :: Value -> Bool
quickSetSimple r = r `must` build "{a}" Null (1::Int)
aesonSetSimple r = r `must` object ["a" .= (1::Int)]
Just complex = decode "{\"a\":1,\"b\":[{\"a\":1},{\"a\":2},{\"a\":3}]}"
quickSetComplex, aesonSetComplex :: Value -> Bool
quickSetComplex r =
let vals = ((1,[1,2,3])::(Int,[Int]))
in r `must` build "{a,b:[{a}]}" Null vals
aesonSetComplex r =
let inner = [object ["a" .= n] | n <- [1,2,3::Int]]
in r `must` object ["a" .= (1::Int), "b" .= inner] | 2,202 | main :: IO ()
main = defaultMain
-- TODO: Refactor such that "bench" also tests
[ bench "quickGetSimple" $ nf quickGetSimple jsonSimple
, bench "aesonGetSimple" $ nf aesonGetSimple jsonSimple
, bench "quickGetComplex" $ nf quickGetComplex jsonComplex
, bench "aesonGetComplex" $ nf aesonGetComplex jsonComplex
, bench "quickSetSimple" $ nf quickSetSimple simple
, bench "aesonSetSimple" $ nf aesonSetSimple simple
, bench "quickSetComplex" $ nf quickSetComplex complex
, bench "aesonSetComplex" $ nf aesonSetComplex complex
, bench "parseSimple" $ nf parseStructure "{a}"
, bench "parseComplex" $ nf parseStructure "{a,b:[{c,d:[{e,f}]}]}"
]
where
jsonSimple = d "{\"a\":2,\"b\":[1,1]}" :: Value
jsonComplex = d $ unsafePerformIO $ BL.readFile "test/complex.json"
check :: (Value -> Maybe a) -> Value -> a
check f = maybe (error "Nothing") id . f
quickGetSimple, aesonGetSimple :: Value -> Integer
quickGetSimple = check (.? "{a}")
aesonGetSimple = check $ parseMaybe $ withObject "" (.: "a")
quickGetComplex, aesonGetComplex :: Value -> [(Text,Float,[Text],[Text])]
quickGetComplex = check (.! "[{id,ppu,batters:{batter:[{id}]},topping:[{id}]}]")
aesonGetComplex = check $ parseMaybe $ parseJSON >=> mapM (\o ->
(,,,) <$> o .: "id" <*> o .: "ppu" <*> batters o <*> toppings o)
where
batters = (.:"batters") >=> withObject "" (.:"batter")
>=> mapM (withObject "" (.:"id"))
toppings = (.:"topping") >=> mapM (withObject "" (.:"id"))
simple = object ["a" .= Number 1]
quickSetSimple, aesonSetSimple :: Value -> Bool
quickSetSimple r = r `must` build "{a}" Null (1::Int)
aesonSetSimple r = r `must` object ["a" .= (1::Int)]
Just complex = decode "{\"a\":1,\"b\":[{\"a\":1},{\"a\":2},{\"a\":3}]}"
quickSetComplex, aesonSetComplex :: Value -> Bool
quickSetComplex r =
let vals = ((1,[1,2,3])::(Int,[Int]))
in r `must` build "{a,b:[{a}]}" Null vals
aesonSetComplex r =
let inner = [object ["a" .= n] | n <- [1,2,3::Int]]
in r `must` object ["a" .= (1::Int), "b" .= inner] | 2,202 | main = defaultMain
-- TODO: Refactor such that "bench" also tests
[ bench "quickGetSimple" $ nf quickGetSimple jsonSimple
, bench "aesonGetSimple" $ nf aesonGetSimple jsonSimple
, bench "quickGetComplex" $ nf quickGetComplex jsonComplex
, bench "aesonGetComplex" $ nf aesonGetComplex jsonComplex
, bench "quickSetSimple" $ nf quickSetSimple simple
, bench "aesonSetSimple" $ nf aesonSetSimple simple
, bench "quickSetComplex" $ nf quickSetComplex complex
, bench "aesonSetComplex" $ nf aesonSetComplex complex
, bench "parseSimple" $ nf parseStructure "{a}"
, bench "parseComplex" $ nf parseStructure "{a,b:[{c,d:[{e,f}]}]}"
]
where
jsonSimple = d "{\"a\":2,\"b\":[1,1]}" :: Value
jsonComplex = d $ unsafePerformIO $ BL.readFile "test/complex.json"
check :: (Value -> Maybe a) -> Value -> a
check f = maybe (error "Nothing") id . f
quickGetSimple, aesonGetSimple :: Value -> Integer
quickGetSimple = check (.? "{a}")
aesonGetSimple = check $ parseMaybe $ withObject "" (.: "a")
quickGetComplex, aesonGetComplex :: Value -> [(Text,Float,[Text],[Text])]
quickGetComplex = check (.! "[{id,ppu,batters:{batter:[{id}]},topping:[{id}]}]")
aesonGetComplex = check $ parseMaybe $ parseJSON >=> mapM (\o ->
(,,,) <$> o .: "id" <*> o .: "ppu" <*> batters o <*> toppings o)
where
batters = (.:"batters") >=> withObject "" (.:"batter")
>=> mapM (withObject "" (.:"id"))
toppings = (.:"topping") >=> mapM (withObject "" (.:"id"))
simple = object ["a" .= Number 1]
quickSetSimple, aesonSetSimple :: Value -> Bool
quickSetSimple r = r `must` build "{a}" Null (1::Int)
aesonSetSimple r = r `must` object ["a" .= (1::Int)]
Just complex = decode "{\"a\":1,\"b\":[{\"a\":1},{\"a\":2},{\"a\":3}]}"
quickSetComplex, aesonSetComplex :: Value -> Bool
quickSetComplex r =
let vals = ((1,[1,2,3])::(Int,[Int]))
in r `must` build "{a,b:[{a}]}" Null vals
aesonSetComplex r =
let inner = [object ["a" .= n] | n <- [1,2,3::Int]]
in r `must` object ["a" .= (1::Int), "b" .= inner] | 2,188 | false | true | 1 | 15 | 516 | 742 | 391 | 351 | null | null |
DavidAlphaFox/ghc | compiler/hsSyn/HsDecls.hs | bsd-3-clause | annProvenanceName_maybe ModuleAnnProvenance = Nothing | 59 | annProvenanceName_maybe ModuleAnnProvenance = Nothing | 59 | annProvenanceName_maybe ModuleAnnProvenance = Nothing | 59 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
travitch/dalvik | src/Dalvik/Printer.hs | bsd-3-clause | prettyEncodedMethod :: DexFile -> [(MethodId, [VisibleAnnotation])] -> (Word32, EncodedMethod) -> PP.Doc
prettyEncodedMethod dex annots (n, m) =
case (mmeth, mmeth >>= (getProto dex . methProtoId)) of
(Just method, Just proto) ->
let flags = methAccessFlags m
adoc | Just vannots <- lookup (methId m) annots =
" annots" $+$ PP.nest 8 (vsep (map (prettyVisibleAnnotation dex) vannots))
| otherwise = PP.empty
in vsep [ " #" <> word32Dec n <> " : (in" <+> getTypeName' dex (methClassId method) <> ")"
, prettyField " name" (PP.quotes (getStr' dex (methNameId method)))
, prettyField " type" (PP.quotes (protoDesc dex proto))
, prettyFieldHexS " access" flags (AF.flagsString AF.AMethod flags)
, adoc
, maybe (" code: (none)") (prettyCode dex flags (methId m)) (methCode m)
]
(Nothing, _) -> "<unknown method ID: " <> word16HexFixed (methId m) <> ">"
(Just method, Nothing) -> "<unknown prototype ID: " <> word16HexFixed (methProtoId method) <> ">"
where
mmeth = getMethod dex (methId m)
-- | Like 'PP.vcat', except it never collapses overlapping lines | 1,271 | prettyEncodedMethod :: DexFile -> [(MethodId, [VisibleAnnotation])] -> (Word32, EncodedMethod) -> PP.Doc
prettyEncodedMethod dex annots (n, m) =
case (mmeth, mmeth >>= (getProto dex . methProtoId)) of
(Just method, Just proto) ->
let flags = methAccessFlags m
adoc | Just vannots <- lookup (methId m) annots =
" annots" $+$ PP.nest 8 (vsep (map (prettyVisibleAnnotation dex) vannots))
| otherwise = PP.empty
in vsep [ " #" <> word32Dec n <> " : (in" <+> getTypeName' dex (methClassId method) <> ")"
, prettyField " name" (PP.quotes (getStr' dex (methNameId method)))
, prettyField " type" (PP.quotes (protoDesc dex proto))
, prettyFieldHexS " access" flags (AF.flagsString AF.AMethod flags)
, adoc
, maybe (" code: (none)") (prettyCode dex flags (methId m)) (methCode m)
]
(Nothing, _) -> "<unknown method ID: " <> word16HexFixed (methId m) <> ">"
(Just method, Nothing) -> "<unknown prototype ID: " <> word16HexFixed (methProtoId method) <> ">"
where
mmeth = getMethod dex (methId m)
-- | Like 'PP.vcat', except it never collapses overlapping lines | 1,271 | prettyEncodedMethod dex annots (n, m) =
case (mmeth, mmeth >>= (getProto dex . methProtoId)) of
(Just method, Just proto) ->
let flags = methAccessFlags m
adoc | Just vannots <- lookup (methId m) annots =
" annots" $+$ PP.nest 8 (vsep (map (prettyVisibleAnnotation dex) vannots))
| otherwise = PP.empty
in vsep [ " #" <> word32Dec n <> " : (in" <+> getTypeName' dex (methClassId method) <> ")"
, prettyField " name" (PP.quotes (getStr' dex (methNameId method)))
, prettyField " type" (PP.quotes (protoDesc dex proto))
, prettyFieldHexS " access" flags (AF.flagsString AF.AMethod flags)
, adoc
, maybe (" code: (none)") (prettyCode dex flags (methId m)) (methCode m)
]
(Nothing, _) -> "<unknown method ID: " <> word16HexFixed (methId m) <> ">"
(Just method, Nothing) -> "<unknown prototype ID: " <> word16HexFixed (methProtoId method) <> ">"
where
mmeth = getMethod dex (methId m)
-- | Like 'PP.vcat', except it never collapses overlapping lines | 1,166 | false | true | 0 | 20 | 384 | 414 | 209 | 205 | null | null |
ellchow/pgrep | src/ParsecTree.hs | apache-2.0 | buildParser _ (ParametrizedNode "s" ((StringLeaf s) : [])) = Right $ str s | 74 | buildParser _ (ParametrizedNode "s" ((StringLeaf s) : [])) = Right $ str s | 74 | buildParser _ (ParametrizedNode "s" ((StringLeaf s) : [])) = Right $ str s | 74 | false | false | 1 | 10 | 12 | 43 | 20 | 23 | null | null |
ssaavedra/liquidhaskell | src/Language/Haskell/Liquid/Constraint/Qualifier.hs | bsd-3-clause | mkQual = mkQualNEW | 18 | mkQual = mkQualNEW | 18 | mkQual = mkQualNEW | 18 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
HIPERFIT/futhark | src/Futhark/IR/Primitive/Parse.hs | isc | keyword :: T.Text -> Parser ()
keyword s = lexeme $ chunk s *> notFollowedBy (satisfy constituent) | 98 | keyword :: T.Text -> Parser ()
keyword s = lexeme $ chunk s *> notFollowedBy (satisfy constituent) | 98 | keyword s = lexeme $ chunk s *> notFollowedBy (satisfy constituent) | 67 | false | true | 0 | 8 | 16 | 45 | 21 | 24 | null | null |
42f87d89/BinZ | binz.hs | mit | toBinZ (Cpx (0, b)) = BinZ [1,1] * toBinZ (Cpx (b, 0)) | 54 | toBinZ (Cpx (0, b)) = BinZ [1,1] * toBinZ (Cpx (b, 0)) | 54 | toBinZ (Cpx (0, b)) = BinZ [1,1] * toBinZ (Cpx (b, 0)) | 54 | false | false | 0 | 9 | 11 | 49 | 26 | 23 | null | null |
wellecks/coltrane | ColtraneTests.hs | bsd-3-clause | testPostParams3 :: Params
testPostParams3 = [("r1","/seas"),("dpt","cis")] | 74 | testPostParams3 :: Params
testPostParams3 = [("r1","/seas"),("dpt","cis")] | 74 | testPostParams3 = [("r1","/seas"),("dpt","cis")] | 48 | false | true | 0 | 7 | 5 | 36 | 19 | 17 | null | null |
dmvianna/haskellbook | src/Ch23-RandomExample2.hs | unlicense | nDie :: Int -> State StdGen [Die]
nDie n = replicateM n rollDie | 63 | nDie :: Int -> State StdGen [Die]
nDie n = replicateM n rollDie | 63 | nDie n = replicateM n rollDie | 29 | false | true | 0 | 7 | 12 | 31 | 15 | 16 | null | null |
begriffs/postgrest | test/Feature/PgVersion96Spec.hs | mit | spec :: SpecWith Application
spec =
describe "features supported on PostgreSQL 9.6" $ do
context "GUC headers" $ do
it "succeeds setting the headers" $ do
get "/rpc/get_projects_and_guc_headers?id=eq.2&select=id"
`shouldRespondWith` [json|[{"id": 2}]|]
{matchHeaders = [
matchContentTypeJson,
"X-Test" <:> "key1=val1; someValue; key2=val2",
"X-Test-2" <:> "key1=val1"]}
get "/rpc/get_int_and_guc_headers?num=1"
`shouldRespondWith` [json|1|]
{matchHeaders = [
matchContentTypeJson,
"X-Test" <:> "key1=val1; someValue; key2=val2",
"X-Test-2" <:> "key1=val1"]}
post "/rpc/get_int_and_guc_headers" [json|{"num": 1}|]
`shouldRespondWith` [json|1|]
{matchHeaders = [
matchContentTypeJson,
"X-Test" <:> "key1=val1; someValue; key2=val2",
"X-Test-2" <:> "key1=val1"]}
it "fails when setting headers with wrong json structure" $ do
get "/rpc/bad_guc_headers_1" `shouldRespondWith` 500
get "/rpc/bad_guc_headers_2" `shouldRespondWith` 500
get "/rpc/bad_guc_headers_3" `shouldRespondWith` 500
post "/rpc/bad_guc_headers_1" [json|{}|] `shouldRespondWith` 500
it "can set the same http header twice" $
get "/rpc/set_cookie_twice"
`shouldRespondWith` "null"
{matchHeaders = [
matchContentTypeJson,
"Set-Cookie" <:> "sessionid=38afes7a8; HttpOnly; Path=/",
"Set-Cookie" <:> "id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly"]}
context "Use of the phraseto_tsquery function" $ do
it "finds matches" $
get "/tsearch?text_search_vector=phfts.The%20Fat%20Cats" `shouldRespondWith`
[json| [{"text_search_vector": "'ate':3 'cat':2 'fat':1 'rat':4" }] |]
{ matchHeaders = [matchContentTypeJson] }
it "finds matches with different dictionaries" $
get "/tsearch?text_search_vector=phfts(german).Art%20Spass" `shouldRespondWith`
[json| [{"text_search_vector": "'art':4 'spass':5 'unmog':7" }] |]
{ matchHeaders = [matchContentTypeJson] }
it "can be negated with not operator" $
get "/tsearch?text_search_vector=not.phfts(english).The%20Fat%20Cats" `shouldRespondWith`
[json| [
{"text_search_vector": "'fun':5 'imposs':9 'kind':3"},
{"text_search_vector": "'also':2 'fun':3 'possibl':8"},
{"text_search_vector": "'amus':5 'fair':7 'impossibl':9 'peu':4"},
{"text_search_vector": "'art':4 'spass':5 'unmog':7"}]|]
{ matchHeaders = [matchContentTypeJson] }
it "can be used with or query param" $
get "/tsearch?or=(text_search_vector.phfts(german).Art%20Spass, text_search_vector.phfts(french).amusant, text_search_vector.fts(english).impossible)" `shouldRespondWith`
[json|[
{"text_search_vector": "'fun':5 'imposs':9 'kind':3" },
{"text_search_vector": "'amus':5 'fair':7 'impossibl':9 'peu':4" },
{"text_search_vector": "'art':4 'spass':5 'unmog':7"}
]|] { matchHeaders = [matchContentTypeJson] }
it "should work when used with GET RPC" $
get "/rpc/get_tsearch?text_search_vector=phfts(english).impossible" `shouldRespondWith`
[json|[{"text_search_vector":"'fun':5 'imposs':9 'kind':3"}]|]
{ matchHeaders = [matchContentTypeJson] } | 3,529 | spec :: SpecWith Application
spec =
describe "features supported on PostgreSQL 9.6" $ do
context "GUC headers" $ do
it "succeeds setting the headers" $ do
get "/rpc/get_projects_and_guc_headers?id=eq.2&select=id"
`shouldRespondWith` [json|[{"id": 2}]|]
{matchHeaders = [
matchContentTypeJson,
"X-Test" <:> "key1=val1; someValue; key2=val2",
"X-Test-2" <:> "key1=val1"]}
get "/rpc/get_int_and_guc_headers?num=1"
`shouldRespondWith` [json|1|]
{matchHeaders = [
matchContentTypeJson,
"X-Test" <:> "key1=val1; someValue; key2=val2",
"X-Test-2" <:> "key1=val1"]}
post "/rpc/get_int_and_guc_headers" [json|{"num": 1}|]
`shouldRespondWith` [json|1|]
{matchHeaders = [
matchContentTypeJson,
"X-Test" <:> "key1=val1; someValue; key2=val2",
"X-Test-2" <:> "key1=val1"]}
it "fails when setting headers with wrong json structure" $ do
get "/rpc/bad_guc_headers_1" `shouldRespondWith` 500
get "/rpc/bad_guc_headers_2" `shouldRespondWith` 500
get "/rpc/bad_guc_headers_3" `shouldRespondWith` 500
post "/rpc/bad_guc_headers_1" [json|{}|] `shouldRespondWith` 500
it "can set the same http header twice" $
get "/rpc/set_cookie_twice"
`shouldRespondWith` "null"
{matchHeaders = [
matchContentTypeJson,
"Set-Cookie" <:> "sessionid=38afes7a8; HttpOnly; Path=/",
"Set-Cookie" <:> "id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly"]}
context "Use of the phraseto_tsquery function" $ do
it "finds matches" $
get "/tsearch?text_search_vector=phfts.The%20Fat%20Cats" `shouldRespondWith`
[json| [{"text_search_vector": "'ate':3 'cat':2 'fat':1 'rat':4" }] |]
{ matchHeaders = [matchContentTypeJson] }
it "finds matches with different dictionaries" $
get "/tsearch?text_search_vector=phfts(german).Art%20Spass" `shouldRespondWith`
[json| [{"text_search_vector": "'art':4 'spass':5 'unmog':7" }] |]
{ matchHeaders = [matchContentTypeJson] }
it "can be negated with not operator" $
get "/tsearch?text_search_vector=not.phfts(english).The%20Fat%20Cats" `shouldRespondWith`
[json| [
{"text_search_vector": "'fun':5 'imposs':9 'kind':3"},
{"text_search_vector": "'also':2 'fun':3 'possibl':8"},
{"text_search_vector": "'amus':5 'fair':7 'impossibl':9 'peu':4"},
{"text_search_vector": "'art':4 'spass':5 'unmog':7"}]|]
{ matchHeaders = [matchContentTypeJson] }
it "can be used with or query param" $
get "/tsearch?or=(text_search_vector.phfts(german).Art%20Spass, text_search_vector.phfts(french).amusant, text_search_vector.fts(english).impossible)" `shouldRespondWith`
[json|[
{"text_search_vector": "'fun':5 'imposs':9 'kind':3" },
{"text_search_vector": "'amus':5 'fair':7 'impossibl':9 'peu':4" },
{"text_search_vector": "'art':4 'spass':5 'unmog':7"}
]|] { matchHeaders = [matchContentTypeJson] }
it "should work when used with GET RPC" $
get "/rpc/get_tsearch?text_search_vector=phfts(english).impossible" `shouldRespondWith`
[json|[{"text_search_vector":"'fun':5 'imposs':9 'kind':3"}]|]
{ matchHeaders = [matchContentTypeJson] } | 3,529 | spec =
describe "features supported on PostgreSQL 9.6" $ do
context "GUC headers" $ do
it "succeeds setting the headers" $ do
get "/rpc/get_projects_and_guc_headers?id=eq.2&select=id"
`shouldRespondWith` [json|[{"id": 2}]|]
{matchHeaders = [
matchContentTypeJson,
"X-Test" <:> "key1=val1; someValue; key2=val2",
"X-Test-2" <:> "key1=val1"]}
get "/rpc/get_int_and_guc_headers?num=1"
`shouldRespondWith` [json|1|]
{matchHeaders = [
matchContentTypeJson,
"X-Test" <:> "key1=val1; someValue; key2=val2",
"X-Test-2" <:> "key1=val1"]}
post "/rpc/get_int_and_guc_headers" [json|{"num": 1}|]
`shouldRespondWith` [json|1|]
{matchHeaders = [
matchContentTypeJson,
"X-Test" <:> "key1=val1; someValue; key2=val2",
"X-Test-2" <:> "key1=val1"]}
it "fails when setting headers with wrong json structure" $ do
get "/rpc/bad_guc_headers_1" `shouldRespondWith` 500
get "/rpc/bad_guc_headers_2" `shouldRespondWith` 500
get "/rpc/bad_guc_headers_3" `shouldRespondWith` 500
post "/rpc/bad_guc_headers_1" [json|{}|] `shouldRespondWith` 500
it "can set the same http header twice" $
get "/rpc/set_cookie_twice"
`shouldRespondWith` "null"
{matchHeaders = [
matchContentTypeJson,
"Set-Cookie" <:> "sessionid=38afes7a8; HttpOnly; Path=/",
"Set-Cookie" <:> "id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly"]}
context "Use of the phraseto_tsquery function" $ do
it "finds matches" $
get "/tsearch?text_search_vector=phfts.The%20Fat%20Cats" `shouldRespondWith`
[json| [{"text_search_vector": "'ate':3 'cat':2 'fat':1 'rat':4" }] |]
{ matchHeaders = [matchContentTypeJson] }
it "finds matches with different dictionaries" $
get "/tsearch?text_search_vector=phfts(german).Art%20Spass" `shouldRespondWith`
[json| [{"text_search_vector": "'art':4 'spass':5 'unmog':7" }] |]
{ matchHeaders = [matchContentTypeJson] }
it "can be negated with not operator" $
get "/tsearch?text_search_vector=not.phfts(english).The%20Fat%20Cats" `shouldRespondWith`
[json| [
{"text_search_vector": "'fun':5 'imposs':9 'kind':3"},
{"text_search_vector": "'also':2 'fun':3 'possibl':8"},
{"text_search_vector": "'amus':5 'fair':7 'impossibl':9 'peu':4"},
{"text_search_vector": "'art':4 'spass':5 'unmog':7"}]|]
{ matchHeaders = [matchContentTypeJson] }
it "can be used with or query param" $
get "/tsearch?or=(text_search_vector.phfts(german).Art%20Spass, text_search_vector.phfts(french).amusant, text_search_vector.fts(english).impossible)" `shouldRespondWith`
[json|[
{"text_search_vector": "'fun':5 'imposs':9 'kind':3" },
{"text_search_vector": "'amus':5 'fair':7 'impossibl':9 'peu':4" },
{"text_search_vector": "'art':4 'spass':5 'unmog':7"}
]|] { matchHeaders = [matchContentTypeJson] }
it "should work when used with GET RPC" $
get "/rpc/get_tsearch?text_search_vector=phfts(english).impossible" `shouldRespondWith`
[json|[{"text_search_vector":"'fun':5 'imposs':9 'kind':3"}]|]
{ matchHeaders = [matchContentTypeJson] } | 3,500 | false | true | 1 | 18 | 885 | 462 | 259 | 203 | null | null |
tamarin-prover/tamarin-prover | lib/theory/src/Theory/Text/Pretty.hs | gpl-3.0 | opExists = operator_ "∃ " | 28 | opExists = operator_ "∃ " | 28 | opExists = operator_ "∃ " | 28 | false | false | 0 | 5 | 7 | 9 | 4 | 5 | null | null |
jgeskens/oemfoe-haskell | Main.hs | mit | fib 1 = 2 | 9 | fib 1 = 2 | 9 | fib 1 = 2 | 9 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
urbanslug/ghc | compiler/codeGen/StgCmmProf.hs | bsd-3-clause | -----------------------------------------------------------------------------
--
-- Lag/drag/void stuff
--
-----------------------------------------------------------------------------
--
-- Initial value for the LDV field in a static closure
--
staticLdvInit :: DynFlags -> CmmLit
staticLdvInit = zeroCLit | 322 | staticLdvInit :: DynFlags -> CmmLit
staticLdvInit = zeroCLit | 60 | staticLdvInit = zeroCLit | 24 | true | true | 0 | 7 | 43 | 30 | 17 | 13 | null | null |
timtylin/scholdoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | bracketed :: Monoid a => LP a -> LP a
bracketed parser = try $ char '[' *> (mconcat <$> manyTill parser (char ']')) | 115 | bracketed :: Monoid a => LP a -> LP a
bracketed parser = try $ char '[' *> (mconcat <$> manyTill parser (char ']')) | 115 | bracketed parser = try $ char '[' *> (mconcat <$> manyTill parser (char ']')) | 77 | false | true | 0 | 10 | 23 | 60 | 28 | 32 | null | null |
kikofernandez/kikofernandez.github.io | files/monadic-typechecker/typechecker/src/Initial/Typechecker.hs | mit | -- | Helper function to lookup a class given a 'Name' and an 'Env'.
-- For example:
--
-- > typecheck env (ClassType c) = do
-- > _ <- lookupClass env c
-- > return $ ClassType c
--
lookupClass :: Env -> Name -> Except TCError ClassDef
lookupClass Env{ctable} c =
case Map.lookup c ctable of
Just cdef -> return cdef
Nothing -> throwError $ UnknownClassError c
-- | Find a field declaration by its 'Type' (@ty@) and field name @f@ | 445 | lookupClass :: Env -> Name -> Except TCError ClassDef
lookupClass Env{ctable} c =
case Map.lookup c ctable of
Just cdef -> return cdef
Nothing -> throwError $ UnknownClassError c
-- | Find a field declaration by its 'Type' (@ty@) and field name @f@ | 259 | lookupClass Env{ctable} c =
case Map.lookup c ctable of
Just cdef -> return cdef
Nothing -> throwError $ UnknownClassError c
-- | Find a field declaration by its 'Type' (@ty@) and field name @f@ | 205 | true | true | 3 | 7 | 97 | 79 | 41 | 38 | null | null |
mightymoose/liquidhaskell | tests/pos/GhcListSort.hs | bsd-3-clause | rqsort w (x:xs) r = rqpart w x xs [] [] r | 41 | rqsort w (x:xs) r = rqpart w x xs [] [] r | 41 | rqsort w (x:xs) r = rqpart w x xs [] [] r | 41 | false | false | 0 | 7 | 11 | 37 | 18 | 19 | null | null |
christiannolte/tip-toi-reveng | src/GMEWriter.hs | mit | putTVal :: TVal ResReg -> SPut
putTVal (Reg n) = do
putWord8 0
putWord16 n | 82 | putTVal :: TVal ResReg -> SPut
putTVal (Reg n) = do
putWord8 0
putWord16 n | 82 | putTVal (Reg n) = do
putWord8 0
putWord16 n | 51 | false | true | 0 | 7 | 22 | 39 | 17 | 22 | null | null |
brendanhay/gogol | gogol-healthcare/gen/Network/Google/Resource/Healthcare/Projects/Locations/DataSets/Deidentify.hs | mpl-2.0 | -- | V1 error format.
pldsdXgafv :: Lens' ProjectsLocationsDataSetsDeidentify (Maybe Xgafv)
pldsdXgafv
= lens _pldsdXgafv (\ s a -> s{_pldsdXgafv = a}) | 153 | pldsdXgafv :: Lens' ProjectsLocationsDataSetsDeidentify (Maybe Xgafv)
pldsdXgafv
= lens _pldsdXgafv (\ s a -> s{_pldsdXgafv = a}) | 131 | pldsdXgafv
= lens _pldsdXgafv (\ s a -> s{_pldsdXgafv = a}) | 61 | true | true | 0 | 9 | 23 | 48 | 25 | 23 | null | null |
jeffchao/hedgewars-accessible | gameServer/HandlerUtils.hs | gpl-2.0 | thisClientChans :: Reader (ClientIndex, IRnC) [ClientChan]
thisClientChans = do
(ci, rnc) <- ask
return [sendChan (rnc `client` ci)] | 140 | thisClientChans :: Reader (ClientIndex, IRnC) [ClientChan]
thisClientChans = do
(ci, rnc) <- ask
return [sendChan (rnc `client` ci)] | 140 | thisClientChans = do
(ci, rnc) <- ask
return [sendChan (rnc `client` ci)] | 81 | false | true | 0 | 11 | 25 | 59 | 32 | 27 | null | null |
jonathanknowles/haskell-calculator | source/library/Reflex/Dom/Extras.hs | bsd-3-clause | styleSheet :: DomBuilder t m => Text -> m ()
styleSheet link = elAttr "link" as $ pure ()
where as = mconcat [ "rel" =: "stylesheet"
, "type" =: "text/css"
, "href" =: link ] | 225 | styleSheet :: DomBuilder t m => Text -> m ()
styleSheet link = elAttr "link" as $ pure ()
where as = mconcat [ "rel" =: "stylesheet"
, "type" =: "text/css"
, "href" =: link ] | 225 | styleSheet link = elAttr "link" as $ pure ()
where as = mconcat [ "rel" =: "stylesheet"
, "type" =: "text/css"
, "href" =: link ] | 180 | false | true | 0 | 8 | 86 | 78 | 38 | 40 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.