-- 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.2.2 -- | 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
-- | Print the INI config to a file.
writeIniFile :: FilePath -> Ini -> IO ()
-- | Print an INI config.
printIni :: Ini -> Text
-- | 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 Show Ini