conferer-1.1.0.0: Configuration management library
Copyright(c) 2019 Lucas David Traverso
LicenseMPL-2.0
MaintainerLucas David Traverso <lucas6246@gmail.com>
Stabilitystable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Conferer.Config

Description

Public API providing Config functionality

Synopsis

Data

data Config Source #

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)

Instances

Instances details
Show Config Source # 
Instance details

Defined in Conferer.Config.Internal.Types

Querying a config

getKey :: Key -> Config -> IO KeyLookupResult Source #

This function runs lookups on the Config, first in Sources in order and then on the Dynamic based defaults.

data KeyLookupResult Source #

Result of a key lookup in a Config

Instances

Instances details
Show KeyLookupResult Source # 
Instance details

Defined in Conferer.Config.Internal.Types

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

addSources :: [SourceCreator] -> Config -> IO Config Source #

Instantiate several Sources using a SourceCreators and a Config and add them to the config in the order defined by the list

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

addDefaults :: [(Key, Dynamic)] -> Config -> Config Source #

This function adds defaults to a Config

addKeyMappings :: [KeyMapping] -> Config -> Config Source #

This function adds some key mappings to a Config

removeDefault :: forall t. Typeable t => Key -> Config -> Config Source #

This function removes a default from a Config, this is the oposite of addDefault, it deletes the first element of matching type in a certain Key.

Re-Exports

(&) :: a -> (a -> b) -> b infixl 1 #

& is a reverse application operator. This provides notational convenience. Its precedence is one higher than that of the forward application operator $, which allows & to be nested in $.

>>> 5 & (+1) & show
"6"

Since: base-4.8.0.0