ini: Configuration files in the INI format.

[ bsd3, configuration, data, library ] [ Propose Tags ]

Quick and easy configuration files in the INI format.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.0, 0.0.1, 0.1.0, 0.1.1, 0.2.0, 0.2.1, 0.2.2, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.4.0, 0.4.1, 0.4.2
Change log CHANGELOG.md
Dependencies attoparsec, base (>=4 && <5), semigroups (>=0.10 && <0.21), text, unordered-containers [details]
License BSD-3-Clause
Copyright 2013 Chris Done
Author Chris Done
Maintainer Andreas Abel
Category Data, Configuration
Home page https://github.com/andreasabel/ini
Bug tracker https://github.com/andreasabel/ini/issues
Source repo head: git clone https://github.com/andreasabel/ini.git
Uploaded by AndreasAbel at 2022-07-25T22:55:04Z
Distributions Arch:0.4.2, Debian:0.4.1, LTSHaskell:0.4.2, NixOS:0.4.2, Stackage:0.4.2
Reverse Dependencies 12 direct, 52 indirect [details]
Downloads 27418 total (124 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-07-25 [all 1 reports]

Readme for ini-0.4.2

[back to package description]

Hackage ini on Stackage Nightly Stackage LTS version Haskell CI

ini

Quick and easy configuration files in the INI format for Haskell.

Format rules and recommendations:

  • foo: bar or foo=bar are allowed.
  • The : syntax is space-sensitive.
  • Keys are case-sensitive.
  • Lower-case is recommended.
  • Values can be empty.
  • Keys cannot contain :, =, [, or ].
  • Comments must start at the beginning of the line with ; or #.

An example configuration file:

# Some comment.
[SERVER]
port=6667
hostname=localhost
[AUTH]
user=hello
pass=world
# Salt can be an empty string.
salt=

Parsing example:

> parseIni "[SERVER]\nport: 6667\nhostname: localhost"
Right (Ini {unIni = fromList [("SERVER",fromList [("hostname","localhost")
                                                 ,("port","6667")])]})

Extracting values:

> parseIni "[SERVER]\nport: 6667\nhostname: localhost" >>=
  lookupValue "SERVER" "hostname"
Right "localhost"

Parsing:

> parseIni "[SERVER]\nport: 6667\nhostname: localhost" >>=
  readValue "SERVER" "port" decimal
Right 6667

Import Data.Text.Read to use decimal.

ini-qq provides a quasiquoter for INI.