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


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


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

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

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

-- | Lookup values in the config.
lookupValue :: Text -> Text -> Ini -> Either String Text

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

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

-- | Get the sections in the config.
sections :: Ini -> [Text]

-- | Get the keys in a section.
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 <tt>:</tt> or <tt>=</tt>.
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.
newtype Ini
Ini :: HashMap Text (HashMap Text Text) -> Ini
[unIni] :: Ini -> HashMap Text (HashMap Text Text)

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

-- | A section. Format: <tt>[foo]</tt>. Conventionally, <tt>[FOO]</tt>.
sectionParser :: Parser (Text, HashMap Text Text)

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