Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- findKeyAndApplyConfig :: FetchFromConfig newvalue => Config -> Key -> Key -> (newvalue -> config -> config) -> Either Text config -> IO (Either Text config)
How to use this
FetchFromConfig instance for snap server configuration
import Conferer import Conferer.FetchFromConfig.Snap () -- from package conferer-snap main = do config <-defaultConfig
"awesomeapp" snapConfig <-getFromConfig
"warp" config
- Internal utility functions | These may be useful for someone but are subject to change at any point so use with care
findKeyAndApplyConfig Source #
:: FetchFromConfig newvalue | |
=> Config | Complete config |
-> Key | Key that indicates the part of the config that we care about |
-> Key | Key that we use to find the config (usually concatenating with the other key) |
-> (newvalue -> config -> config) | Function that knows how to use the value to update the config |
-> Either Text config | Result of the last config updating |
-> IO (Either Text config) | Updated config |
Concatenate many transformations to the config based on keys and functions
TODO: This should probably be on conferer
and maybe should use a
transformer stack to avoid so much repeated code