Copyright | (c) 2019 Lucas David Traverso |
---|---|
License | MPL-2.0 |
Maintainer | Lucas David Traverso <lucas6246@gmail.com> |
Stability | stable |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Public API providing Config functionality
Synopsis
- data Config
- getKey :: Key -> Config -> IO KeyLookupResult
- data KeyLookupResult
- listSubkeys :: Key -> Config -> IO [Key]
- emptyConfig :: Config
- addSource :: SourceCreator -> Config -> IO Config
- addDefault :: Typeable a => Key -> a -> Config -> Config
- addDefaults :: [(Key, Dynamic)] -> Config -> Config
- addKeyMappings :: [KeyMapping] -> Config -> Config
- module Conferer.Key
- (&) :: a -> (a -> b) -> b
Data
This type acts as the entry point for most of the library, it's main purpouse
is to expose a uniform interface into multiple configuration sources (such as
env vars, cli args, and many others including use defined ones using the
Source
interface)
Querying a config
data KeyLookupResult Source #
Result of a key lookup in a Config
Instances
Show KeyLookupResult Source # | |
Defined in Conferer.Config.Internal.Types showsPrec :: Int -> KeyLookupResult -> ShowS # show :: KeyLookupResult -> String # showList :: [KeyLookupResult] -> ShowS # |
listSubkeys :: Key -> Config -> IO [Key] Source #
This function lists all available keys under some key, that could be fetched successfully.
Config creation and initialization
emptyConfig :: Config Source #
The empty configuration, this Config
is used as the base for
most config creating functions.
addSource :: SourceCreator -> Config -> IO Config Source #
Instantiate a Source
using an SourceCreator
and a Config
and add
to the config
addDefault :: Typeable a => Key -> a -> Config -> Config Source #
This function adds one default of a custom type to a Config
Note that unlike addDefaults
this function does the toDyn so
no need to do it on the user's side
addKeyMappings :: [KeyMapping] -> Config -> Config Source #
This function adds some key mappings to a Config
Re-Exports
module Conferer.Key