ini: Configuration files in the INI format.

[ bsd3, configuration, data, library ] [ Propose Tags ] [ Report a vulnerability ]

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]
Tested with ghc ==9.4.1, ghc ==9.2.3, ghc ==9.0.2, ghc ==8.10.7, ghc ==8.8.4, ghc ==8.6.5, ghc ==8.4.4, ghc ==8.2.2, ghc ==8.0.2, ghc ==7.10.3, ghc ==7.8.4, ghc ==7.6.3, ghc ==7.4.2, ghc ==7.2.2, ghc ==7.0.4
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 13 direct, 55 indirect [details]
Downloads 28789 total (139 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.