tomland-1.3.3.3: Bidirectional TOML serialization

Copyright | (c) 2018-2022 Kowainik
License | MPL-2.0
Maintainer | Kowainik <xrom.xkov@gmail.com>
Stability | Stable
Portability | Portable
Safe Haskell | None
Language | Haskell2010

Toml.Codec.Combinator.Primitive

Contents

- Boolean
- Integral numbers
- Floating point numbers
- Text types

Description

TOML-specific combinators for converting between TOML and Haskell primitive types, e.g. `Int`, `ByteString`.

For the overall picture you can see how different types are represented by codecs in the following table:

Haskell Type | `TOML` | `TomlCodec`
--- | --- | ---
`Bool` | `a = true` | `bool` "a"
`Integer` | `a = 100` | `integer` "a"
`Int` | `a = -42` | `int` "a"
`Natural` | `a = 11` | `natural` "a"
`Word` | `a = 1` | `word` "a"
`Word8` | `a = 1` | `word8` "a"
`Double` | `a = 36.6` | `double` "a"
`Float` | `a = -100.09` | `float` "a"
`String` | `a = "Hello"` | `string` "a"
`Text` | `a = "Hello"` | `text` "a"
Lazy`Text` | `a = "Hey"` | `lazyText` "a"
`ByteString` | `a = "Hello"` | `byteString` "a"
Lazy`ByteString` | `a = "Hey"` | `lazyByteString` "a"
`ByteString` as Array | `a = [10, 15]` | `byteStringArray` "a"
Lazy`ByteString` as Array | `a = [15, 10]` | `lazyByteStringArray` "a"

Since: 1.3.0.0

Synopsis

- bool :: Key -> TomlCodec Bool
- integer :: Key -> TomlCodec Integer
- int :: Key -> TomlCodec Int
- natural :: Key -> TomlCodec Natural
- word :: Key -> TomlCodec Word
- word8 :: Key -> TomlCodec Word8
- double :: Key -> TomlCodec Double
- float :: Key -> TomlCodec Float
- string :: Key -> TomlCodec String
- text :: Key -> TomlCodec Text
- lazyText :: Key -> TomlCodec Text
- byteString :: Key -> TomlCodec ByteString
- lazyByteString :: Key -> TomlCodec ByteString
- byteStringArray :: Key -> TomlCodec ByteString
- lazyByteStringArray :: Key -> TomlCodec ByteString

# Boolean

bool :: Key -> TomlCodec Bool #

Codec for boolean values.

Since: 0.0.0

# Integral numbers

integer :: Key -> TomlCodec Integer #

Codec for integer values.

Since: 0.1.0

int :: Key -> TomlCodec Int #

Codec for integer values.

Since: 0.0.0

natural :: Key -> TomlCodec Natural #

Codec for natural values.

Since: 0.5.0

word :: Key -> TomlCodec Word #

Codec for word values.

Since: 0.5.0

word8 :: Key -> TomlCodec Word8 #

Codec for word8 values.

Since: 1.2.0.0

# Floating point numbers

double :: Key -> TomlCodec Double #

Codec for floating point values with double precision.

Since: 0.0.0

float :: Key -> TomlCodec Float #

Codec for floating point values.

Since: 0.5.0

# Text types

string :: Key -> TomlCodec String #

Codec for string values.

Since: 0.4.0

text :: Key -> TomlCodec Text #

Codec for text values.

Since: 0.3.0

lazyText :: Key -> TomlCodec Text #

Codec for lazy text values.

Since: 1.0.0

byteString :: Key -> TomlCodec ByteString #

Codec for text values as `ByteString`.

Since: 0.5.0

lazyByteString :: Key -> TomlCodec ByteString #

Codec for text values as `ByteString`.

Since: 0.5.0

byteStringArray :: Key -> TomlCodec ByteString #

Codec for positive integer array values as `ByteString`.

Since: 1.2.0.0

lazyByteStringArray :: Key -> TomlCodec ByteString #

Codec for positive integer array values as lazy `ByteString`.

Since: 1.2.0.0