Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- getKey :: Key -> Config -> IO (Maybe Text)
- getFromConfig :: forall a. (Typeable a, FromConfig a, DefaultConfig a) => Key -> Config -> IO a
- getFromRootConfig :: forall a. (Typeable a, FromConfig a, DefaultConfig a) => Config -> IO a
- getFromConfigWithDefault :: forall a. (Typeable a, FromConfig a) => Key -> Config -> a -> IO a
- safeGetFromConfig :: forall a. (Typeable a, FromConfig a, DefaultConfig a) => Key -> Config -> IO (Maybe a)
- safeGetFromConfigWithDefault :: forall a. (Typeable a, FromConfig a) => Key -> Config -> a -> IO (Maybe a)
- (/.) :: Key -> Key -> Key
- emptyConfig :: Config
- withDefaults :: [(Key, Text)] -> Config -> Config
- mkStandaloneSource :: SourceCreator -> IO Source
- addSource :: SourceCreator -> Config -> IO Config
- unsafeGetKey :: Key -> Config -> IO Text
Documentation
getFromConfig :: forall a. (Typeable a, FromConfig a, DefaultConfig a) => Key -> Config -> IO a Source #
Fetch a value from a config under some specific key that's parsed using the FromConfig
instance, and as a default it uses the value from DefaultConfig
.
Notes: - This function may throw an exception if parsing fails for any subkey
getFromRootConfig :: forall a. (Typeable a, FromConfig a, DefaultConfig a) => Config -> IO a Source #
Same as getFromConfig
using the root key
Notes: - This function may throw an exception if parsing fails for any subkey
getFromConfigWithDefault :: forall a. (Typeable a, FromConfig a) => Key -> Config -> a -> IO a Source #
Same as getFromConfig
but with a user defined default (instead of DefaultConfig
instance)
Useful for fetching primitive types
safeGetFromConfig :: forall a. (Typeable a, FromConfig a, DefaultConfig a) => Key -> Config -> IO (Maybe a) Source #
Fetch a value from a config key that's parsed using the FromConfig instance.
Note: This function does not use default so the value must be fully defined by the config only,
meaning using this function for many records will always result in Nothing
(if the record contains
a value that can never be retrieved like a function)
safeGetFromConfigWithDefault :: forall a. (Typeable a, FromConfig a) => Key -> Config -> a -> IO (Maybe a) Source #
Same as safeGetFromConfig
but with a user defined default
emptyConfig :: Config Source #
The empty configuration, this Config
is used as the base for
most config creating functions.
mkStandaloneSource :: SourceCreator -> IO Source Source #
Instantiate a SourceCreator
using the emptyConfig