| Copyright | (c) 2018-2022 Kowainik |
|---|---|
| License | MPL-2.0 |
| Maintainer | Kowainik <xrom.xkov@gmail.com> |
| Stability | Stable |
| Portability | Portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
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 for a Haskell value, that can be decoded from
TOML or encoded as TOML, could be written in the following way:TomlCodec
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
- module Toml.Codec
- module Toml.Type
- module Toml.Parser
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.
module Toml.Parser