config-value: Simple, layout-based value language similar to YAML or JSON

[ language, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

This package implements a language similar to YAML or JSON but with fewer special cases and fewer dependencies. It emphasizes layout structure for sections and lists, and requires quotes around strings.


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.1.1, 0.2, 0.3, 0.4, 0.4.0.1, 0.4.0.2, 0.5, 0.5.1, 0.6, 0.6.1, 0.6.2, 0.6.2.1, 0.6.3, 0.6.3.1, 0.7.0.0, 0.7.0.1, 0.8, 0.8.1, 0.8.2, 0.8.2.1, 0.8.3 (info)
Change log CHANGELOG.md
Dependencies array (>=0.4 && <0.6), base (>=4.8 && <4.21), containers (>=0.5 && <0.8), pretty (>=1.1.1.0 && <1.2), text (>=1.2.0.4 && <2.2) [details]
Tested with ghc ==8.0.2, ghc ==8.2.2, ghc ==8.4.4, ghc ==8.6.5, ghc ==8.8.4, ghc ==8.10.2, ghc ==9.0.1
License MIT
Copyright 2015-2016,2019 Eric Mertens
Author Eric Mertens
Maintainer emertens@gmail.com
Revised Revision 8 made by EricMertens at 2024-10-18T18:12:11Z
Category Language
Home page https://github.com/glguy/config-value
Bug tracker https://github.com/glguy/config-value/issues
Source repo head: git clone git://github.com/glguy/config-value.git
Uploaded by EricMertens at 2022-08-10T22:27:43Z
Distributions Arch:0.8.3, Debian:0.7.0.1, LTSHaskell:0.8.3, NixOS:0.8.3, Stackage:0.8.3
Reverse Dependencies 6 direct, 14 indirect [details]
Downloads 18419 total (143 in the last 30 days)
Rating 2.5 (votes: 3) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-08-11 [all 1 reports]

Readme for config-value-0.8.3

[back to package description]

config-value

Hackage Build Status

This package implements a simple, layout-based value definition language used for supplying configuration values to various applications.

Before starting to use config-value, you probably want to read the documentation for config-schema to see the user-friendly way to wrap this library.

Live Demo

The config-value and config-schema packages are available in a live demo.

Example

-- Line comments until newline
layout:
  based:
    configuration:
      {} -- empty section

    inline-maps: {key1: value1, key2: value2}

    sections:
     "glguy"

    {- Block comments
       {- nested comments -}
       "O'caml style {- strings in comments"
       so you can comment out otherwise valid
       portions of your config
    -}
    atoms:       yes

    decimal:     -1234
    hexadecimal: 0x1234
    octal:       0o1234
    binary:      0b1010

    floats:      [1e2, 0x3p-5, 24.48]
    underscores: 1_000_000

lists:
   * sections: in-lists
     next-section: still-in-list
   * [ "inline", "lists" ]
   * * "nestable"
     * "layout"
     * "lists"
   * 3

unicode: "standard Haskell format strings (1 ≤ 2)x2228(2 ≤ 3)"

multiline: "haskell style\
           \string gaps"

Format

The language supports: Strings, Atoms, Integers, Lists, Nested Sections.

Sections are layout based. The contents of a section must be indented further than the section heading. The whitespace between a section heading and its colon is not significant. Section names must start with a letter and may contain letters, numbers, dashes (-), underscores (_), and periods (.).

Lists are either layout based with * prefixes or inline surrounded by [ and ] delimited by ,

Strings are surrounded by " and use Haskell-style escapes.

Numbers support decimal, hexadecimal (0x), octal (0o), and binary (0b).

Atoms follow the same lexical rule as section heading.