Moduletomland-1.3.3.3Haskell2010
Toml.Codec
SPDX-License-Identifier : MPL-2.0 Maintainer : Kowainik xrom.xkov@gmail.com Stability : Stable Portability : Portable
This module provides utilities for implementing and using
bidirectional TOML codecs. The concept of bidirectional conversion in
tomland has two parts: TomlBiMap and TomlCodec.
General TOML description
In the following TOML
name = "foo"
we call name as key and "foo" as value.
TomlBiMap
TomlBiMap provides a bidirectional conversion between TOML values and Haskell primitive values. TOML specification defines some primitive values you can use in key-value pairs (e.g. integer, string, local time). TomlBiMap provides a way to convert between TOML primitives and Haskell values. TomlBiMap doesn't know anything about TOML keys.
TomlCodec
TomlCodec describes how to convert in both ways between a single or
multiple key-value pairs and Haskell types. tomland provides basic
primitives for decoding and encoding single key-value pairs, but also
a way to compose multiple TomlCodecs into a single one. So, if you
have a custom data type, that has several fields or several
constructors, you need to define TomlCodec for your data type.
Encoding and decoding
If you have a type like User then userCodec :: TomlCodec User is
an object that describes how to encode a value of type User to
TOML and decode TOML to a value of type User.
Naming conventions
tomland uses the following naming conventions (and encourages
library users to follow them as well):
- Packagetomland-1.3.3.3
- Exports0
- LanguageHaskell2010
- LicenceMPL-2.0
- SourceCodec.hs
module Toml.Codec.Types
Core error types, including TomlDecodeError and LoadTomlException.
module Toml.Codec.Error
Contains TOML-specific combinators for converting between TOML and user data types.
module Toml.Codec.Code
Forward and backward mapping functions and combinators (similar to profunctors).
module Toml.Codec.Di
Contains TOML-specific combinators and codecs for converting between TOML and user data types.
module Toml.Codec.Combinator
Automatic TOML codecs using Generic.
module Toml.Codec.Generic
BiMap type that represents Tagged Partial Bidirectional Conversion between TOML primitives and Haskell types.
module Toml.Codec.BiMap
Specific implementations of BiMap between Haskell types and TOML values.
module Toml.Codec.BiMap.Conversion