-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | ini configuration files
--   
--   Library for reading and writing configuration files in INI format (see
--   <a>https://en.wikipedia.org/wiki/INI_file</a>).
@package hsini
@version 0.5.1.2


module Data.Ini.Types
type Config = Map SectionName Section
type SectionName = String
type Section = Map OptionName OptionValue
type OptionName = String
type OptionValue = String
cfgFromList :: [(SectionName, [(OptionName, OptionValue)])] -> Config
cfgToList :: Config -> [(SectionName, [(OptionName, OptionValue)])]


-- | A representation of configuration options. It consists of
--   <i>sections</i>, each which can contain 0 or more <i>options</i>. Each
--   options is a <i>key</i>, <i>value</i> pair.
--   
--   This module contains the API for constructing, manipulating, and
--   querying configurations.
module Data.Ini

-- | Constructs an empty configuration.
emptyConfig :: Config

-- | Returns <tt>True</tt> iff the configuration has a section with that
--   name.
hasSection :: SectionName -> Config -> Bool

-- | Returns the section with the given name if it exists in the
--   configuration.
getSection :: SectionName -> Config -> Maybe Section

-- | Returns a list of the names of all section.
sections :: Config -> [SectionName]

-- | Removes the section if it exists.
delSection :: SectionName -> Config -> Config

-- | Returns <tt>True</tt> if the names section has the option.
hasOption :: SectionName -> OptionName -> Config -> Bool

-- | Returns the value of the option, if it exists.
getOption :: SectionName -> OptionName -> Config -> Maybe OptionValue

-- | Returns a list of all options in the section.
options :: SectionName -> Config -> [OptionName]

-- | Sets the value of the option, adding it if it doesn't exist.
setOption :: SectionName -> OptionName -> OptionValue -> Config -> Config

-- | Removes the option if it exists. Empty sections are pruned.
delOption :: SectionName -> OptionName -> Config -> Config

-- | Returns all options and their values of a section.
allItems :: SectionName -> Config -> [(OptionName, OptionValue)]


-- | Parser for configurations.
module Data.Ini.Reader

-- | Parser for a configuration contained in a <a>String</a>.
parse :: String -> IniParseResult Config
data IniReaderError
IniParserError :: String -> IniReaderError
IniSyntaxError :: String -> IniReaderError
IniOtherError :: String -> IniReaderError
type IniParseResult = Either IniReaderError
