Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- key :: QuasiQuoter
- data Value
- data ConfigError
- newtype Key = Key (NonEmpty KeyPart)
- class ConfigValue a where
- fromConfig :: Value -> Either ConfigError a
- prettyValue :: a -> Text
- data Origin = forall a.ConfigValue a => Origin a Text
- type KeyPart = Text
- prefixedWith :: Key -> [KeyPart] -> Key
- withString :: (ByteString -> Either ConfigError a) -> Value -> Either ConfigError a
Documentation
key :: QuasiQuoter Source #
to write values of Key
easily
A generic value read from a config source, to be parsed into a more useful type
(see the ConfigValue
class).
ConfigString ByteString | |
ConfigInteger Integer | |
ConfigMaybeInteger ByteString Integer | A value which may be an integer, but the source cannot say for sure, e.g. because
its values are entirely untyped. Use |
ConfigOther Text Text | |
ConfigBool Bool | |
ConfigNull |
data ConfigError Source #
Instances
Show ConfigError Source # | |
Defined in Conftrack.Value showsPrec :: Int -> ConfigError -> ShowS # show :: ConfigError -> String # showList :: [ConfigError] -> ShowS # |
A configuration key is a non-empty list of parts. By convention, these parts are separated by dots when written, although dots withing parts are not disallowed.
For writing values easily, consider enabling the QuasiQuotes
language extension
to use key
:
>>>
[key|foo.bar|]
foo.bar
class ConfigValue a where Source #
Values which can be read from a config source must implement this class
fromConfig :: Value -> Either ConfigError a Source #
prettyValue :: a -> Text Source #
optionally, a function to pretty-print values of this type, used by the
functions of Conftrack.Pretty. If not given, defaults to a
's Show
instance.
default prettyValue :: Show a => a -> Text Source #
Instances
forall a.ConfigValue a => Origin a Text |
withString :: (ByteString -> Either ConfigError a) -> Value -> Either ConfigError a Source #