tomland-1.3.3.3: Bidirectional TOML serialization
Copyright(c) 2018-2022 Kowainik
LicenseMPL-2.0
MaintainerKowainik <xrom.xkov@gmail.com>
StabilityStable
PortabilityPortable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Toml

Description

This module reexports all functionality of the tomland package. It's recommended to import this module qualified, like this:

import Toml (TomlCodec, (.=))
import qualified Toml

Simple TomlCodec for a Haskell value, that can be decoded from TOML or encoded as TOML, could be written in the following way:

data User = User
    { userName :: Text
    , userAge  :: Int
    }

userCodec :: TomlCodec User
userCodec = User
    <$> Toml.text "name" .= userName
    <*> Toml.int  "age"  .= userAge

A value of such type will look in TOML like this:

name = Alice
age  = 27

For more detailed examples see README.md in the repository:

For the details of the library implementation see blog post:

Synopsis

Documentation

Main types and functions to implement TOML codecs. This module provides high-level API of tomland library.

module Toml.Codec

Low-level implementation details of types that power tomland. The Toml.Type module contains types to represent TOML AST and basic functions to work with it. This module also contains pretty-printing API for TOML AST and eDSL for type-safe definition of the TOML values.

module Toml.Type

Parser for types, defined in Toml.Type. This modules contains low-level functions to parse TOML from text. If you want to convert between Haskell types and TOML representation, use functions from Toml.Codec.