Skip to content

memowe/trivialini

Repository files navigation

trivialini

Ultra light weight ini file parser, written in Haskell

Test & API Docs pipeline API docs

Overview

Consider a simple ini-like 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.

trivialini simply parses a map of maps of strings from this data:

$ cat config.ini
[foo]
bar = 42
λ> ini <- readIniFileStrings "config.ini"
λ> ini ! "foo" ! "bar"
"42"

Contributors

Contributor Covenant 2.0

Author and License

Copyright (c) 2021-2024 Mirko Westermeier

Released under the MIT license. See LICENSE for details.