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

-- | Package for user configuration files (INI)
--   
--   None yet
@package hsini
@version 0.5.0

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
--   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.
module Data.Ini

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

-- | Returns True 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 True 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 String.
parse :: String -> IniParseResult Config
data IniReaderError
IniParserError :: String -> IniReaderError
IniSyntaxError :: String -> IniReaderError
IniOtherError :: String -> IniReaderError
type IniParseResult = Either IniReaderError
