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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
riwsky/wiwinwlh | src/writer.hs | mit | example :: MyWriter
example = do
tell [1..5]
tell [5..10]
return "foo" | 77 | example :: MyWriter
example = do
tell [1..5]
tell [5..10]
return "foo" | 77 | example = do
tell [1..5]
tell [5..10]
return "foo" | 57 | false | true | 0 | 8 | 18 | 39 | 18 | 21 | null | null |
alexander-at-github/eta | compiler/ETA/Interactive/ByteCodeItbls.hs | bsd-3-clause | mkITbls dflags (tc:tcs) = do itbls <- mkITbl dflags tc
itbls2 <- mkITbls dflags tcs
return (itbls `plusNameEnv` itbls2) | 178 | mkITbls dflags (tc:tcs) = do itbls <- mkITbl dflags tc
itbls2 <- mkITbls dflags tcs
return (itbls `plusNameEnv` itbls2) | 178 | mkITbls dflags (tc:tcs) = do itbls <- mkITbl dflags tc
itbls2 <- mkITbls dflags tcs
return (itbls `plusNameEnv` itbls2) | 178 | false | false | 0 | 9 | 77 | 57 | 27 | 30 | null | null |
Yuras/hfd | src/IMsg.hs | bsd-3-clause | akeAMF :: Monad m => Iteratee ByteString m (AMF, Int)
takeAMF = do
parent <- endianRead4 e_
(name, nl) <- takeStr
vtype <- endianRead2 e_
flags <- endianRead4 e_
(value, vl) <- takeAMFValue vtype
return (AMF parent (bs2s name) flags value, 4 + nl + 2 + 4 + vl)
-- | Read AMF value
| 294 | takeAMF :: Monad m => Iteratee ByteString m (AMF, Int)
takeAMF = do
parent <- endianRead4 e_
(name, nl) <- takeStr
vtype <- endianRead2 e_
flags <- endianRead4 e_
(value, vl) <- takeAMFValue vtype
return (AMF parent (bs2s name) flags value, 4 + nl + 2 + 4 + vl)
-- | Read AMF value | 294 | takeAMF = do
parent <- endianRead4 e_
(name, nl) <- takeStr
vtype <- endianRead2 e_
flags <- endianRead4 e_
(value, vl) <- takeAMFValue vtype
return (AMF parent (bs2s name) flags value, 4 + nl + 2 + 4 + vl)
-- | Read AMF value | 239 | false | true | 0 | 12 | 68 | 134 | 65 | 69 | null | null |
nevrenato/HetsAlloy | CASL/OMDocImport.hs | gpl-2.0 | omdocToType _ ome = error $ "omdocToType: Non-supported element: " ++ show ome | 78 | omdocToType _ ome = error $ "omdocToType: Non-supported element: " ++ show ome | 78 | omdocToType _ ome = error $ "omdocToType: Non-supported element: " ++ show ome | 78 | false | false | 1 | 6 | 12 | 22 | 10 | 12 | null | null |
svalaskevicius/hob | test/Hob/Ui/EditorSpec.hs | gpl-3.0 | launchNewFileAndSetModified :: IO Context
launchNewFileAndSetModified = do
ctx <- loadDefaultContext
_ <- launchEditorTab ctx $ Just "/xxx/testName.hs"
buffer <- textViewGetBuffer . fromJust =<< getActiveEditor ctx
textBufferSetModified buffer True
return ctx | 279 | launchNewFileAndSetModified :: IO Context
launchNewFileAndSetModified = do
ctx <- loadDefaultContext
_ <- launchEditorTab ctx $ Just "/xxx/testName.hs"
buffer <- textViewGetBuffer . fromJust =<< getActiveEditor ctx
textBufferSetModified buffer True
return ctx | 279 | launchNewFileAndSetModified = do
ctx <- loadDefaultContext
_ <- launchEditorTab ctx $ Just "/xxx/testName.hs"
buffer <- textViewGetBuffer . fromJust =<< getActiveEditor ctx
textBufferSetModified buffer True
return ctx | 237 | false | true | 0 | 10 | 49 | 76 | 31 | 45 | null | null |
ahmadsalim/p3-tool | p3-tool/TVL/Parser.hs | gpl-3.0 | pPresence :: Parser st Presence
pPresence = option PNone ((reserved "opt" *> return POptional) <|> (reserved "shared" *> return PShared)) | 137 | pPresence :: Parser st Presence
pPresence = option PNone ((reserved "opt" *> return POptional) <|> (reserved "shared" *> return PShared)) | 137 | pPresence = option PNone ((reserved "opt" *> return POptional) <|> (reserved "shared" *> return PShared)) | 105 | false | true | 1 | 10 | 19 | 57 | 26 | 31 | null | null |
pjones/themoviedb | example/Main.hs | mit | main :: IO ()
main = do
args <- getArgs
lang <- lookupEnv "TMDB_LANG"
let key = maybe T.empty T.pack (listToMaybe args)
settings = Settings key (toText <$> lang)
result <- runTheMovieDB settings $
case args of
[_, "search", query] -> searchAndListMovies (T.pack query)
[_, "fetch", mid] -> itemID fetchAndPrintMovie mid
[_, "tsearch", query] -> searchAndListTV (T.pack query)
[_, "tfetch", tid] -> itemID fetchAndPrintTV tid
[_, "season", t, s] -> itemID (\t -> itemID (fetchAndPrintSeason t) s) t
[_, "tfull", t] -> itemID fetchAndPrintFullTV t
_ -> liftIO (putStrLn usage >> exitFailure)
case result of
Left err -> print err >> exitFailure
Right _ -> exitSuccess
where
itemID :: MonadIO m => (ItemID -> m a) -> String -> m a
itemID f str =
case readMaybe str of
Nothing -> die ("invalid ID: " <> str)
Just n -> f n
usage =
"Usage: tmdb key {search|fetch|tsearch|tfetch|season|tfull}\n\n"
++ "Description:\n"
++ " search: search TheMovieDB\n"
++ " fetch: fetch info about one movie\n"
++ " tsearch: search for TV series\n"
++ " tfetch: fetch TV series by ID\n"
++ " season: fetch one season by TV ID and season num\n"
++ " tfull: pull everything about TV series by ID\n"
++ "Examples:\n"
++ " tmdb KEY search \"back to the future\"\n"
++ " tmdb KEY fetch 105\n"
++ " tmdb KEY tsearch Firefly\n"
++ " tmdb KEY tfetch 1437\n"
++ " tmdb KEY season 1437 1\n"
++ " tmdb KEY tfull 1437\n" | 1,683 | main :: IO ()
main = do
args <- getArgs
lang <- lookupEnv "TMDB_LANG"
let key = maybe T.empty T.pack (listToMaybe args)
settings = Settings key (toText <$> lang)
result <- runTheMovieDB settings $
case args of
[_, "search", query] -> searchAndListMovies (T.pack query)
[_, "fetch", mid] -> itemID fetchAndPrintMovie mid
[_, "tsearch", query] -> searchAndListTV (T.pack query)
[_, "tfetch", tid] -> itemID fetchAndPrintTV tid
[_, "season", t, s] -> itemID (\t -> itemID (fetchAndPrintSeason t) s) t
[_, "tfull", t] -> itemID fetchAndPrintFullTV t
_ -> liftIO (putStrLn usage >> exitFailure)
case result of
Left err -> print err >> exitFailure
Right _ -> exitSuccess
where
itemID :: MonadIO m => (ItemID -> m a) -> String -> m a
itemID f str =
case readMaybe str of
Nothing -> die ("invalid ID: " <> str)
Just n -> f n
usage =
"Usage: tmdb key {search|fetch|tsearch|tfetch|season|tfull}\n\n"
++ "Description:\n"
++ " search: search TheMovieDB\n"
++ " fetch: fetch info about one movie\n"
++ " tsearch: search for TV series\n"
++ " tfetch: fetch TV series by ID\n"
++ " season: fetch one season by TV ID and season num\n"
++ " tfull: pull everything about TV series by ID\n"
++ "Examples:\n"
++ " tmdb KEY search \"back to the future\"\n"
++ " tmdb KEY fetch 105\n"
++ " tmdb KEY tsearch Firefly\n"
++ " tmdb KEY tfetch 1437\n"
++ " tmdb KEY season 1437 1\n"
++ " tmdb KEY tfull 1437\n" | 1,683 | main = do
args <- getArgs
lang <- lookupEnv "TMDB_LANG"
let key = maybe T.empty T.pack (listToMaybe args)
settings = Settings key (toText <$> lang)
result <- runTheMovieDB settings $
case args of
[_, "search", query] -> searchAndListMovies (T.pack query)
[_, "fetch", mid] -> itemID fetchAndPrintMovie mid
[_, "tsearch", query] -> searchAndListTV (T.pack query)
[_, "tfetch", tid] -> itemID fetchAndPrintTV tid
[_, "season", t, s] -> itemID (\t -> itemID (fetchAndPrintSeason t) s) t
[_, "tfull", t] -> itemID fetchAndPrintFullTV t
_ -> liftIO (putStrLn usage >> exitFailure)
case result of
Left err -> print err >> exitFailure
Right _ -> exitSuccess
where
itemID :: MonadIO m => (ItemID -> m a) -> String -> m a
itemID f str =
case readMaybe str of
Nothing -> die ("invalid ID: " <> str)
Just n -> f n
usage =
"Usage: tmdb key {search|fetch|tsearch|tfetch|season|tfull}\n\n"
++ "Description:\n"
++ " search: search TheMovieDB\n"
++ " fetch: fetch info about one movie\n"
++ " tsearch: search for TV series\n"
++ " tfetch: fetch TV series by ID\n"
++ " season: fetch one season by TV ID and season num\n"
++ " tfull: pull everything about TV series by ID\n"
++ "Examples:\n"
++ " tmdb KEY search \"back to the future\"\n"
++ " tmdb KEY fetch 105\n"
++ " tmdb KEY tsearch Firefly\n"
++ " tmdb KEY tfetch 1437\n"
++ " tmdb KEY season 1437 1\n"
++ " tmdb KEY tfull 1437\n" | 1,669 | false | true | 0 | 18 | 541 | 441 | 220 | 221 | null | null |
ezyang/ghc | compiler/typecheck/TcGenGenerics.hs | bsd-3-clause | x_Pat :: LPat GhcPs
x_Pat = nlVarPat x_RDR | 42 | x_Pat :: LPat GhcPs
x_Pat = nlVarPat x_RDR | 42 | x_Pat = nlVarPat x_RDR | 22 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
tamarin-prover/tamarin-prover | lib/term/src/Term/LTerm.hs | gpl-3.0 | sortSuffix LSortPub = "pub" | 29 | sortSuffix LSortPub = "pub" | 29 | sortSuffix LSortPub = "pub" | 29 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
karamellpelle/grid | source/Game/Values/Plain.hs | gpl-3.0 | valueFadeRoomTicks :: Float
valueFadeRoomTicks =
1.0 | 57 | valueFadeRoomTicks :: Float
valueFadeRoomTicks =
1.0 | 57 | valueFadeRoomTicks =
1.0 | 29 | false | true | 0 | 4 | 10 | 11 | 6 | 5 | null | null |
urbanslug/ghc | compiler/coreSyn/PprCore.hs | bsd-3-clause | ppr_expr add_par (Lit lit) = pprLiteral add_par lit | 55 | ppr_expr add_par (Lit lit) = pprLiteral add_par lit | 55 | ppr_expr add_par (Lit lit) = pprLiteral add_par lit | 55 | false | false | 0 | 6 | 11 | 24 | 10 | 14 | null | null |
CommBank/codetroll | src/Codetroll/Main.hs | apache-2.0 | grep_ (p : ps) files = do
raw <- errExit False $ run "grep" $ [ "--color=always", "-nr", T.append (L.foldl (\acc el -> T.concat [ acc, "\\|", el ]) (T.append "'" p) ps) "'" ] ++ (toTextIgnore <$> files)
grepStatus <- lastExitCode
_ <- if grepStatus /= 1 && grepStatus /= 0 then errorExit [st|Grep returned with status code #{show $ grepStatus}|] else return ()
parsedLines <- return $ (AT.parseOnly grepParser) <$> T.lines raw
sequence $ (\t ->
case t of
Left err -> errorExit $ T.concat [ [st|Could not parse grep response: #{show err}\n|], raw ]
Right result -> return result
) <$> parsedLines | 645 | grep_ (p : ps) files = do
raw <- errExit False $ run "grep" $ [ "--color=always", "-nr", T.append (L.foldl (\acc el -> T.concat [ acc, "\\|", el ]) (T.append "'" p) ps) "'" ] ++ (toTextIgnore <$> files)
grepStatus <- lastExitCode
_ <- if grepStatus /= 1 && grepStatus /= 0 then errorExit [st|Grep returned with status code #{show $ grepStatus}|] else return ()
parsedLines <- return $ (AT.parseOnly grepParser) <$> T.lines raw
sequence $ (\t ->
case t of
Left err -> errorExit $ T.concat [ [st|Could not parse grep response: #{show err}\n|], raw ]
Right result -> return result
) <$> parsedLines | 645 | grep_ (p : ps) files = do
raw <- errExit False $ run "grep" $ [ "--color=always", "-nr", T.append (L.foldl (\acc el -> T.concat [ acc, "\\|", el ]) (T.append "'" p) ps) "'" ] ++ (toTextIgnore <$> files)
grepStatus <- lastExitCode
_ <- if grepStatus /= 1 && grepStatus /= 0 then errorExit [st|Grep returned with status code #{show $ grepStatus}|] else return ()
parsedLines <- return $ (AT.parseOnly grepParser) <$> T.lines raw
sequence $ (\t ->
case t of
Left err -> errorExit $ T.concat [ [st|Could not parse grep response: #{show err}\n|], raw ]
Right result -> return result
) <$> parsedLines | 645 | false | false | 1 | 17 | 154 | 254 | 128 | 126 | null | null |
gcampax/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | returnM_RDR = nameRdrName returnMName | 49 | returnM_RDR = nameRdrName returnMName | 49 | returnM_RDR = nameRdrName returnMName | 49 | false | false | 0 | 5 | 15 | 9 | 4 | 5 | null | null |
venkat24/codeworld | codeworld-base/src/Internal/Picture.hs | apache-2.0 | -- A picture made by drawing these pictures, ordered from top to bottom.
pictures :: HasCallStack => [Picture] -> Picture
pictures = CWPic . CW.pictures . map toCWPic | 166 | pictures :: HasCallStack => [Picture] -> Picture
pictures = CWPic . CW.pictures . map toCWPic | 93 | pictures = CWPic . CW.pictures . map toCWPic | 44 | true | true | 0 | 7 | 27 | 37 | 19 | 18 | null | null |
batterseapower/chsc | Core/Syntax.hs | bsd-3-clause | pPrintPrecLam :: Pretty a => PrettyLevel -> Rational -> [Var] -> a -> Doc
pPrintPrecLam level prec xs e = prettyParen (prec > noPrec) $ text "\\" <> hsep [pPrintPrec level appPrec y | y <- xs] <+> text "->" <+> pPrintPrec level noPrec e | 236 | pPrintPrecLam :: Pretty a => PrettyLevel -> Rational -> [Var] -> a -> Doc
pPrintPrecLam level prec xs e = prettyParen (prec > noPrec) $ text "\\" <> hsep [pPrintPrec level appPrec y | y <- xs] <+> text "->" <+> pPrintPrec level noPrec e | 236 | pPrintPrecLam level prec xs e = prettyParen (prec > noPrec) $ text "\\" <> hsep [pPrintPrec level appPrec y | y <- xs] <+> text "->" <+> pPrintPrec level noPrec e | 162 | false | true | 0 | 11 | 44 | 106 | 51 | 55 | null | null |
sheyll/isobmff-builder | src/Data/ByteString/IsoBaseFileFormat/Boxes/HintMediaHeader.hs | bsd-3-clause | hintMediaHeader :: HintMediaHeader -> Box (FullBox HintMediaHeader 0)
hintMediaHeader = fullBox 0 | 97 | hintMediaHeader :: HintMediaHeader -> Box (FullBox HintMediaHeader 0)
hintMediaHeader = fullBox 0 | 97 | hintMediaHeader = fullBox 0 | 27 | false | true | 0 | 8 | 11 | 29 | 14 | 15 | null | null |
siddhanathan/yi | yi-mode-haskell/src/Yi/Syntax/Haskell.hs | gpl-2.0 | -- | Parse an unary operator with and without using please
pOP :: [Token] -> Parser TT (Exp TT) -> Parser TT (Exp TT)
pOP op r = Bin <$> pAtom op <*> r | 151 | pOP :: [Token] -> Parser TT (Exp TT) -> Parser TT (Exp TT)
pOP op r = Bin <$> pAtom op <*> r | 92 | pOP op r = Bin <$> pAtom op <*> r | 33 | true | true | 0 | 9 | 33 | 66 | 31 | 35 | null | null |
keithodulaigh/Hets | OWL2/XMLConversion.hs | gpl-2.0 | set1Map :: (String, String) -> Element
set1Map (s, iri) = setPref s $ mwIRI $ setFull $ splitIRI $ mkQName iri | 110 | set1Map :: (String, String) -> Element
set1Map (s, iri) = setPref s $ mwIRI $ setFull $ splitIRI $ mkQName iri | 110 | set1Map (s, iri) = setPref s $ mwIRI $ setFull $ splitIRI $ mkQName iri | 71 | false | true | 0 | 9 | 20 | 52 | 27 | 25 | null | null |
verement/etamoo | src/MOO/Task.hs | bsd-3-clause | -- | Verify that the given object is a wizard, raising 'E_PERM' if not.
checkWizard' :: ObjId -> MOO ()
checkWizard' perm = do
wizard <- isWizard perm
unless wizard $ raise E_PERM
-- | Verify that the current task permissions have wizard privileges, raising
-- 'E_PERM' if not. | 282 | checkWizard' :: ObjId -> MOO ()
checkWizard' perm = do
wizard <- isWizard perm
unless wizard $ raise E_PERM
-- | Verify that the current task permissions have wizard privileges, raising
-- 'E_PERM' if not. | 210 | checkWizard' perm = do
wizard <- isWizard perm
unless wizard $ raise E_PERM
-- | Verify that the current task permissions have wizard privileges, raising
-- 'E_PERM' if not. | 178 | true | true | 0 | 8 | 53 | 49 | 23 | 26 | null | null |
JohnLato/iteratee | src/Data/Iteratee/Base.hs | bsd-3-clause | -- | Create an iteratee from a pure continuation
icontP :: Monad m => (Stream s -> (ContReturn s m a)) -> Iteratee s m a
icontP k = Iteratee $ \_ onCont _ -> onCont (return . k) | 177 | icontP :: Monad m => (Stream s -> (ContReturn s m a)) -> Iteratee s m a
icontP k = Iteratee $ \_ onCont _ -> onCont (return . k) | 128 | icontP k = Iteratee $ \_ onCont _ -> onCont (return . k) | 56 | true | true | 0 | 10 | 38 | 76 | 38 | 38 | null | null |
sopvop/cabal | cabal-install/Distribution/Client/ProjectConfig/Legacy.hs | bsd-3-clause | convertLegacyProjectConfig :: LegacyProjectConfig -> ProjectConfig
convertLegacyProjectConfig
LegacyProjectConfig {
legacyPackages,
legacyPackagesOptional,
legacyPackagesRepo,
legacyPackagesNamed,
legacySharedConfig = LegacySharedConfig globalFlags configShFlags
configExFlags installSharedFlags,
legacyLocalConfig = LegacyPackageConfig configFlags installPerPkgFlags
haddockFlags,
legacySpecificConfig
} =
ProjectConfig {
projectPackages = legacyPackages,
projectPackagesOptional = legacyPackagesOptional,
projectPackagesRepo = legacyPackagesRepo,
projectPackagesNamed = legacyPackagesNamed,
projectConfigBuildOnly = configBuildOnly,
projectConfigShared = configAllPackages,
projectConfigLocalPackages = configLocalPackages,
projectConfigSpecificPackage = fmap perPackage legacySpecificConfig
}
where
configLocalPackages = convertLegacyPerPackageFlags
configFlags installPerPkgFlags haddockFlags
configAllPackages = convertLegacyAllPackageFlags
globalFlags (configFlags <> configShFlags)
configExFlags installSharedFlags
configBuildOnly = convertLegacyBuildOnlyFlags
globalFlags configShFlags
installSharedFlags haddockFlags
perPackage (LegacyPackageConfig perPkgConfigFlags perPkgInstallFlags
perPkgHaddockFlags) =
convertLegacyPerPackageFlags
perPkgConfigFlags perPkgInstallFlags perPkgHaddockFlags
-- | Helper used by other conversion functions that returns the
-- 'ProjectConfigShared' subset of the 'ProjectConfig'.
-- | 1,873 | convertLegacyProjectConfig :: LegacyProjectConfig -> ProjectConfig
convertLegacyProjectConfig
LegacyProjectConfig {
legacyPackages,
legacyPackagesOptional,
legacyPackagesRepo,
legacyPackagesNamed,
legacySharedConfig = LegacySharedConfig globalFlags configShFlags
configExFlags installSharedFlags,
legacyLocalConfig = LegacyPackageConfig configFlags installPerPkgFlags
haddockFlags,
legacySpecificConfig
} =
ProjectConfig {
projectPackages = legacyPackages,
projectPackagesOptional = legacyPackagesOptional,
projectPackagesRepo = legacyPackagesRepo,
projectPackagesNamed = legacyPackagesNamed,
projectConfigBuildOnly = configBuildOnly,
projectConfigShared = configAllPackages,
projectConfigLocalPackages = configLocalPackages,
projectConfigSpecificPackage = fmap perPackage legacySpecificConfig
}
where
configLocalPackages = convertLegacyPerPackageFlags
configFlags installPerPkgFlags haddockFlags
configAllPackages = convertLegacyAllPackageFlags
globalFlags (configFlags <> configShFlags)
configExFlags installSharedFlags
configBuildOnly = convertLegacyBuildOnlyFlags
globalFlags configShFlags
installSharedFlags haddockFlags
perPackage (LegacyPackageConfig perPkgConfigFlags perPkgInstallFlags
perPkgHaddockFlags) =
convertLegacyPerPackageFlags
perPkgConfigFlags perPkgInstallFlags perPkgHaddockFlags
-- | Helper used by other conversion functions that returns the
-- 'ProjectConfigShared' subset of the 'ProjectConfig'.
-- | 1,873 | convertLegacyProjectConfig
LegacyProjectConfig {
legacyPackages,
legacyPackagesOptional,
legacyPackagesRepo,
legacyPackagesNamed,
legacySharedConfig = LegacySharedConfig globalFlags configShFlags
configExFlags installSharedFlags,
legacyLocalConfig = LegacyPackageConfig configFlags installPerPkgFlags
haddockFlags,
legacySpecificConfig
} =
ProjectConfig {
projectPackages = legacyPackages,
projectPackagesOptional = legacyPackagesOptional,
projectPackagesRepo = legacyPackagesRepo,
projectPackagesNamed = legacyPackagesNamed,
projectConfigBuildOnly = configBuildOnly,
projectConfigShared = configAllPackages,
projectConfigLocalPackages = configLocalPackages,
projectConfigSpecificPackage = fmap perPackage legacySpecificConfig
}
where
configLocalPackages = convertLegacyPerPackageFlags
configFlags installPerPkgFlags haddockFlags
configAllPackages = convertLegacyAllPackageFlags
globalFlags (configFlags <> configShFlags)
configExFlags installSharedFlags
configBuildOnly = convertLegacyBuildOnlyFlags
globalFlags configShFlags
installSharedFlags haddockFlags
perPackage (LegacyPackageConfig perPkgConfigFlags perPkgInstallFlags
perPkgHaddockFlags) =
convertLegacyPerPackageFlags
perPkgConfigFlags perPkgInstallFlags perPkgHaddockFlags
-- | Helper used by other conversion functions that returns the
-- 'ProjectConfigShared' subset of the 'ProjectConfig'.
-- | 1,806 | false | true | 0 | 8 | 556 | 198 | 110 | 88 | null | null |
nevrenato/Hets_Fork | PGIP/Server.hs | gpl-2.0 | mkHtmlPage :: FilePath -> [Element] -> IO Response
mkHtmlPage path = return . mkOkResponse . mkHtmlString path | 110 | mkHtmlPage :: FilePath -> [Element] -> IO Response
mkHtmlPage path = return . mkOkResponse . mkHtmlString path | 110 | mkHtmlPage path = return . mkOkResponse . mkHtmlString path | 59 | false | true | 0 | 8 | 16 | 43 | 20 | 23 | null | null |
pgavin/tfp | Types/Data/Num/Ops.hs | bsd-3-clause | isOddT :: x -> IsOdd x
isOddT _ = undefined | 43 | isOddT :: x -> IsOdd x
isOddT _ = undefined | 43 | isOddT _ = undefined | 20 | false | true | 0 | 6 | 9 | 21 | 10 | 11 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT17.hs | gpl-3.0 | (<=) :: Nat -> Nat -> Bool
Z <= _ = True | 44 | (<=) :: Nat -> Nat -> Bool
Z <= _ = True | 44 | Z <= _ = True | 17 | false | true | 0 | 9 | 15 | 32 | 15 | 17 | null | null |
rubik/stack-hpc-coveralls | app/Main.hs | isc | defaultOr :: Arguments -> Option -> IO String -> IO String
defaultOr args opt action = maybe action return $ args `getArg` opt | 126 | defaultOr :: Arguments -> Option -> IO String -> IO String
defaultOr args opt action = maybe action return $ args `getArg` opt | 126 | defaultOr args opt action = maybe action return $ args `getArg` opt | 67 | false | true | 0 | 8 | 22 | 51 | 25 | 26 | null | null |
np/lens | src/Control/Lens/IndexedTraversal.hs | bsd-3-clause | -- | Generalizes 'Data.Traversable.mapAccumR' to an arbitrary 'IndexedTraversal' with access to the index.
--
-- 'imapAccumROf' accumulates state from right to left.
--
-- @'Control.Lens.Traversal.mapAccumROf' l ≡ 'imapAccumROf' l '.' 'const'@
--
-- @
-- 'imapAccumROf' :: 'Control.Lens.IndexedLens.IndexedLens' i s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t)
-- 'imapAccumROf' :: 'IndexedTraversal' i s t a b -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t)
-- @
imapAccumROf :: (Indexed i a (Lazy.State s b) -> s -> Lazy.State s t) -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t)
imapAccumROf l f s0 a = swap (Lazy.runState (withIndex l (\i c -> Lazy.state (\s -> swap (f i s c))) a) s0) | 700 | imapAccumROf :: (Indexed i a (Lazy.State s b) -> s -> Lazy.State s t) -> (i -> s -> a -> (s, b)) -> s -> s -> (s, t)
imapAccumROf l f s0 a = swap (Lazy.runState (withIndex l (\i c -> Lazy.state (\s -> swap (f i s c))) a) s0) | 224 | imapAccumROf l f s0 a = swap (Lazy.runState (withIndex l (\i c -> Lazy.state (\s -> swap (f i s c))) a) s0) | 107 | true | true | 0 | 17 | 143 | 173 | 92 | 81 | null | null |
gergoerdi/brainfuck | language-registermachine/src/Language/Loop/CompileToBrainfuck.hs | bsd-3-clause | at k x = goto k ++ x ++ goto (-k) | 33 | at k x = goto k ++ x ++ goto (-k) | 33 | at k x = goto k ++ x ++ goto (-k) | 33 | false | false | 0 | 8 | 10 | 30 | 14 | 16 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'VU.scanr''
vu_scanr' = VU.scanr' | 37 | vu_scanr' = VU.scanr' | 21 | vu_scanr' = VU.scanr' | 21 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
juretta/course | src/L02/List.hs | bsd-3-clause | maximum (h :| t) = if h > maximum t then h else maximum t | 57 | maximum (h :| t) = if h > maximum t then h else maximum t | 57 | maximum (h :| t) = if h > maximum t then h else maximum t | 57 | false | false | 0 | 7 | 14 | 34 | 17 | 17 | null | null |
ml9951/ghc | compiler/main/DynFlags.hs | bsd-3-clause | trustPackage p = exposePackage p >> -- both trust and distrust also expose a package
upd (\s -> s{ packageFlags = TrustPackage p : packageFlags s }) | 150 | trustPackage p = exposePackage p >> -- both trust and distrust also expose a package
upd (\s -> s{ packageFlags = TrustPackage p : packageFlags s }) | 150 | trustPackage p = exposePackage p >> -- both trust and distrust also expose a package
upd (\s -> s{ packageFlags = TrustPackage p : packageFlags s }) | 150 | false | false | 1 | 11 | 28 | 50 | 23 | 27 | null | null |
rfranek/duckling | Duckling/Time/IT/Rules.hs | bsd-3-clause | ruleYearLatent2 :: Rule
ruleYearLatent2 = Rule
{ name = "year (latent)"
, pattern =
[ Predicate $ isIntegerBetween 2101 10000
]
, prod = \tokens -> case tokens of
(token:_) -> do
v <- getIntValue token
tt . mkLatent $ year v
_ -> Nothing
} | 283 | ruleYearLatent2 :: Rule
ruleYearLatent2 = Rule
{ name = "year (latent)"
, pattern =
[ Predicate $ isIntegerBetween 2101 10000
]
, prod = \tokens -> case tokens of
(token:_) -> do
v <- getIntValue token
tt . mkLatent $ year v
_ -> Nothing
} | 283 | ruleYearLatent2 = Rule
{ name = "year (latent)"
, pattern =
[ Predicate $ isIntegerBetween 2101 10000
]
, prod = \tokens -> case tokens of
(token:_) -> do
v <- getIntValue token
tt . mkLatent $ year v
_ -> Nothing
} | 259 | false | true | 0 | 15 | 89 | 105 | 52 | 53 | null | null |
eckyputrady/haskell-scotty-realworld-example-app | src/Feature/Comment/PG.hs | mit | findComments :: PG r m => Maybe UserId -> Slug -> Maybe CommentId -> m [Comment]
findComments mayUserId slug mayCommentId =
withConn $ \conn -> query conn qry arg
where
qry = [sql|
with profiles as (
select
id, name, bio, image, exists(select 1 from followings where user_id = id and followed_by = ?) as following
from
users
), formatted_comments as (
select
c.article_id, c.id, c.created_at, c.updated_at, c.body,
p.name as pname, p.bio as pbio, p.image as pimage, p.following as pfollowing
from
comments c join profiles p on p.id = c.author_id
)
select
c.id, c.created_at, c.updated_at, c.body,
cast (c.pname as text), c.pbio, c.pimage, c.pfollowing
from
formatted_comments c join articles a on c.article_id = a.id
where
a.slug = ? and
coalesce(c.id = ?, true)
|]
arg = (mayUserId, slug, mayCommentId) | 1,103 | findComments :: PG r m => Maybe UserId -> Slug -> Maybe CommentId -> m [Comment]
findComments mayUserId slug mayCommentId =
withConn $ \conn -> query conn qry arg
where
qry = [sql|
with profiles as (
select
id, name, bio, image, exists(select 1 from followings where user_id = id and followed_by = ?) as following
from
users
), formatted_comments as (
select
c.article_id, c.id, c.created_at, c.updated_at, c.body,
p.name as pname, p.bio as pbio, p.image as pimage, p.following as pfollowing
from
comments c join profiles p on p.id = c.author_id
)
select
c.id, c.created_at, c.updated_at, c.body,
cast (c.pname as text), c.pbio, c.pimage, c.pfollowing
from
formatted_comments c join articles a on c.article_id = a.id
where
a.slug = ? and
coalesce(c.id = ?, true)
|]
arg = (mayUserId, slug, mayCommentId) | 1,103 | findComments mayUserId slug mayCommentId =
withConn $ \conn -> query conn qry arg
where
qry = [sql|
with profiles as (
select
id, name, bio, image, exists(select 1 from followings where user_id = id and followed_by = ?) as following
from
users
), formatted_comments as (
select
c.article_id, c.id, c.created_at, c.updated_at, c.body,
p.name as pname, p.bio as pbio, p.image as pimage, p.following as pfollowing
from
comments c join profiles p on p.id = c.author_id
)
select
c.id, c.created_at, c.updated_at, c.body,
cast (c.pname as text), c.pbio, c.pimage, c.pfollowing
from
formatted_comments c join articles a on c.article_id = a.id
where
a.slug = ? and
coalesce(c.id = ?, true)
|]
arg = (mayUserId, slug, mayCommentId) | 1,022 | false | true | 0 | 10 | 427 | 93 | 49 | 44 | null | null |
silkapp/xmlhtml-xpath | src/Xml/XPath/Evaluator.hs | bsd-3-clause | axisName DescendantOrSelf = arr NodeValue . deep id | 51 | axisName DescendantOrSelf = arr NodeValue . deep id | 51 | axisName DescendantOrSelf = arr NodeValue . deep id | 51 | false | false | 0 | 6 | 7 | 20 | 8 | 12 | null | null |
vigoos/Farrago-OS | aura-master/aura-master/src/Aura/Install.hs | gpl-2.0 | depsToInstall :: Repository -> [Buildable] -> Aura [Package]
depsToInstall repo = mapM packageBuildable >=> resolveDeps repo | 124 | depsToInstall :: Repository -> [Buildable] -> Aura [Package]
depsToInstall repo = mapM packageBuildable >=> resolveDeps repo | 124 | depsToInstall repo = mapM packageBuildable >=> resolveDeps repo | 63 | false | true | 0 | 9 | 15 | 45 | 21 | 24 | null | null |
mooreniemi/pfpl | src/Static/Checker.hs | mit | check :: TypeEnv -> EExp -> Either String EType
check typeEnv expression = case expression of
-- 4.1a
EId stringId -> case Map.lookup stringId typeEnv of
Just typeValue -> Right typeValue
Nothing -> Left [i|No match in Type Environment found for: #{stringId}|]
-- 4.1b
EStr _ -> Right TStr
-- 4.1c
ENum _ -> Right TNum
-- 4.1d
EAdd expr1 expr2 -> do
_ <- confirmType TNum expr1
confirmType TNum expr2
-- 4.1e
EMult expr1 expr2 -> do
_ <- confirmType TNum expr1
confirmType TNum expr2
-- 4.1f
ECat expr1 expr2 -> do
_ <- confirmType TStr expr1
confirmType TStr expr2
-- 4.1g
ELen (EStr _) -> Right TNum
ELen expr@(EId stringId) -> let typeOfExpr = check typeEnv expr
in case typeOfExpr of
Right TStr -> Right TNum
e -> Left [i|Can only take length of strings, #{e} was not EStr|]
-- 4.1h
EDef expr1 stringId expr2 ->
case check typeEnv expr1 of
Right typeOfExpr1 -> let typeEnv' = Map.insert stringId typeOfExpr1 typeEnv
in check typeEnv' expr2
Left e -> Left e
e -> Left [i|Failed to match any patterns with: #{e}|]
where
confirmType :: EType -> EExp -> Either String EType
confirmType desiredType expr = do
typeOfExpr <- check typeEnv expr
when (typeOfExpr /= desiredType) $
Left [i|#{expression} expected #{expr} to be #{desiredType}, but was #{typeOfExpr}.|]
return typeOfExpr | 1,526 | check :: TypeEnv -> EExp -> Either String EType
check typeEnv expression = case expression of
-- 4.1a
EId stringId -> case Map.lookup stringId typeEnv of
Just typeValue -> Right typeValue
Nothing -> Left [i|No match in Type Environment found for: #{stringId}|]
-- 4.1b
EStr _ -> Right TStr
-- 4.1c
ENum _ -> Right TNum
-- 4.1d
EAdd expr1 expr2 -> do
_ <- confirmType TNum expr1
confirmType TNum expr2
-- 4.1e
EMult expr1 expr2 -> do
_ <- confirmType TNum expr1
confirmType TNum expr2
-- 4.1f
ECat expr1 expr2 -> do
_ <- confirmType TStr expr1
confirmType TStr expr2
-- 4.1g
ELen (EStr _) -> Right TNum
ELen expr@(EId stringId) -> let typeOfExpr = check typeEnv expr
in case typeOfExpr of
Right TStr -> Right TNum
e -> Left [i|Can only take length of strings, #{e} was not EStr|]
-- 4.1h
EDef expr1 stringId expr2 ->
case check typeEnv expr1 of
Right typeOfExpr1 -> let typeEnv' = Map.insert stringId typeOfExpr1 typeEnv
in check typeEnv' expr2
Left e -> Left e
e -> Left [i|Failed to match any patterns with: #{e}|]
where
confirmType :: EType -> EExp -> Either String EType
confirmType desiredType expr = do
typeOfExpr <- check typeEnv expr
when (typeOfExpr /= desiredType) $
Left [i|#{expression} expected #{expr} to be #{desiredType}, but was #{typeOfExpr}.|]
return typeOfExpr | 1,526 | check typeEnv expression = case expression of
-- 4.1a
EId stringId -> case Map.lookup stringId typeEnv of
Just typeValue -> Right typeValue
Nothing -> Left [i|No match in Type Environment found for: #{stringId}|]
-- 4.1b
EStr _ -> Right TStr
-- 4.1c
ENum _ -> Right TNum
-- 4.1d
EAdd expr1 expr2 -> do
_ <- confirmType TNum expr1
confirmType TNum expr2
-- 4.1e
EMult expr1 expr2 -> do
_ <- confirmType TNum expr1
confirmType TNum expr2
-- 4.1f
ECat expr1 expr2 -> do
_ <- confirmType TStr expr1
confirmType TStr expr2
-- 4.1g
ELen (EStr _) -> Right TNum
ELen expr@(EId stringId) -> let typeOfExpr = check typeEnv expr
in case typeOfExpr of
Right TStr -> Right TNum
e -> Left [i|Can only take length of strings, #{e} was not EStr|]
-- 4.1h
EDef expr1 stringId expr2 ->
case check typeEnv expr1 of
Right typeOfExpr1 -> let typeEnv' = Map.insert stringId typeOfExpr1 typeEnv
in check typeEnv' expr2
Left e -> Left e
e -> Left [i|Failed to match any patterns with: #{e}|]
where
confirmType :: EType -> EExp -> Either String EType
confirmType desiredType expr = do
typeOfExpr <- check typeEnv expr
when (typeOfExpr /= desiredType) $
Left [i|#{expression} expected #{expr} to be #{desiredType}, but was #{typeOfExpr}.|]
return typeOfExpr | 1,478 | false | true | 0 | 16 | 465 | 443 | 208 | 235 | null | null |
typelead/epm | epm/Distribution/Client/Utils.hs | bsd-3-clause | determineNumJobs' :: Flag (Maybe Int) -> Int
determineNumJobs' numJobsFlag =
case numJobsFlag of
NoFlag -> 1
Flag Nothing -> 1
Flag (Just n) -> n
-- | Given a relative path, make it absolute relative to the current
-- directory. Absolute paths are returned unmodified. | 291 | determineNumJobs' :: Flag (Maybe Int) -> Int
determineNumJobs' numJobsFlag =
case numJobsFlag of
NoFlag -> 1
Flag Nothing -> 1
Flag (Just n) -> n
-- | Given a relative path, make it absolute relative to the current
-- directory. Absolute paths are returned unmodified. | 291 | determineNumJobs' numJobsFlag =
case numJobsFlag of
NoFlag -> 1
Flag Nothing -> 1
Flag (Just n) -> n
-- | Given a relative path, make it absolute relative to the current
-- directory. Absolute paths are returned unmodified. | 246 | false | true | 0 | 10 | 67 | 63 | 31 | 32 | null | null |
conal/hermit | src/HERMIT/Core.hs | bsd-2-clause | -- | Find all free variables in a recursive definition, which excludes the bound variable.
freeVarsDef :: CoreDef -> VarSet
freeVarsDef (Def v e) = delVarSet (freeVarsExpr e) v `unionVarSet` freeVarsVar v | 204 | freeVarsDef :: CoreDef -> VarSet
freeVarsDef (Def v e) = delVarSet (freeVarsExpr e) v `unionVarSet` freeVarsVar v | 113 | freeVarsDef (Def v e) = delVarSet (freeVarsExpr e) v `unionVarSet` freeVarsVar v | 80 | true | true | 0 | 9 | 31 | 52 | 25 | 27 | null | null |
cchalmers/geometry | src/Geometry/ThreeD/Transform.hs | bsd-3-clause | q2e :: RealFloat n => Quaternion n -> Euler n
q2e (Quaternion qw (V3 qx qy qz)) = Euler y p r
where
t0 = 2*(qw*qy + qz*qx)
t1 = 1 - 2*(qx*qx + qy*qy)
t2 = 2*(qw*qx - qz*qy)
t3 = 2*(qw*qz + qx*qy)
t4 = 1 - 2*(qz*qz + qx*qx)
-- account for floating point errors
t2' | t2 > 1 = 1
| t2 < -1 = -1
| otherwise = t2
--
y = atan2A t0 t1
p = asinA t2'
r = atan2A t3 t4
| 440 | q2e :: RealFloat n => Quaternion n -> Euler n
q2e (Quaternion qw (V3 qx qy qz)) = Euler y p r
where
t0 = 2*(qw*qy + qz*qx)
t1 = 1 - 2*(qx*qx + qy*qy)
t2 = 2*(qw*qx - qz*qy)
t3 = 2*(qw*qz + qx*qy)
t4 = 1 - 2*(qz*qz + qx*qx)
-- account for floating point errors
t2' | t2 > 1 = 1
| t2 < -1 = -1
| otherwise = t2
--
y = atan2A t0 t1
p = asinA t2'
r = atan2A t3 t4
| 440 | q2e (Quaternion qw (V3 qx qy qz)) = Euler y p r
where
t0 = 2*(qw*qy + qz*qx)
t1 = 1 - 2*(qx*qx + qy*qy)
t2 = 2*(qw*qx - qz*qy)
t3 = 2*(qw*qz + qx*qy)
t4 = 1 - 2*(qz*qz + qx*qx)
-- account for floating point errors
t2' | t2 > 1 = 1
| t2 < -1 = -1
| otherwise = t2
--
y = atan2A t0 t1
p = asinA t2'
r = atan2A t3 t4
| 394 | false | true | 11 | 12 | 170 | 305 | 137 | 168 | null | null |
fmapfmapfmap/amazonka | amazonka-route53/gen/Network/AWS/Route53/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'HostedZone' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'hzConfig'
--
-- * 'hzResourceRecordSetCount'
--
-- * 'hzId'
--
-- * 'hzName'
--
-- * 'hzCallerReference'
hostedZone
:: Text -- ^ 'hzId'
-> Text -- ^ 'hzName'
-> Text -- ^ 'hzCallerReference'
-> HostedZone
hostedZone pId_ pName_ pCallerReference_ =
HostedZone'
{ _hzConfig = Nothing
, _hzResourceRecordSetCount = Nothing
, _hzId = pId_
, _hzName = pName_
, _hzCallerReference = pCallerReference_
} | 611 | hostedZone
:: Text -- ^ 'hzId'
-> Text -- ^ 'hzName'
-> Text -- ^ 'hzCallerReference'
-> HostedZone
hostedZone pId_ pName_ pCallerReference_ =
HostedZone'
{ _hzConfig = Nothing
, _hzResourceRecordSetCount = Nothing
, _hzId = pId_
, _hzName = pName_
, _hzCallerReference = pCallerReference_
} | 335 | hostedZone pId_ pName_ pCallerReference_ =
HostedZone'
{ _hzConfig = Nothing
, _hzResourceRecordSetCount = Nothing
, _hzId = pId_
, _hzName = pName_
, _hzCallerReference = pCallerReference_
} | 219 | true | true | 0 | 7 | 138 | 78 | 52 | 26 | null | null |
oshyshko/adventofcode | src/Y21/D14.hs | bsd-3-clause | -- NNCB
--
-- CH -> B
-- HH -> N
--
polyAndRules :: Parser (Poly, [Replacement])
polyAndRules =
(,) <$> poly <* eol <* eol
<*> rule `endBy` eol
where
poly = many1 letter
rule = (\a b -> Replacement (Pair a b))
<$> letter <*> letter
<* string " -> "
<*> letter | 305 | polyAndRules :: Parser (Poly, [Replacement])
polyAndRules =
(,) <$> poly <* eol <* eol
<*> rule `endBy` eol
where
poly = many1 letter
rule = (\a b -> Replacement (Pair a b))
<$> letter <*> letter
<* string " -> "
<*> letter | 269 | polyAndRules =
(,) <$> poly <* eol <* eol
<*> rule `endBy` eol
where
poly = many1 letter
rule = (\a b -> Replacement (Pair a b))
<$> letter <*> letter
<* string " -> "
<*> letter | 224 | true | true | 0 | 13 | 100 | 109 | 60 | 49 | null | null |
phaazon/vector | Data/Vector/Mutable.hs | bsd-3-clause | clone = G.clone | 15 | clone = G.clone | 15 | clone = G.clone | 15 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
kadena-io/pact | src/Pact/Native/Capabilities.hs | bsd-3-clause | installCapability :: NativeDef
installCapability =
defNative "install-capability" installCapability'
(funType tTyString
[("capability",TyFun $ funType' tTyBool [])
])
[LitExample "(install-capability (PAY \"alice\" \"bob\" 10.0))"]
"Specifies, and provisions install of, a _managed_ CAPABILITY, defined in a 'defcap' \
\in which a '@managed' tag designates a single parameter to be managed by a specified function. \
\After install, CAPABILITY must still be brought into scope using 'with-capability', at which time \
\the 'manager function' is invoked to validate the request. \
\The manager function is of type \
\'managed:<p> requested:<p> -> <p>', \
\where '<p>' indicates the type of the managed parameter, such that for \
\'(defcap FOO (bar:string baz:integer) @managed baz FOO-mgr ...)', \
\the manager function would be '(defun FOO-mgr:integer (managed:integer requested:integer) ...)'. \
\Any capability matching the 'static' (non-managed) parameters will cause this function to \
\be invoked with the current managed value and that of the requested capability. \
\The function should perform whatever logic, presumably linear, to validate the request, \
\and return the new managed value representing the 'balance' of the request. \
\NOTE that signatures scoped to a managed capability cause the capability to be automatically \
\provisioned for install similarly to one installed with this function."
where
installCapability' i as = case as of
[TApp cap _] -> gasUnreduced i [] $ do
enforceNotWithinDefcap i "install-capability"
(ucap,_,_) <- appToCap cap
-- note that this doesn't actually "install" but instead
-- collects as "autonomous", as opposed to sig-provisioned caps.
evalCapabilities . capAutonomous %= S.insert ucap
return $ tStr $ "Installed capability"
_ -> argsError' i as
-- | Given cap app, enforce in-module call, eval args to form capability,
-- and attempt to acquire. Return capability if newly-granted. When
-- 'inModule' is 'True', natives can only be invoked within module code. | 2,129 | installCapability :: NativeDef
installCapability =
defNative "install-capability" installCapability'
(funType tTyString
[("capability",TyFun $ funType' tTyBool [])
])
[LitExample "(install-capability (PAY \"alice\" \"bob\" 10.0))"]
"Specifies, and provisions install of, a _managed_ CAPABILITY, defined in a 'defcap' \
\in which a '@managed' tag designates a single parameter to be managed by a specified function. \
\After install, CAPABILITY must still be brought into scope using 'with-capability', at which time \
\the 'manager function' is invoked to validate the request. \
\The manager function is of type \
\'managed:<p> requested:<p> -> <p>', \
\where '<p>' indicates the type of the managed parameter, such that for \
\'(defcap FOO (bar:string baz:integer) @managed baz FOO-mgr ...)', \
\the manager function would be '(defun FOO-mgr:integer (managed:integer requested:integer) ...)'. \
\Any capability matching the 'static' (non-managed) parameters will cause this function to \
\be invoked with the current managed value and that of the requested capability. \
\The function should perform whatever logic, presumably linear, to validate the request, \
\and return the new managed value representing the 'balance' of the request. \
\NOTE that signatures scoped to a managed capability cause the capability to be automatically \
\provisioned for install similarly to one installed with this function."
where
installCapability' i as = case as of
[TApp cap _] -> gasUnreduced i [] $ do
enforceNotWithinDefcap i "install-capability"
(ucap,_,_) <- appToCap cap
-- note that this doesn't actually "install" but instead
-- collects as "autonomous", as opposed to sig-provisioned caps.
evalCapabilities . capAutonomous %= S.insert ucap
return $ tStr $ "Installed capability"
_ -> argsError' i as
-- | Given cap app, enforce in-module call, eval args to form capability,
-- and attempt to acquire. Return capability if newly-granted. When
-- 'inModule' is 'True', natives can only be invoked within module code. | 2,129 | installCapability =
defNative "install-capability" installCapability'
(funType tTyString
[("capability",TyFun $ funType' tTyBool [])
])
[LitExample "(install-capability (PAY \"alice\" \"bob\" 10.0))"]
"Specifies, and provisions install of, a _managed_ CAPABILITY, defined in a 'defcap' \
\in which a '@managed' tag designates a single parameter to be managed by a specified function. \
\After install, CAPABILITY must still be brought into scope using 'with-capability', at which time \
\the 'manager function' is invoked to validate the request. \
\The manager function is of type \
\'managed:<p> requested:<p> -> <p>', \
\where '<p>' indicates the type of the managed parameter, such that for \
\'(defcap FOO (bar:string baz:integer) @managed baz FOO-mgr ...)', \
\the manager function would be '(defun FOO-mgr:integer (managed:integer requested:integer) ...)'. \
\Any capability matching the 'static' (non-managed) parameters will cause this function to \
\be invoked with the current managed value and that of the requested capability. \
\The function should perform whatever logic, presumably linear, to validate the request, \
\and return the new managed value representing the 'balance' of the request. \
\NOTE that signatures scoped to a managed capability cause the capability to be automatically \
\provisioned for install similarly to one installed with this function."
where
installCapability' i as = case as of
[TApp cap _] -> gasUnreduced i [] $ do
enforceNotWithinDefcap i "install-capability"
(ucap,_,_) <- appToCap cap
-- note that this doesn't actually "install" but instead
-- collects as "autonomous", as opposed to sig-provisioned caps.
evalCapabilities . capAutonomous %= S.insert ucap
return $ tStr $ "Installed capability"
_ -> argsError' i as
-- | Given cap app, enforce in-module call, eval args to form capability,
-- and attempt to acquire. Return capability if newly-granted. When
-- 'inModule' is 'True', natives can only be invoked within module code. | 2,098 | false | true | 1 | 13 | 409 | 182 | 85 | 97 | null | null |
SimSaladin/ggtd | src/GGTD/CLI/Render.hs | bsd-3-clause | -- | Like @renderThingyLine@, but for a flat rendering.
renderThingyLineFlat
:: UTCTime
-> Maybe String -- ^ Some extra stuff to be shown in brackets
-> Node
-> Thingy
-> P.Doc
renderThingyLineFlat now mextra node Thingy{..} =
let color = if Map.member Wait _flags then P.green else id
in renderNode node
P.<+> color (renderContent _content)
P.<+> (maybe P.empty (P.yellow . P.brackets . P.dullyellow . P.text) mextra)
P.<+> (if Map.null _flags then P.empty else P.tupled $ map render $ Map.keys _flags)
P.<+> render (now, _created) | 592 | renderThingyLineFlat
:: UTCTime
-> Maybe String -- ^ Some extra stuff to be shown in brackets
-> Node
-> Thingy
-> P.Doc
renderThingyLineFlat now mextra node Thingy{..} =
let color = if Map.member Wait _flags then P.green else id
in renderNode node
P.<+> color (renderContent _content)
P.<+> (maybe P.empty (P.yellow . P.brackets . P.dullyellow . P.text) mextra)
P.<+> (if Map.null _flags then P.empty else P.tupled $ map render $ Map.keys _flags)
P.<+> render (now, _created) | 536 | renderThingyLineFlat now mextra node Thingy{..} =
let color = if Map.member Wait _flags then P.green else id
in renderNode node
P.<+> color (renderContent _content)
P.<+> (maybe P.empty (P.yellow . P.brackets . P.dullyellow . P.text) mextra)
P.<+> (if Map.null _flags then P.empty else P.tupled $ map render $ Map.keys _flags)
P.<+> render (now, _created) | 395 | true | true | 0 | 16 | 143 | 193 | 97 | 96 | null | null |
rbonifacio/funsat | tests/Properties.hs | bsd-3-clause | prop_noneIsFalseUnderA (m :: IAssignment) =
not $ anyA (\i -> if i /= 0 then L i `isFalseUnder` m else False) m | 115 | prop_noneIsFalseUnderA (m :: IAssignment) =
not $ anyA (\i -> if i /= 0 then L i `isFalseUnder` m else False) m | 115 | prop_noneIsFalseUnderA (m :: IAssignment) =
not $ anyA (\i -> if i /= 0 then L i `isFalseUnder` m else False) m | 115 | false | false | 0 | 11 | 25 | 54 | 29 | 25 | null | null |
brendanhay/gogol | gogol-tagmanager/gen/Network/Google/TagManager/Types/Product.hs | mpl-2.0 | -- | A visibility trigger maximum percent visibility. Only valid for AMP
-- Visibility trigger. \'mutable
-- tagmanager.accounts.containers.workspaces.triggers.create \'mutable
-- tagmanager.accounts.containers.workspaces.triggers.update
triVisiblePercentageMax :: Lens' Trigger (Maybe Parameter)
triVisiblePercentageMax
= lens _triVisiblePercentageMax
(\ s a -> s{_triVisiblePercentageMax = a}) | 403 | triVisiblePercentageMax :: Lens' Trigger (Maybe Parameter)
triVisiblePercentageMax
= lens _triVisiblePercentageMax
(\ s a -> s{_triVisiblePercentageMax = a}) | 165 | triVisiblePercentageMax
= lens _triVisiblePercentageMax
(\ s a -> s{_triVisiblePercentageMax = a}) | 106 | true | true | 0 | 8 | 45 | 52 | 28 | 24 | null | null |
adamwalker/haskell_cudd | Cudd/Imperative.hs | bsd-3-clause | readPeakNodeCount :: DDManager s u -> ST s Integer
readPeakNodeCount (DDManager m) = liftM fromIntegral $ unsafeIOToST $ c_cuddReadPeakNodeCount m | 146 | readPeakNodeCount :: DDManager s u -> ST s Integer
readPeakNodeCount (DDManager m) = liftM fromIntegral $ unsafeIOToST $ c_cuddReadPeakNodeCount m | 146 | readPeakNodeCount (DDManager m) = liftM fromIntegral $ unsafeIOToST $ c_cuddReadPeakNodeCount m | 95 | false | true | 0 | 7 | 19 | 48 | 22 | 26 | null | null |
Bodigrim/arithmoi | Math/NumberTheory/Utils/FromIntegral.hs | mit | integerToNatural :: Integer -> Natural
integerToNatural = fromIntegral' | 71 | integerToNatural :: Integer -> Natural
integerToNatural = fromIntegral' | 71 | integerToNatural = fromIntegral' | 32 | false | true | 0 | 5 | 7 | 15 | 8 | 7 | null | null |
uuhan/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reflectErasure :: RErasure -> Raw
reflectErasure RErased = Var (tacN "Erased") | 81 | reflectErasure :: RErasure -> Raw
reflectErasure RErased = Var (tacN "Erased") | 81 | reflectErasure RErased = Var (tacN "Erased") | 47 | false | true | 0 | 7 | 13 | 27 | 13 | 14 | null | null |
benkolera/haskell-ldap-classy | LDAP/Classy/Decode.hs | mit | requireNel _ _ (x:xs) = pure (x :| xs) | 38 | requireNel _ _ (x:xs) = pure (x :| xs) | 38 | requireNel _ _ (x:xs) = pure (x :| xs) | 38 | false | false | 0 | 7 | 8 | 30 | 15 | 15 | null | null |
haskell/haddock | haddock-api/src/Haddock/GhcUtils.hs | bsd-2-clause | -- | The parents of a subordinate in a declaration
parents :: Name -> HsDecl GhcRn -> [Name]
parents n (TyClD _ d) = [ p | (c, p) <- parentMap d, c == n ] | 154 | parents :: Name -> HsDecl GhcRn -> [Name]
parents n (TyClD _ d) = [ p | (c, p) <- parentMap d, c == n ] | 103 | parents n (TyClD _ d) = [ p | (c, p) <- parentMap d, c == n ] | 61 | true | true | 0 | 8 | 35 | 67 | 35 | 32 | null | null |
wavewave/lhc-analysis-collection | lib/HEP/Physics/Analysis/ATLAS/Exotic/Leptoquark.hs | gpl-3.0 | findMT :: EvJJEv -> Double
findMT EvJJEv {..} =
let (_,e1) = evjj_e1
(metphi,metpt) = (phiptmet . met) evjj_rev
ptmet = (metpt*cos metphi, metpt*sin metphi)
pte = (pt e1 * cos (phi e1), pt e1 * sin (phi e1))
in mt pte ptmet | 251 | findMT :: EvJJEv -> Double
findMT EvJJEv {..} =
let (_,e1) = evjj_e1
(metphi,metpt) = (phiptmet . met) evjj_rev
ptmet = (metpt*cos metphi, metpt*sin metphi)
pte = (pt e1 * cos (phi e1), pt e1 * sin (phi e1))
in mt pte ptmet | 250 | findMT EvJJEv {..} =
let (_,e1) = evjj_e1
(metphi,metpt) = (phiptmet . met) evjj_rev
ptmet = (metpt*cos metphi, metpt*sin metphi)
pte = (pt e1 * cos (phi e1), pt e1 * sin (phi e1))
in mt pte ptmet | 223 | false | true | 6 | 9 | 70 | 133 | 70 | 63 | null | null |
brendanhay/gogol | gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs | mpl-2.0 | -- | Adjustment for total tax of the line item.
oliaTaxAdjustment :: Lens' OrderLineItemAdjustment (Maybe Price)
oliaTaxAdjustment
= lens _oliaTaxAdjustment
(\ s a -> s{_oliaTaxAdjustment = a}) | 201 | oliaTaxAdjustment :: Lens' OrderLineItemAdjustment (Maybe Price)
oliaTaxAdjustment
= lens _oliaTaxAdjustment
(\ s a -> s{_oliaTaxAdjustment = a}) | 153 | oliaTaxAdjustment
= lens _oliaTaxAdjustment
(\ s a -> s{_oliaTaxAdjustment = a}) | 88 | true | true | 0 | 9 | 34 | 48 | 25 | 23 | null | null |
gilith/hol | src/HOL/TermData.hs | mit | destApp _ = Nothing | 19 | destApp _ = Nothing | 19 | destApp _ = Nothing | 19 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
ivanmoore/seedy | lib/Pelias.hs | gpl-3.0 | reduceString :: (String -> Token) -> String -> [Token] -> Token
reduceString tokenType initialAcc subsequentTokens = tokenType (foldl accumulateString initialAcc subsequentTokens) | 179 | reduceString :: (String -> Token) -> String -> [Token] -> Token
reduceString tokenType initialAcc subsequentTokens = tokenType (foldl accumulateString initialAcc subsequentTokens) | 179 | reduceString tokenType initialAcc subsequentTokens = tokenType (foldl accumulateString initialAcc subsequentTokens) | 115 | false | true | 0 | 8 | 20 | 58 | 28 | 30 | null | null |
GaloisInc/delicious | Network/Delicious/RSS.hs | bsd-3-clause | getUserInboxBookmarks :: String -> String -> DM [Post]
getUserInboxBookmarks u key = performCall "getUserInboxBookmarks" eff_url
where
eff_url = inbox_url ++ u ++ "?private="++key | 182 | getUserInboxBookmarks :: String -> String -> DM [Post]
getUserInboxBookmarks u key = performCall "getUserInboxBookmarks" eff_url
where
eff_url = inbox_url ++ u ++ "?private="++key | 182 | getUserInboxBookmarks u key = performCall "getUserInboxBookmarks" eff_url
where
eff_url = inbox_url ++ u ++ "?private="++key | 127 | false | true | 0 | 8 | 25 | 55 | 27 | 28 | null | null |
janrain/snap-server | test/suite/Data/Concurrent/HashMap/Tests.hs | bsd-3-clause | bogoHash x = H.hashBS x | 23 | bogoHash x = H.hashBS x | 23 | bogoHash x = H.hashBS x | 23 | false | false | 0 | 6 | 4 | 14 | 6 | 8 | null | null |
osa1/Idris-dev | src/Idris/Core/ProofState.hs | bsd-3-clause | updateNotunified ns nu = up nu where
up [] = []
up ((n, t) : nus) = let t' = updateSolvedTerm ns t in
((n, t') : up nus) | 150 | updateNotunified ns nu = up nu where
up [] = []
up ((n, t) : nus) = let t' = updateSolvedTerm ns t in
((n, t') : up nus) | 150 | updateNotunified ns nu = up nu where
up [] = []
up ((n, t) : nus) = let t' = updateSolvedTerm ns t in
((n, t') : up nus) | 150 | false | false | 1 | 10 | 58 | 85 | 41 | 44 | null | null |
travitch/foreign-inference | src/Foreign/Inference/Analysis/ErrorHandling/Features.hs | bsd-3-clause | calleeNotError :: Bool -> Map Value Feature -> Instruction -> Map Value Feature
calleeNotError isComplex m i
| Just cv <- directCallTarget i
, isComplex = M.alter (update (calledInPossibleErrorContext %~ (+1))) cv m
| Just cv <- directCallTarget i
, not isComplex = M.alter (update (calledInNonErrorContext %~ (+1))) cv m
| otherwise = m | 347 | calleeNotError :: Bool -> Map Value Feature -> Instruction -> Map Value Feature
calleeNotError isComplex m i
| Just cv <- directCallTarget i
, isComplex = M.alter (update (calledInPossibleErrorContext %~ (+1))) cv m
| Just cv <- directCallTarget i
, not isComplex = M.alter (update (calledInNonErrorContext %~ (+1))) cv m
| otherwise = m | 347 | calleeNotError isComplex m i
| Just cv <- directCallTarget i
, isComplex = M.alter (update (calledInPossibleErrorContext %~ (+1))) cv m
| Just cv <- directCallTarget i
, not isComplex = M.alter (update (calledInNonErrorContext %~ (+1))) cv m
| otherwise = m | 267 | false | true | 1 | 11 | 63 | 148 | 71 | 77 | null | null |
jfischoff/opengl-eval | src/OpenGL/Evaluator/HaskellOpenGLFunctionsTH.hs | bsd-3-clause | f_to_h :: GLFunction -> [Dec]
f_to_h f@(GLFunction f_name return_value params) = result where
result = [make_error name] ++ (f_to_c f)
name = fn_to_sn f_name | 168 | f_to_h :: GLFunction -> [Dec]
f_to_h f@(GLFunction f_name return_value params) = result where
result = [make_error name] ++ (f_to_c f)
name = fn_to_sn f_name | 168 | f_to_h f@(GLFunction f_name return_value params) = result where
result = [make_error name] ++ (f_to_c f)
name = fn_to_sn f_name | 138 | false | true | 0 | 8 | 34 | 64 | 34 | 30 | null | null |
garykl/Horg | Colors.hs | bsd-3-clause | hexDigits :: Int -> Char
hexDigits = (!!) "0123456789abcdef" | 60 | hexDigits :: Int -> Char
hexDigits = (!!) "0123456789abcdef" | 60 | hexDigits = (!!) "0123456789abcdef" | 35 | false | true | 0 | 5 | 8 | 20 | 11 | 9 | null | null |
yaxu/tidalbot | runpattern.hs | gpl-3.0 | unescapeEntities (x:xs) = x : unescapeEntities xs | 49 | unescapeEntities (x:xs) = x : unescapeEntities xs | 49 | unescapeEntities (x:xs) = x : unescapeEntities xs | 49 | false | false | 0 | 7 | 6 | 23 | 11 | 12 | null | null |
mightymoose/liquidhaskell | benchmarks/bytestring-0.9.2.1/Data/ByteString/Lazy.hs | bsd-3-clause | -- ---------------------------------------------------------------------
-- Unfolds and replicates
-- | @'iterate' f x@ returns an infinite ByteString of repeated applications
-- of @f@ to @x@:
--
-- > iterate f x == [x, f x, f (f x), ...]
--
{-@ iterate :: (Word8 -> Word8) -> Word8 -> ByteString @-}
{-@ Strict Data.ByteString.Lazy.iterate @-}
iterate :: (Word8 -> Word8) -> Word8 -> ByteString
iterate f = unfoldr (\x -> case f x of x' -> x' `seq` Just (x', x')) | 466 | iterate :: (Word8 -> Word8) -> Word8 -> ByteString
iterate f = unfoldr (\x -> case f x of x' -> x' `seq` Just (x', x')) | 119 | iterate f = unfoldr (\x -> case f x of x' -> x' `seq` Just (x', x')) | 68 | true | true | 0 | 13 | 79 | 77 | 45 | 32 | null | null |
capital-match/hdo | src/Network/DO/Droplets/Commands.hs | mit | getAction :: Id -> Id -> DropletCommands (Result (ActionResult DropletActionType))
getAction did actId = GetAction did actId P.id | 129 | getAction :: Id -> Id -> DropletCommands (Result (ActionResult DropletActionType))
getAction did actId = GetAction did actId P.id | 129 | getAction did actId = GetAction did actId P.id | 46 | false | true | 0 | 12 | 17 | 52 | 24 | 28 | null | null |
danr/hipspec | examples/old-examples/quickspec/ProductiveUseOfFailure.hs | gpl-3.0 | _ && _ = False | 14 | _ && _ = False | 14 | _ && _ = False | 14 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
hemio-ev/hamsql | src/Database/HamSql/Internal/Load.hs | gpl-3.0 | catchErrors :: ToJSON a => FilePath -> a -> IO a
catchErrors filePath x = do
y <- try (forceToJson x)
return $
case y of
Left (YamsqlException exc) ->
err $ "In file '" <> tshow filePath <> "': " <> exc
Right _ -> x | 243 | catchErrors :: ToJSON a => FilePath -> a -> IO a
catchErrors filePath x = do
y <- try (forceToJson x)
return $
case y of
Left (YamsqlException exc) ->
err $ "In file '" <> tshow filePath <> "': " <> exc
Right _ -> x | 243 | catchErrors filePath x = do
y <- try (forceToJson x)
return $
case y of
Left (YamsqlException exc) ->
err $ "In file '" <> tshow filePath <> "': " <> exc
Right _ -> x | 194 | false | true | 0 | 15 | 74 | 110 | 49 | 61 | null | null |
savannidgerinel/mead | src/LuminescentDreams/AuthDB.hs | bsd-3-clause | listUsers :: AuthDBM [Username]
listUsers = do
AuthDB_{..} <- ask >>= \(AuthDB _ dbref) -> tryIO $ readIORef dbref
return $ M.keys usermap | 142 | listUsers :: AuthDBM [Username]
listUsers = do
AuthDB_{..} <- ask >>= \(AuthDB _ dbref) -> tryIO $ readIORef dbref
return $ M.keys usermap | 142 | listUsers = do
AuthDB_{..} <- ask >>= \(AuthDB _ dbref) -> tryIO $ readIORef dbref
return $ M.keys usermap | 110 | false | true | 0 | 12 | 26 | 72 | 33 | 39 | null | null |
xu-hao/QueryArrow | QueryArrow-db-filesystem/src/QueryArrow/FileSystem/Commands.hs | bsd-3-clause | fsfindFilesBySize :: Integer -> FSProgram [File]
fsfindFilesBySize n = liftF (FindFilesBySize n id) | 100 | fsfindFilesBySize :: Integer -> FSProgram [File]
fsfindFilesBySize n = liftF (FindFilesBySize n id) | 99 | fsfindFilesBySize n = liftF (FindFilesBySize n id) | 50 | false | true | 0 | 7 | 13 | 35 | 17 | 18 | null | null |
nikita-volkov/stm-containers | library/StmContainers/Map.hs | mit | focus :: (Eq key, Hashable key) => B.Focus value STM result -> key -> Map key value -> STM result
focus valueFocus key (Map hamt) =
A.focus rowFocus (\(Product2 key _) -> key) key hamt
where
rowFocus =
B.mappingInput (\value -> Product2 key value) (\(Product2 _ value) -> value) valueFocus
-- |
-- Look up an item.
| 330 | focus :: (Eq key, Hashable key) => B.Focus value STM result -> key -> Map key value -> STM result
focus valueFocus key (Map hamt) =
A.focus rowFocus (\(Product2 key _) -> key) key hamt
where
rowFocus =
B.mappingInput (\value -> Product2 key value) (\(Product2 _ value) -> value) valueFocus
-- |
-- Look up an item.
| 330 | focus valueFocus key (Map hamt) =
A.focus rowFocus (\(Product2 key _) -> key) key hamt
where
rowFocus =
B.mappingInput (\value -> Product2 key value) (\(Product2 _ value) -> value) valueFocus
-- |
-- Look up an item.
| 232 | false | true | 0 | 9 | 72 | 143 | 73 | 70 | null | null |
ncaq/haskell-import-graph | lib/System/ImportGraph/ModuleCluster.hs | mit | ifaceClusterName :: ModIface -> TL.Text
ifaceClusterName iface = "cluster_" <> ifaceName iface | 94 | ifaceClusterName :: ModIface -> TL.Text
ifaceClusterName iface = "cluster_" <> ifaceName iface | 94 | ifaceClusterName iface = "cluster_" <> ifaceName iface | 54 | false | true | 0 | 6 | 11 | 27 | 13 | 14 | null | null |
mrshannon/trees | src/Input/Mouse.hs | gpl-2.0 | -- Default Tracking configuration.
defaultMouseTracking :: Mouse
defaultMouseTracking = Tracking
{ buttons = defaultButtons
, wheelTicks = 0
, downPosition = Position 0 0
, upPosition = Position 0 0
, position = Position 0 0
, deltaPosition = DeltaPosition 0 0
} | 313 | defaultMouseTracking :: Mouse
defaultMouseTracking = Tracking
{ buttons = defaultButtons
, wheelTicks = 0
, downPosition = Position 0 0
, upPosition = Position 0 0
, position = Position 0 0
, deltaPosition = DeltaPosition 0 0
} | 278 | defaultMouseTracking = Tracking
{ buttons = defaultButtons
, wheelTicks = 0
, downPosition = Position 0 0
, upPosition = Position 0 0
, position = Position 0 0
, deltaPosition = DeltaPosition 0 0
} | 248 | true | true | 0 | 8 | 93 | 74 | 41 | 33 | null | null |
m-lopez/jack | src/CodeGen/LLVM/Graph.hs | mit | startBlock :: CfgGen L.Name
startBlock = do
n <- genBlockName
let b = BlockState n []
modify $ \s -> s { working = b : working s }
return n
-- | Retrieve the name of the current working block. | 201 | startBlock :: CfgGen L.Name
startBlock = do
n <- genBlockName
let b = BlockState n []
modify $ \s -> s { working = b : working s }
return n
-- | Retrieve the name of the current working block. | 201 | startBlock = do
n <- genBlockName
let b = BlockState n []
modify $ \s -> s { working = b : working s }
return n
-- | Retrieve the name of the current working block. | 173 | false | true | 0 | 13 | 49 | 79 | 36 | 43 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/LT_1.hs | mit | esEsOrdering EQ LT = MyFalse | 28 | esEsOrdering EQ LT = MyFalse | 28 | esEsOrdering EQ LT = MyFalse | 28 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
eightyeight/atom-msp430 | Language/Atom/MSP430/Watchdog.hs | mit | -- Divide the timer input by 2^9.
wdtSourceDiv6 = 0x0003 :: Word16 | 69 | wdtSourceDiv6 = 0x0003 :: Word16 | 35 | wdtSourceDiv6 = 0x0003 :: Word16 | 35 | true | false | 0 | 4 | 14 | 10 | 6 | 4 | null | null |
sgf-dma/sgf-xmonad-modules | src/Sgf/XMonad/Restartable.hs | bsd-3-clause | stopP' :: RestartClass a => a -> X a
stopP' = killP <=< refreshPid | 79 | stopP' :: RestartClass a => a -> X a
stopP' = killP <=< refreshPid | 79 | stopP' = killP <=< refreshPid | 42 | false | true | 0 | 7 | 26 | 29 | 14 | 15 | null | null |
rueshyna/gogol | gogol-drive/gen/Network/Google/Drive/Types/Product.hs | mpl-2.0 | -- | The time of this change (RFC 3339 date-time).
chaTime :: Lens' Change (Maybe UTCTime)
chaTime
= lens _chaTime (\ s a -> s{_chaTime = a}) .
mapping _DateTime | 169 | chaTime :: Lens' Change (Maybe UTCTime)
chaTime
= lens _chaTime (\ s a -> s{_chaTime = a}) .
mapping _DateTime | 118 | chaTime
= lens _chaTime (\ s a -> s{_chaTime = a}) .
mapping _DateTime | 78 | true | true | 0 | 10 | 37 | 55 | 28 | 27 | null | null |
szatkus/haste-compiler | libraries/haste-lib/src/Haste/DOM.hs | bsd-3-clause | -- | Map an IO computation over the list of elements matching a query selector.
mapQS :: (IsElem e, MonadIO m)
=> e
-> QuerySelector
-> (Elem -> m a)
-> m [a]
mapQS el = J.mapQS el . toJSStr | 214 | mapQS :: (IsElem e, MonadIO m)
=> e
-> QuerySelector
-> (Elem -> m a)
-> m [a]
mapQS el = J.mapQS el . toJSStr | 134 | mapQS el = J.mapQS el . toJSStr | 31 | true | true | 0 | 11 | 63 | 67 | 34 | 33 | null | null |
rueshyna/gogol | gogol-analytics/gen/Network/Google/Analytics/Types/Product.hs | mpl-2.0 | -- | Internal ID for the web property to which this view (profile) belongs.
rdpfiInternalWebPropertyId :: Lens' RealtimeDataProFileInfo (Maybe Text)
rdpfiInternalWebPropertyId
= lens _rdpfiInternalWebPropertyId
(\ s a -> s{_rdpfiInternalWebPropertyId = a}) | 264 | rdpfiInternalWebPropertyId :: Lens' RealtimeDataProFileInfo (Maybe Text)
rdpfiInternalWebPropertyId
= lens _rdpfiInternalWebPropertyId
(\ s a -> s{_rdpfiInternalWebPropertyId = a}) | 188 | rdpfiInternalWebPropertyId
= lens _rdpfiInternalWebPropertyId
(\ s a -> s{_rdpfiInternalWebPropertyId = a}) | 115 | true | true | 0 | 9 | 38 | 48 | 25 | 23 | null | null |
AlexanderPankiv/ghc | compiler/prelude/THNames.hs | bsd-3-clause | fieldExpTyConKey = mkPreludeTyConUnique 216 | 50 | fieldExpTyConKey = mkPreludeTyConUnique 216 | 50 | fieldExpTyConKey = mkPreludeTyConUnique 216 | 50 | false | false | 1 | 5 | 10 | 12 | 4 | 8 | null | null |
nickbart1980/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | verbatimEnv' :: IncludeParser
verbatimEnv' = fmap snd <$>
withRaw $ try $ do
string "\\begin"
name <- braced'
guard $ name `elem` ["verbatim", "Verbatim", "lstlisting",
"minted", "alltt"]
manyTill anyChar (try $ string $ "\\end{" ++ name ++ "}") | 333 | verbatimEnv' :: IncludeParser
verbatimEnv' = fmap snd <$>
withRaw $ try $ do
string "\\begin"
name <- braced'
guard $ name `elem` ["verbatim", "Verbatim", "lstlisting",
"minted", "alltt"]
manyTill anyChar (try $ string $ "\\end{" ++ name ++ "}") | 333 | verbatimEnv' = fmap snd <$>
withRaw $ try $ do
string "\\begin"
name <- braced'
guard $ name `elem` ["verbatim", "Verbatim", "lstlisting",
"minted", "alltt"]
manyTill anyChar (try $ string $ "\\end{" ++ name ++ "}") | 303 | false | true | 0 | 13 | 125 | 94 | 48 | 46 | null | null |
startling/beetle | test-parser.hs | mit | dictionaries :: Spec
dictionaries = describe "dictionary" $ do
let ?parser = dictionary
it "parses empty dictionaries" $ do
"{}" `parsesTo` []
it "parses singleton dictionaries" $ do
"{a => b}" `parsesTo` [("a", Symbol "b")]
it "parses two-item dictionaries" $ do
"{a => b, c => d}" `parsesTo`
[ ("a", Symbol "b")
, ("c", Symbol "d")
] | 373 | dictionaries :: Spec
dictionaries = describe "dictionary" $ do
let ?parser = dictionary
it "parses empty dictionaries" $ do
"{}" `parsesTo` []
it "parses singleton dictionaries" $ do
"{a => b}" `parsesTo` [("a", Symbol "b")]
it "parses two-item dictionaries" $ do
"{a => b, c => d}" `parsesTo`
[ ("a", Symbol "b")
, ("c", Symbol "d")
] | 373 | dictionaries = describe "dictionary" $ do
let ?parser = dictionary
it "parses empty dictionaries" $ do
"{}" `parsesTo` []
it "parses singleton dictionaries" $ do
"{a => b}" `parsesTo` [("a", Symbol "b")]
it "parses two-item dictionaries" $ do
"{a => b, c => d}" `parsesTo`
[ ("a", Symbol "b")
, ("c", Symbol "d")
] | 352 | false | true | 0 | 15 | 94 | 129 | 63 | 66 | null | null |
Ornedan/dom3statusbot | Protocol.hs | bsd-3-clause | -- | Skip a byte if it's value is in the given list, otherwise error.
skipOneOf :: [Word8] -> Get ()
skipOneOf bs = do
byte <- getWord8
when (not $ byte `elem` bs) $
fail $ printf "skipOneOf: got %d, expected one of %s" byte (show bs)
-- | Write to handle and flush. | 275 | skipOneOf :: [Word8] -> Get ()
skipOneOf bs = do
byte <- getWord8
when (not $ byte `elem` bs) $
fail $ printf "skipOneOf: got %d, expected one of %s" byte (show bs)
-- | Write to handle and flush. | 205 | skipOneOf bs = do
byte <- getWord8
when (not $ byte `elem` bs) $
fail $ printf "skipOneOf: got %d, expected one of %s" byte (show bs)
-- | Write to handle and flush. | 174 | true | true | 0 | 12 | 63 | 75 | 38 | 37 | null | null |
trskop/pkg-version | src/Data/PkgVersion/Internal/RpmVerCmp.hs | bsd-3-clause | -- | @'notTilde' = 'not' '.' 'isTilde'@
notTilde :: Char -> Bool
notTilde = not . isTilde | 89 | notTilde :: Char -> Bool
notTilde = not . isTilde | 49 | notTilde = not . isTilde | 24 | true | true | 1 | 7 | 16 | 28 | 12 | 16 | null | null |
kdungs/coursework-functional-programming | 00/file.hs | mit | addTen :: Int -> Int
addTen x = addFive $ addFive x | 51 | addTen :: Int -> Int
addTen x = addFive $ addFive x | 51 | addTen x = addFive $ addFive x | 30 | false | true | 0 | 6 | 11 | 25 | 12 | 13 | null | null |
bitemyapp/ghc | libraries/base/GHC/Conc/Sync.hs | bsd-3-clause | real_handler :: SomeException -> IO ()
real_handler se
| Just BlockedIndefinitelyOnMVar <- fromException se = return ()
| Just BlockedIndefinitelyOnSTM <- fromException se = return ()
| Just ThreadKilled <- fromException se = return ()
| Just StackOverflow <- fromException se = reportStackOverflow
| otherwise = reportError se | 414 | real_handler :: SomeException -> IO ()
real_handler se
| Just BlockedIndefinitelyOnMVar <- fromException se = return ()
| Just BlockedIndefinitelyOnSTM <- fromException se = return ()
| Just ThreadKilled <- fromException se = return ()
| Just StackOverflow <- fromException se = reportStackOverflow
| otherwise = reportError se | 414 | real_handler se
| Just BlockedIndefinitelyOnMVar <- fromException se = return ()
| Just BlockedIndefinitelyOnSTM <- fromException se = return ()
| Just ThreadKilled <- fromException se = return ()
| Just StackOverflow <- fromException se = reportStackOverflow
| otherwise = reportError se | 375 | false | true | 1 | 9 | 134 | 127 | 55 | 72 | null | null |
taktoa/HsCalculator | src/Parse.hs | gpl-3.0 | desugar PLE [a, b] = ELE a b | 34 | desugar PLE [a, b] = ELE a b | 34 | desugar PLE [a, b] = ELE a b | 34 | false | false | 0 | 6 | 13 | 22 | 11 | 11 | null | null |
tolysz/dsp | DSP/Filter/FIR/PolyInterp.hs | gpl-2.0 | optimal_4p2o16x :: (Ord a, Fractional a) => a -> a
optimal_4p2o16x x | 0 <= x && x < 1 = polyeval [ -0.41849525763976203, 1.36361593203840510,
-0.24506117865474364 ] x
| 1 <= x && x < 2 = polyeval [ 1.90873339502208310, -1.44144384373471430,
0.24506002360805534 ] x
| 2 <= x = 0
| otherwise = optimal_4p2o16x (-x) | 482 | optimal_4p2o16x :: (Ord a, Fractional a) => a -> a
optimal_4p2o16x x | 0 <= x && x < 1 = polyeval [ -0.41849525763976203, 1.36361593203840510,
-0.24506117865474364 ] x
| 1 <= x && x < 2 = polyeval [ 1.90873339502208310, -1.44144384373471430,
0.24506002360805534 ] x
| 2 <= x = 0
| otherwise = optimal_4p2o16x (-x) | 482 | optimal_4p2o16x x | 0 <= x && x < 1 = polyeval [ -0.41849525763976203, 1.36361593203840510,
-0.24506117865474364 ] x
| 1 <= x && x < 2 = polyeval [ 1.90873339502208310, -1.44144384373471430,
0.24506002360805534 ] x
| 2 <= x = 0
| otherwise = optimal_4p2o16x (-x) | 431 | false | true | 0 | 10 | 223 | 136 | 68 | 68 | null | null |
ameingast/slisp | src/SLISP/Data.hs | bsd-3-clause | toLispBool :: Bool -> Expression
toLispBool True = Fixnum 1 | 59 | toLispBool :: Bool -> Expression
toLispBool True = Fixnum 1 | 59 | toLispBool True = Fixnum 1 | 26 | false | true | 0 | 5 | 9 | 21 | 10 | 11 | null | null |
MichaelXavier/Bucketeer | Bucketeer/Testing/WebServer.hs | bsd-2-clause | runSpecs :: Connection
-> IO ()
runSpecs conn = do bmRef <- newIORef =<< newBM
app <- scottyApp $ bucketeerServer $ BucketeerWeb conn bmRef ns
runTests app undefined $ specs conn bmRef | 236 | runSpecs :: Connection
-> IO ()
runSpecs conn = do bmRef <- newIORef =<< newBM
app <- scottyApp $ bucketeerServer $ BucketeerWeb conn bmRef ns
runTests app undefined $ specs conn bmRef | 236 | runSpecs conn = do bmRef <- newIORef =<< newBM
app <- scottyApp $ bucketeerServer $ BucketeerWeb conn bmRef ns
runTests app undefined $ specs conn bmRef | 192 | false | true | 0 | 9 | 83 | 73 | 33 | 40 | null | null |
shlevy/ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | mkHsLams :: [TyVar] -> [EvVar] -> LHsExpr GhcTc -> LHsExpr GhcTc
mkHsLams tyvars dicts expr = mkLHsWrap (mkWpTyLams tyvars
<.> mkWpLams dicts) expr | 186 | mkHsLams :: [TyVar] -> [EvVar] -> LHsExpr GhcTc -> LHsExpr GhcTc
mkHsLams tyvars dicts expr = mkLHsWrap (mkWpTyLams tyvars
<.> mkWpLams dicts) expr | 186 | mkHsLams tyvars dicts expr = mkLHsWrap (mkWpTyLams tyvars
<.> mkWpLams dicts) expr | 121 | false | true | 0 | 8 | 61 | 60 | 29 | 31 | null | null |
DigitalBrains1/clash-lt24 | LT24/UARTInterface.hs | bsd-2-clause | passCommand' PCIdle cbuf dbuf gpioOB cmd d True ready
= (PCWaitAccept, cmd , d , gpioOB, True ) | 111 | passCommand' PCIdle cbuf dbuf gpioOB cmd d True ready
= (PCWaitAccept, cmd , d , gpioOB, True ) | 111 | passCommand' PCIdle cbuf dbuf gpioOB cmd d True ready
= (PCWaitAccept, cmd , d , gpioOB, True ) | 111 | false | false | 0 | 5 | 33 | 40 | 21 | 19 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/inRange_3.hs | mit | fsEsOrdering :: Ordering -> Ordering -> MyBool
fsEsOrdering x y = not (esEsOrdering x y) | 92 | fsEsOrdering :: Ordering -> Ordering -> MyBool
fsEsOrdering x y = not (esEsOrdering x y) | 92 | fsEsOrdering x y = not (esEsOrdering x y) | 41 | false | true | 0 | 7 | 18 | 35 | 17 | 18 | null | null |
573/leksah | src/IDE/Workspaces.hs | gpl-2.0 | makePackage :: PackageAction
makePackage = do
p <- ask
liftIDE $ do
getLog >>= liftIO . bringPaneToFront
showDefaultLogLaunch'
prefs' <- readIDE prefs
mbWs <- readIDE workspace
let settings = (defaultMakeSettings prefs'){msBackgroundBuild = False}
case mbWs of
Nothing -> sysMessage Normal (__ "No workspace for build.")
Just ws -> do
debug <- isJust <$> readIDE debugState
steps <- buildSteps $ msRunUnitTests settings
if debug || msSingleBuildWithoutLinking settings && not (msMakeMode settings)
then runWorkspace
(makePackages settings [p] (MoComposed steps) (MoComposed []) moNoOp) ws
else
runWorkspace
(makePackages settings [p]
(MoComposed steps)
(MoComposed (MoConfigure:steps))
MoMetaInfo) ws | 955 | makePackage :: PackageAction
makePackage = do
p <- ask
liftIDE $ do
getLog >>= liftIO . bringPaneToFront
showDefaultLogLaunch'
prefs' <- readIDE prefs
mbWs <- readIDE workspace
let settings = (defaultMakeSettings prefs'){msBackgroundBuild = False}
case mbWs of
Nothing -> sysMessage Normal (__ "No workspace for build.")
Just ws -> do
debug <- isJust <$> readIDE debugState
steps <- buildSteps $ msRunUnitTests settings
if debug || msSingleBuildWithoutLinking settings && not (msMakeMode settings)
then runWorkspace
(makePackages settings [p] (MoComposed steps) (MoComposed []) moNoOp) ws
else
runWorkspace
(makePackages settings [p]
(MoComposed steps)
(MoComposed (MoConfigure:steps))
MoMetaInfo) ws | 955 | makePackage = do
p <- ask
liftIDE $ do
getLog >>= liftIO . bringPaneToFront
showDefaultLogLaunch'
prefs' <- readIDE prefs
mbWs <- readIDE workspace
let settings = (defaultMakeSettings prefs'){msBackgroundBuild = False}
case mbWs of
Nothing -> sysMessage Normal (__ "No workspace for build.")
Just ws -> do
debug <- isJust <$> readIDE debugState
steps <- buildSteps $ msRunUnitTests settings
if debug || msSingleBuildWithoutLinking settings && not (msMakeMode settings)
then runWorkspace
(makePackages settings [p] (MoComposed steps) (MoComposed []) moNoOp) ws
else
runWorkspace
(makePackages settings [p]
(MoComposed steps)
(MoComposed (MoConfigure:steps))
MoMetaInfo) ws | 925 | false | true | 0 | 22 | 346 | 251 | 119 | 132 | null | null |
yuto-matsum/googlecodejam2016-hs | src/q1b/B.hs | bsd-3-clause | words' :: String -> (String,String)
words' s = (left,right) where
left = takeWhile (/=' ') s
right = (tail . dropWhile (/=' ')) s | 133 | words' :: String -> (String,String)
words' s = (left,right) where
left = takeWhile (/=' ') s
right = (tail . dropWhile (/=' ')) s | 133 | words' s = (left,right) where
left = takeWhile (/=' ') s
right = (tail . dropWhile (/=' ')) s | 97 | false | true | 0 | 11 | 27 | 68 | 38 | 30 | null | null |
juliagoda/givenfind | src/GivenFind/Geography.hs | bsd-3-clause | -- words with characteristic suffixes for longitudes and latitudes are added to list
getTitudes :: Maybe [String] -> Maybe [String]
getTitudes (Just (x:xs)) = case help latiLonList x of
True -> case (isDigit . head) x of
True -> liftM (x :) (getTitudes $ Just xs)
_ -> getTitudes $ Just xs
_ -> getTitudes $ Just xs | 522 | getTitudes :: Maybe [String] -> Maybe [String]
getTitudes (Just (x:xs)) = case help latiLonList x of
True -> case (isDigit . head) x of
True -> liftM (x :) (getTitudes $ Just xs)
_ -> getTitudes $ Just xs
_ -> getTitudes $ Just xs | 437 | getTitudes (Just (x:xs)) = case help latiLonList x of
True -> case (isDigit . head) x of
True -> liftM (x :) (getTitudes $ Just xs)
_ -> getTitudes $ Just xs
_ -> getTitudes $ Just xs | 390 | true | true | 0 | 14 | 264 | 124 | 62 | 62 | null | null |
alexbiehl/hoop | hadoop-protos/src/Hadoop/Protos/DataTransferProtos/Status.hs | mit | toMaybe'Enum 2 = Prelude'.Just ERROR_CHECKSUM | 45 | toMaybe'Enum 2 = Prelude'.Just ERROR_CHECKSUM | 45 | toMaybe'Enum 2 = Prelude'.Just ERROR_CHECKSUM | 45 | false | false | 0 | 6 | 4 | 14 | 6 | 8 | null | null |
enolan/Idris-dev | src/Idris/Parser/Helpers.hs | bsd-3-clause | -- | Greater-than or equal to indent property
gteProp :: IndentProperty
gteProp = IndentProperty (>=) "should be greater than or equal context indentation" | 155 | gteProp :: IndentProperty
gteProp = IndentProperty (>=) "should be greater than or equal context indentation" | 109 | gteProp = IndentProperty (>=) "should be greater than or equal context indentation" | 83 | true | true | 0 | 6 | 22 | 25 | 12 | 13 | null | null |
ksaveljev/hake-2 | src/QCommon/QFiles/BSP/DHeaderT.hs | bsd-3-clause | newDHeaderT :: BL.ByteString -> DHeaderT
newDHeaderT = runGet getDHeaderT
where getDHeaderT :: Get DHeaderT
getDHeaderT = DHeaderT <$> getInt
<*> getInt
<*> getLumps
getLumps :: Get (V.Vector LumpT)
getLumps = V.replicateM Constants.headerLumps getLumpT
getLumpT :: Get LumpT
getLumpT = LumpT <$> getInt <*> getInt | 420 | newDHeaderT :: BL.ByteString -> DHeaderT
newDHeaderT = runGet getDHeaderT
where getDHeaderT :: Get DHeaderT
getDHeaderT = DHeaderT <$> getInt
<*> getInt
<*> getLumps
getLumps :: Get (V.Vector LumpT)
getLumps = V.replicateM Constants.headerLumps getLumpT
getLumpT :: Get LumpT
getLumpT = LumpT <$> getInt <*> getInt | 420 | newDHeaderT = runGet getDHeaderT
where getDHeaderT :: Get DHeaderT
getDHeaderT = DHeaderT <$> getInt
<*> getInt
<*> getLumps
getLumps :: Get (V.Vector LumpT)
getLumps = V.replicateM Constants.headerLumps getLumpT
getLumpT :: Get LumpT
getLumpT = LumpT <$> getInt <*> getInt | 379 | false | true | 12 | 7 | 149 | 102 | 51 | 51 | null | null |
albertov/hs-mapnik | bindings/src/Mapnik/Bindings/Datasource.hs | bsd-3-clause | withQuery :: Query -> (Ptr QueryPtr -> IO a) -> IO a
withQuery query f =
with _queryBox $ \pBox ->
with _queryUnBufferedBox $ \uBox ->
withAttributes _queryVariables $ \attrs ->
let alloc = C.withPtr_ $ \p -> [C.block|void {
auto q = new query( *$(bbox *pBox)
, std::tuple<double,double>( $(double resx)
, $(double resy))
, $(double scale)
, *$(bbox *uBox)
);
q->set_filter_factor($(double ff));
q->set_variables(*$(attributes *attrs));
*$(query **p) = q;
}|]
in bracket alloc dealloc enter
where
dealloc p = [C.exp|void { delete $(query *p) }|]
enter p = do
forM_ _queryPropertyNames $ \(encodeUtf8 -> pname) ->
[C.block|void {
$(query *p)->add_property_name(std::string($bs-ptr:pname, $bs-len:pname));
}|]
f p
Query { _queryResolution = Pair (realToFrac -> resx) (realToFrac -> resy)
, _queryScaleDenominator = (realToFrac -> scale)
, _queryFilterFactor = (realToFrac -> ff)
, ..
} = query | 1,175 | withQuery :: Query -> (Ptr QueryPtr -> IO a) -> IO a
withQuery query f =
with _queryBox $ \pBox ->
with _queryUnBufferedBox $ \uBox ->
withAttributes _queryVariables $ \attrs ->
let alloc = C.withPtr_ $ \p -> [C.block|void {
auto q = new query( *$(bbox *pBox)
, std::tuple<double,double>( $(double resx)
, $(double resy))
, $(double scale)
, *$(bbox *uBox)
);
q->set_filter_factor($(double ff));
q->set_variables(*$(attributes *attrs));
*$(query **p) = q;
}|]
in bracket alloc dealloc enter
where
dealloc p = [C.exp|void { delete $(query *p) }|]
enter p = do
forM_ _queryPropertyNames $ \(encodeUtf8 -> pname) ->
[C.block|void {
$(query *p)->add_property_name(std::string($bs-ptr:pname, $bs-len:pname));
}|]
f p
Query { _queryResolution = Pair (realToFrac -> resx) (realToFrac -> resy)
, _queryScaleDenominator = (realToFrac -> scale)
, _queryFilterFactor = (realToFrac -> ff)
, ..
} = query | 1,175 | withQuery query f =
with _queryBox $ \pBox ->
with _queryUnBufferedBox $ \uBox ->
withAttributes _queryVariables $ \attrs ->
let alloc = C.withPtr_ $ \p -> [C.block|void {
auto q = new query( *$(bbox *pBox)
, std::tuple<double,double>( $(double resx)
, $(double resy))
, $(double scale)
, *$(bbox *uBox)
);
q->set_filter_factor($(double ff));
q->set_variables(*$(attributes *attrs));
*$(query **p) = q;
}|]
in bracket alloc dealloc enter
where
dealloc p = [C.exp|void { delete $(query *p) }|]
enter p = do
forM_ _queryPropertyNames $ \(encodeUtf8 -> pname) ->
[C.block|void {
$(query *p)->add_property_name(std::string($bs-ptr:pname, $bs-len:pname));
}|]
f p
Query { _queryResolution = Pair (realToFrac -> resx) (realToFrac -> resy)
, _queryScaleDenominator = (realToFrac -> scale)
, _queryFilterFactor = (realToFrac -> ff)
, ..
} = query | 1,122 | false | true | 6 | 17 | 415 | 224 | 120 | 104 | null | null |
holzensp/ghc | compiler/cmm/PprC.hs | bsd-3-clause | isFixedPtrReg (CmmGlobal r) = isFixedPtrGlobalReg r | 51 | isFixedPtrReg (CmmGlobal r) = isFixedPtrGlobalReg r | 51 | isFixedPtrReg (CmmGlobal r) = isFixedPtrGlobalReg r | 51 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
chrisbanks/cpiwb | runKai.hs | gpl-3.0 | -- G(¬([0.5]Inhib(in):{a-in@2e5} |> oscB(3)))
-- nested gtee: Whenever we introduce Inhib it kills the osc.?
ginhibG = Nec (0,infty) (Neg (Gtee pIn (oscB 3))) | 158 | ginhibG = Nec (0,infty) (Neg (Gtee pIn (oscB 3))) | 49 | ginhibG = Nec (0,infty) (Neg (Gtee pIn (oscB 3))) | 49 | true | false | 1 | 11 | 23 | 42 | 21 | 21 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.