settings-0.3.0.0: Runtime-editable program settings.

Safe HaskellSafe
LanguageHaskell2010

Data.Settings.Types

Synopsis

Documentation

data Option m Source #

A settings option. The option value itself is held as usual in regular application state, not here. What is held here is functions applied to that state to get or set the value.

Constructors

Option 

Fields

  • optGet :: m Text

    A monadic action which returns the value of the option.

  • optSet :: Text -> m (Maybe SettingsError)

    A monadic action which tries to set the option to the given valie, and returns whether it succeeded.

  • optReset :: m ()

    A monadic action which resets the option to its default value.

data Section m Source #

A settings section in the settings UI tree.

Constructors

Section 

Fields

type OptName = Text Source #

An opion name.

type SecName = Text Source #

A section name.

type OptPath = Text Source #

An option path string.

type OptRoute = [Text] Source #

An option route, i.e. a list of section names ending with an option name, which describes a path in the settings UI tree leading to that option.

data SettingsError Source #

An error occuring during an operation on the settings.

class OptionValue v where Source #

Minimal complete definition

readOption, showOption, typeName

class Monad m => MonadSettings m s | m -> s where Source #

Minimal complete definition

getSettings, putSettings, modifySettings, getSTree

Methods

getSettings :: m s Source #

putSettings :: s -> m () Source #

modifySettings :: (s -> s) -> m () Source #

getSTree :: m (Section m) Source #