Copyright | (c) 2021-2024 Mirko Westermeier |
---|---|
License | MIT |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Ultra light weight ini file parser
Ini files and data
Consider a simple ini file config.ini
like this:
[something] foo = bar [something else] answer = 42 name = Boaty McBoatface
There are two sections (inbetween "["
and "]"
) defined, "something"
and "something else"
. These sections contain a dictionary of strings each,
the keys being some string followed by "="
, and anything else until end of
the line as values. The leading and trailing spaces in section headers, keys
and values are trimmed.
readIniFileStrings :: FilePath -> IO (Map String (Map String String)) Source #
Like readIniFile
, but results in a stringified nested map
Ini data is a Map of Maps
As ini files consist of sections with a name, each with a list of
key-value pairs, A "two-dimensional" Map
of String
s seems to be very
natural. However, since the formatting of ini files doesn't allow arbitrary
arbitrary characters, restricted types are used here, that are thin wrappers
around String
s: