trivialini-0.4.0.0: Ultra light weight ini file parser
Copyright(c) 2021 Mirko Westermeier
LicenseMIT
Safe HaskellSafe-Inferred
LanguageHaskell2010

Trivialini

Description

Ultra light weight ini file parser

Synopsis

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.

readIniFile :: FilePath -> IO IniMap #

Read Ini data from a given filename

Ini data is a Map of Maps

type IniMap = Map String (Map String String) #

As ini files consist of sections with a name, each with a list of key-value pairs, A "two-dimensional" Map of Strings seems to be very natural.

newtype Ini #

A wrapper type around an IniMap with Show and Read instances.

Constructors

Ini 

Fields

Instances

Instances details
Eq Ini #

Default Eq instance

Instance details

Defined in Trivialini

Methods

(==) :: Ini -> Ini -> Bool #

(/=) :: Ini -> Ini -> Bool #

Read Ini #

Parsing of Ini strings.

Instance details

Defined in Trivialini

Show Ini #

Stringification of Ini data. The result can be parsed again as Ini data.

Instance details

Defined in Trivialini

Methods

showsPrec :: Int -> Ini -> ShowS #

show :: Ini -> String #

showList :: [Ini] -> ShowS #