hsini-0.2: Package for user configuration files (INI)

Safe HaskellSafe-Inferred



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 :: ConfigSource

Constructs an empty configuration.

hasSection :: SectionName -> Config -> BoolSource

Returns True iff the configuration has a section with that name.

getSection :: SectionName -> Config -> Maybe SectionSource

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 -> ConfigSource

Removes the section if it exists.

hasOption :: SectionName -> OptionName -> Config -> BoolSource

Returns True if the names section has the option.

getOption :: SectionName -> OptionName -> Config -> Maybe OptionValueSource

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 -> ConfigSource

Sets the value of the option, adding it if it doesn't exist.

delOption :: SectionName -> OptionName -> Config -> ConfigSource

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.