| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Yaml.TH
Contents
Synopsis
- yamlQQ :: QuasiQuoter
- decodeFile :: forall a. (Lift a, FromJSON a) => FilePath -> Q (TExp a)
- data Value
- data Parser a
- type Object = KeyMap Value
- type Array = Vector Value
- object :: [Pair] -> Value
- array :: [Value] -> Value
- (.=) :: (KeyValue e kv, ToJSON v) => Key -> v -> kv
- (.:) :: FromJSON a => Object -> Key -> Parser a
- (.:?) :: FromJSON a => Object -> Key -> Parser (Maybe a)
- (.!=) :: Parser (Maybe a) -> a -> Parser a
- class FromJSON a where
- parseJSON :: Value -> Parser a
- parseJSONList :: Value -> Parser [a]
- omittedField :: Maybe a
Decoding
yamlQQ :: QuasiQuoter Source #
A QuasiQuoter for YAML.
Examples
{-# LANGUAGE QuasiQuotes #-}
import Data.Yaml.TH
value :: Value
value = [yamlQQ|
name: John Doe
age: 23
|]
Since: 0.8.28.0
decodeFile :: forall a. (Lift a, FromJSON a) => FilePath -> Q (TExp a) Source #
Decode a YAML file at compile time. Only available on GHC version 7.8.1
or higher.
Examples
{-# LANGUAGE TemplateHaskell #-}
config :: Config
config = $$(decodeFile "config.yaml")
Since: 0.8.19.0
Re-exports from Data.Yaml
Instances
| Arbitrary Value | |
| CoArbitrary Value | |
Defined in Data.Aeson.Types.Internal Methods coarbitrary :: Value -> Gen b -> Gen b | |
| Function Value | |
Defined in Data.Aeson.Types.Internal | |
| FromJSON Value | |
Defined in Data.Aeson.Types.FromJSON | |
| ToJSON Value | |
Defined in Data.Aeson.Types.ToJSON | |
| Data Value | |
Defined in Data.Aeson.Types.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Value -> c Value Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Value Source # toConstr :: Value -> Constr Source # dataTypeOf :: Value -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Value) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Value) Source # gmapT :: (forall b. Data b => b -> b) -> Value -> Value Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Value -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Value -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Value -> m Value Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Value -> m Value Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Value -> m Value Source # | |
| IsString Value | |
Defined in Data.Aeson.Types.Internal Methods fromString :: String -> Value Source # | |
| Generic Value | |
| Read Value | |
| Show Value | |
| NFData Value | |
Defined in Data.Aeson.Types.Internal | |
| Eq Value | |
| Ord Value | |
Defined in Data.Aeson.Types.Internal | |
| Hashable Value | |
Defined in Data.Aeson.Types.Internal | |
| KeyValue Encoding Series | |
Defined in Data.Aeson.Types.ToJSON Methods (.=) :: ToJSON v => Key -> v -> Series # explicitToField :: (v -> Encoding) -> Key -> v -> Series | |
| KeyValueOmit Encoding Series | |
Defined in Data.Aeson.Types.ToJSON Methods (.?=) :: ToJSON v => Key -> v -> Series explicitToFieldOmit :: (v -> Bool) -> (v -> Encoding) -> Key -> v -> Series | |
| Lift Value | |
| (GToJSON' Encoding arity a, ConsToJSON Encoding arity a, Constructor c) => SumToJSON' TwoElemArray Encoding arity (C1 c a) | |
Defined in Data.Aeson.Types.ToJSON Methods sumToJSON' :: Options -> ToArgs Encoding arity a0 -> C1 c a a0 -> Tagged TwoElemArray Encoding | |
| (GToJSON' Value arity a, ConsToJSON Value arity a, Constructor c) => SumToJSON' TwoElemArray Value arity (C1 c a) | |
Defined in Data.Aeson.Types.ToJSON Methods sumToJSON' :: Options -> ToArgs Value arity a0 -> C1 c a a0 -> Tagged TwoElemArray Value | |
| GToJSON' Encoding arity (U1 :: Type -> Type) | |
Defined in Data.Aeson.Types.ToJSON | |
| GToJSON' Encoding arity (V1 :: Type -> Type) | |
Defined in Data.Aeson.Types.ToJSON | |
| GToJSON' Value arity (U1 :: Type -> Type) | |
Defined in Data.Aeson.Types.ToJSON | |
| GToJSON' Value arity (V1 :: Type -> Type) | |
Defined in Data.Aeson.Types.ToJSON | |
| ToJSON1 f => GToJSON' Encoding One (Rec1 f) | |
Defined in Data.Aeson.Types.ToJSON | |
| ToJSON1 f => GToJSON' Value One (Rec1 f) | |
Defined in Data.Aeson.Types.ToJSON | |
| (EncodeProduct arity a, EncodeProduct arity b) => GToJSON' Encoding arity (a :*: b) | |
Defined in Data.Aeson.Types.ToJSON | |
| ToJSON a => GToJSON' Encoding arity (K1 i a :: Type -> Type) | |
Defined in Data.Aeson.Types.ToJSON | |
| (WriteProduct arity a, WriteProduct arity b, ProductSize a, ProductSize b) => GToJSON' Value arity (a :*: b) | |
Defined in Data.Aeson.Types.ToJSON | |
| ToJSON a => GToJSON' Value arity (K1 i a :: Type -> Type) | |
Defined in Data.Aeson.Types.ToJSON | |
| (ToJSON1 f, GToJSON' Encoding One g) => GToJSON' Encoding One (f :.: g) | |
Defined in Data.Aeson.Types.ToJSON | |
| (ToJSON1 f, GToJSON' Value One g) => GToJSON' Value One (f :.: g) | |
Defined in Data.Aeson.Types.ToJSON | |
| FromPairs Value (DList Pair) | |
Defined in Data.Aeson.Types.ToJSON | |
| value ~ Value => KeyValue Value (KeyMap value) | |
Defined in Data.Aeson.Types.ToJSON Methods (.=) :: ToJSON v => Key -> v -> KeyMap value # explicitToField :: (v -> Value) -> Key -> v -> KeyMap value | |
| value ~ Value => KeyValueOmit Value (KeyMap value) | |
Defined in Data.Aeson.Types.ToJSON Methods (.?=) :: ToJSON v => Key -> v -> KeyMap value explicitToFieldOmit :: (v -> Bool) -> (v -> Value) -> Key -> v -> KeyMap value | |
| v ~ Value => KeyValuePair v (DList Pair) | |
Defined in Data.Aeson.Types.ToJSON Methods pair :: Key -> v -> DList Pair | |
| (key ~ Key, value ~ Value) => KeyValue Value (key, value) | |
Defined in Data.Aeson.Types.ToJSON Methods (.=) :: ToJSON v => Key -> v -> (key, value) # explicitToField :: (v -> Value) -> Key -> v -> (key, value) | |
| type Rep Value | |
Defined in Data.Aeson.Types.Internal type Rep Value = D1 ('MetaData "Value" "Data.Aeson.Types.Internal" "aeson-2.2.3.0-FIuhcpStCJb6RwQN89Mekh" 'False) ((C1 ('MetaCons "Object" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Object)) :+: (C1 ('MetaCons "Array" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Array)) :+: C1 ('MetaCons "String" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)))) :+: (C1 ('MetaCons "Number" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Scientific)) :+: (C1 ('MetaCons "Bool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)) :+: C1 ('MetaCons "Null" 'PrefixI 'False) (U1 :: Type -> Type)))) | |
Minimal complete definition
Nothing
Methods
parseJSON :: Value -> Parser a #
parseJSONList :: Value -> Parser [a] #
omittedField :: Maybe a #