settings-0.3.0.0: Runtime-editable program settings.

Data.Settings.Interface

Contents

Synopsis

# By Route

queryR :: MonadSettings m s => OptRoute -> m (Either SettingsError (Either ([SecName], [OptName]) Text)) Source #

Get what the settings tree contains at the given route.

• Return an error description if there is no such route in the tree.
• If there is a section at the route, return a list of subsection and option names under it.
• If there is an option at the route, return its value.

querySectionR :: MonadSettings m s => OptRoute -> m (Either SettingsError ([SecName], [OptName])) Source #

Get info about a settings section at the given route, if there is one.

• Return an error description if there is no such route in the tree or it doesn't point to a section.
• If there is a section at the route, return a list of subsection and option names under it.

Get the value of the option at the given route.

• Return an error description if there is no such route in the tree or it doesn't point to an option.
• If there is an option at the route, return its value.

updateOptionR :: MonadSettings m s => OptRoute -> Text -> m (Maybe SettingsError) Source #

Change the value of the option at the given route. Return an error description if there is no such route in the tree, or it doesn't point to an option, or the value given is invalid.

resetOptionR :: MonadSettings m s => OptRoute -> m (Maybe SettingsError) Source #

Reset the value of the option at the given route to the default. Return an error description if there is no such route in the tree or it doesn't point to an option.

# By Path

query :: MonadSettings m s => OptPath -> m (Either SettingsError (Either ([SecName], [OptName]) Text)) Source #

Like queryR, but takes a path and first tries to parse it into a route, returning an error description if the path is invalid.

querySection :: MonadSettings m s => OptPath -> m (Either SettingsError ([SecName], [OptName])) Source #

Like querySectionR, but takes a path and first tries to parse it into a route, returning an error description if the path is invalid.

Like queryOptionR, but takes a path and first tries to parse it into a route, returning an error description if the path is invalid.

updateOption :: MonadSettings m s => OptPath -> Text -> m (Maybe SettingsError) Source #

Like updateOptionR, but takes a path and first tries to parse it into a route, returning an error description if the path is invalid.

resetOption :: MonadSettings m s => OptPath -> m (Maybe SettingsError) Source #

Like resetOptionR, but takes a path and first tries to parse it into a route, returning an error description if the path is invalid.