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

-- | Configuration files in the INI format.
--   
--   Quick and easy configuration files in the INI format.
@package ini
@version 0.4.2

-- | Clean configuration files in the INI format.
--   
--   Format rules and recommendations:
--   
--   
--   
- The :  syntax is space-sensitive.
--   
- Keys are case-sensitive.
--   
- Lower-case is recommended.
--   
- Values can be empty.
--   
- Keys cannot key separators, section delimiters, or comment
--   markers.
--   
- Comments must start at the beginning of the line and start with
--   ; or #.
--   
--   
--   An example configuration file:
--   
--   
--   # Some comment.
--   [SERVER]
--   port=6667
--   hostname=localhost
--   ; another comment here
--   [AUTH]
--   user: hello
--   pass: world
--   salt:
--   
--   
--   Parsing example:
--   
--   
--   >>> parseIni "[SERVER]\nport: 6667\nhostname: localhost"
--   Right (Ini {unIni = fromList [("SERVER",fromList [("hostname","localhost"),("port","6667")])]})
--   
module Data.Ini

-- | Parse an INI file.
readIniFile :: FilePath -> IO (Either String Ini)

-- | Parse an INI config.
parseIni :: Text -> Either String Ini

-- | Lookup one value in the config.
--   
--   Example:
--   
--   
--   >>> parseIni "[SERVER]\nport: 6667\nhostname: localhost" >>= lookupValue "SERVER" "hostname"
--   Right "localhost"
--   
lookupValue :: Text -> Text -> Ini -> Either String Text

-- | Lookup one value in the config.
--   
--   Example:
--   
--   
--   >>> parseIni "[SERVER]\nport: 6667\nhostname: localhost" >>= lookupValue "SERVER" "hostname"
--   Right "localhost"
--   
lookupArray :: Text -> Text -> Ini -> Either String [Text]

-- | Read a value using a reader from Data.Text.Read.
readValue :: Text -> Text -> (Text -> Either String (a, Text)) -> Ini -> Either String a

-- | Read an array of values using a reader from Data.Text.Read.
readArray :: Text -> Text -> (Text -> Either String (a, Text)) -> Ini -> Either String [a]

-- | Parse a value using a reader from Data.Attoparsec.Text.
parseValue :: Text -> Text -> Parser a -> Ini -> Either String a

-- | Get the sections in the config.
--   
--   Example:
--   
--   
--   >>> sections <$> parseIni "[SERVER]\nport: 6667\nhostname: localhost"
--   Right ["SERVER"]
--   
sections :: Ini -> [Text]

-- | Get the keys in a section.
--   
--   Example:
--   
--   
--   >>> parseIni "[SERVER]\nport: 6667\nhostname: localhost" >>= keys "SERVER"
--   Right ["hostname","port"]
--   
keys :: Text -> Ini -> Either String [Text]

-- | Print an INI config.
printIni :: Ini -> Text

-- | Print the INI config to a file.
writeIniFile :: FilePath -> Ini -> IO ()

-- | Either : or =.
data KeySeparator
ColonKeySeparator :: KeySeparator
EqualsKeySeparator :: KeySeparator

-- | Settings determining how an INI file is written.
data WriteIniSettings
WriteIniSettings :: KeySeparator -> WriteIniSettings
[writeIniKeySeparator] :: WriteIniSettings -> KeySeparator

-- | The default settings for writing INI files.
defaultWriteIniSettings :: WriteIniSettings

-- | Print an INI config.
printIniWith :: WriteIniSettings -> Ini -> Text

-- | Print the INI config to a file.
writeIniFileWith :: WriteIniSettings -> FilePath -> Ini -> IO ()

-- | An INI configuration.
data Ini
Ini :: HashMap Text [(Text, Text)] -> [(Text, Text)] -> Ini
[iniSections] :: Ini -> HashMap Text [(Text, Text)]
[iniGlobals] :: Ini -> [(Text, Text)]
unIni :: Ini -> HashMap Text (HashMap Text Text)

-- | Parser for an INI.
iniParser :: Parser Ini

-- | A section. Format: [foo]. Conventionally, [FOO].
sectionParser :: Parser (Text, [(Text, Text)])

-- | A key-value pair. Either foo: bar or foo=bar.
keyValueParser :: Parser (Text, Text)
instance GHC.Classes.Eq Data.Ini.Ini
instance GHC.Classes.Eq Data.Ini.KeySeparator
instance GHC.Internal.Base.Monoid Data.Ini.Ini
instance GHC.Internal.Base.Semigroup Data.Ini.Ini
instance GHC.Internal.Show.Show Data.Ini.Ini
instance GHC.Internal.Show.Show Data.Ini.KeySeparator
instance GHC.Internal.Show.Show Data.Ini.WriteIniSettings
