Safe Haskell | None |
---|---|
Language | Haskell2010 |
Reasonable conventions for embedding YAML configuration with Template Haskell
Synopsis
- embedConfig :: Q Exp
- embedConfigRelativeToProject :: FilePath -> Q Exp
- loadFromBytes :: FromJSON a => ByteString -> IO a
- loadFromValue :: FromJSON a => Value -> IO a
- newtype AesonKebab a = AesonKebab a
Documentation
embedConfig :: Q Exp Source #
TH function for loading config/settings.yml
relative to
the project in which the TH splice is written.
loadConfig :: IO MyConfig loadConfig = $(embedConfig)
embedConfigRelativeToProject :: FilePath -> Q Exp Source #
TH function for loading the supplied config file path relative to the project in which the TH splice is written.
loadConfig :: IO MyConfig loadConfig = $(embedConfigRelativeToProject "path/to/settings.yml")
loadFromBytes :: FromJSON a => ByteString -> IO a Source #
Given the file content, read a YAML config file.
loadFromValue :: FromJSON a => Value -> IO a Source #
Given the file content as an Aeson Value
, read a YAML config file.
newtype AesonKebab a Source #
A DerivingVia wrapper that only turns all fields into kebab-case. No other field processing occurs, which also means no field prefix stripping.
Instances
(Generic a, GToJSON Zero (Rep a), GToEncoding Zero (Rep a)) => ToJSON (AesonKebab a) Source # | |
Defined in Data.Yaml.Config.Kebab toJSON :: AesonKebab a -> Value # toEncoding :: AesonKebab a -> Encoding # toJSONList :: [AesonKebab a] -> Value # toEncodingList :: [AesonKebab a] -> Encoding # | |
(Generic a, GFromJSON Zero (Rep a)) => FromJSON (AesonKebab a) Source # | |
Defined in Data.Yaml.Config.Kebab parseJSON :: Value -> Parser (AesonKebab a) # parseJSONList :: Value -> Parser [AesonKebab a] # |