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

Copyright2011-2014 Magnus Therning
LicenseBSD3
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Ini

Description

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.

Synopsis

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.