-- 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.4 -- | Clean configuration files in the INI format. -- -- Format rules and recommendations: -- --
-- # 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 values in the config.
lookupValue :: 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
-- | 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.
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 : 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.
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: [foo]. Conventionally, [FOO].
sectionParser :: Parser (Text, HashMap Text Text)
-- | A key-value pair. Either foo: bar or foo=bar.
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.Show.Show Data.Ini.Ini