| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
System.Etc.Internal.Types
Documentation
deepMerge :: ConfigValue -> ConfigValue -> ConfigValue Source #
Constructors
| Config | |
Fields | |
isEmptySubConfig :: ConfigValue -> Bool Source #
writeInSubConfig :: Text -> ConfigValue -> ConfigValue -> ConfigValue Source #
class IConfig config where Source #
Minimal complete definition
getConfigValue, getConfigValueWith, getAllConfigSources, getSelectedConfigSource
Methods
getConfigValue :: (MonadThrow m, FromJSON result) => [Text] -> config -> m result Source #
Fetches a configuration value from a given key, if key
is not found, you may pick the failure mode via the MonadThrow
interface.
example:
>>>getConfigValue ["db", "user"] config :: Maybe TextJust "root">>>getConfigValue ["db", "password"] config :: Maybe TextNothing
getConfigValueWith :: MonadThrow m => (Value -> Parser result) -> [Text] -> config -> m result Source #
Fetches a configuration value from a given key, normally this key will
point to a sub-config JSON object, which is then passed to the given JSON
parser function. If key is not found, you may pick the failure mode via the
MonadThrow interface.
example:
>>>import qualified Data.Aeson as JSON>>>import qualified Data.Aeson.Types as JSON (Parser)
>>>connectInfoParser :: JSON.Value -> JSON.Parser DbConnectInfo
>>>getConfigValueWith connectInfoParser ["db"] configJust (DbConnectInfo {...})
getAllConfigSources :: MonadThrow m => [Text] -> config -> m (Set ConfigSource) Source #
getSelectedConfigSource :: MonadThrow m => [Text] -> config -> m ConfigSource Source #