Copyright | 2011-2014 Magnus Therning |
---|---|
License | BSD3 |
Safe Haskell | Safe |
Language | Haskell2010 |
A representation of configuration options. It consists of sections, each which can contain 0 or more options. Each options is a key, value pair.
This module contains the API for constructing, manipulating, and querying configurations.
- emptyConfig :: Config
- hasSection :: SectionName -> Config -> Bool
- getSection :: SectionName -> Config -> Maybe Section
- sections :: Config -> [SectionName]
- delSection :: SectionName -> Config -> Config
- hasOption :: SectionName -> OptionName -> Config -> Bool
- getOption :: SectionName -> OptionName -> Config -> Maybe OptionValue
- options :: SectionName -> Config -> [OptionName]
- setOption :: SectionName -> OptionName -> OptionValue -> Config -> Config
- delOption :: SectionName -> OptionName -> Config -> Config
- allItems :: SectionName -> Config -> [(OptionName, OptionValue)]
Documentation
emptyConfig :: Config Source #
Constructs an empty configuration.
hasSection :: SectionName -> Config -> Bool Source #
Returns True
iff the configuration has a section with that name.
getSection :: SectionName -> Config -> Maybe Section Source #
Returns the section with the given name if it exists in the configuration.
sections :: Config -> [SectionName] Source #
Returns a list of the names of all section.
delSection :: SectionName -> Config -> Config Source #
Removes the section if it exists.
hasOption :: SectionName -> OptionName -> Config -> Bool Source #
Returns True
if the names section has the option.
getOption :: SectionName -> OptionName -> Config -> Maybe OptionValue Source #
Returns the value of the option, if it exists.
options :: SectionName -> Config -> [OptionName] Source #
Returns a list of all options in the section.
setOption :: SectionName -> OptionName -> OptionValue -> Config -> Config Source #
Sets the value of the option, adding it if it doesn't exist.
delOption :: SectionName -> OptionName -> Config -> Config Source #
Removes the option if it exists. Empty sections are pruned.
allItems :: SectionName -> Config -> [(OptionName, OptionValue)] Source #
Returns all options and their values of a section.