License | BSD-3-Clause |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Various utilities related to parsing YAML files.
Synopsis
- newtype With e f a = E {
- runE :: e -> f a
- type ParserE e = With e Parser
- liftE :: Functor f => f a -> With e f a
- localE :: (e' -> e) -> With e f a -> With e' f a
- withE :: Semigroup e => e -> With e f a -> With e f a
- getE :: Monad f => With e f e
- class FromJSONE e a where
- parseJSONE :: Value -> ParserE e a
- parseJSONE' :: e -> Value -> Parser a
- decodeFileEitherE :: FromJSONE e a => e -> FilePath -> IO (Either ParseException a)
- (..:) :: FromJSONE e a => Object -> Text -> ParserE e a
- (..:?) :: FromJSONE e a => Object -> Text -> ParserE e (Maybe a)
- (..!=) :: Functor f => f (Maybe a) -> a -> f a
- withTextE :: String -> (Text -> ParserE e a) -> Value -> ParserE e a
- withObjectE :: String -> (Object -> ParserE e a) -> Value -> ParserE e a
- withArrayE :: String -> (Array -> ParserE e a) -> Value -> ParserE e a
Documentation
A generic wrapper for computations which also depend on knowing a
value of type e
.
liftE :: Functor f => f a -> With e f a Source #
Lift a computation that does not care about the environment value.
withE :: Semigroup e => e -> With e f a -> With e f a Source #
Locally merge an environment with the current one for given action.
class FromJSONE e a where Source #
FromJSONE
governs values that can be parsed from a YAML (or
JSON) file, but which also have access to an extra, read-only
environment value.
For things that don't care about the environment, the default
implementation of parseJSONE
simply calls parseJSON
from a
FromJSON
instance.
Nothing
parseJSONE :: Value -> ParserE e a Source #
parseJSONE' :: e -> Value -> Parser a Source #
Instances
decodeFileEitherE :: FromJSONE e a => e -> FilePath -> IO (Either ParseException a) Source #
Read a value from a YAML file, providing the needed extra environment.