Toml.ToValue.Generic

toml-parser-1.3.0.0: TOML 1.0.0 parser

Copyright | (c) Eric Mertens 2023
License | ISC
Maintainer | emertens@gmail.com
Safe Haskell | Safe-Inferred
Language | Haskell2010

Toml.ToValue.Generic

Description

Use `genericToTable` to derive an instance of `ToTable` using the field names of a record.

Synopsis

- class GToTable f where
  - gToTable :: f a -> Table
- genericToTable :: (Generic a, GToTable (Rep a)) => a -> Table

# Documentation

class GToTable f where #

Supports conversion of product types with field selector names to TOML values.

Since: 1.0.2.0

Methods

gToTable :: f a -> Table #

#### Instances

Instances details

GToTable (U1 :: Type -> Type) # | Emits empty table
Instance details Defined in Toml.ToValue.Generic Methods gToTable :: U1 a -> Table #
GToTable (V1 :: Type -> Type) # |
Instance details Defined in Toml.ToValue.Generic Methods gToTable :: V1 a -> Table #
(GToTable f, GToTable g) => GToTable (f :*: g) # |
Instance details Defined in Toml.ToValue.Generic Methods gToTable :: (f :*: g) a -> Table #
GToTable f => GToTable (C1 c f) # | Ignores value constructor names
Instance details Defined in Toml.ToValue.Generic Methods gToTable :: C1 c f a -> Table #
GToTable f => GToTable (D1 c f) # | Ignores type constructor names
Instance details Defined in Toml.ToValue.Generic Methods gToTable :: D1 c f a -> Table #
(Selector s, ToValue a) => GToTable (S1 s (K1 i (Maybe a) :: Type -> Type)) # | Omits the key from the table on nothing, includes it on just
Instance details Defined in Toml.ToValue.Generic Methods gToTable :: S1 s (K1 i (Maybe a)) a0 -> Table #
(Selector s, ToValue a) => GToTable (S1 s (K1 i a :: Type -> Type)) # | Uses record selector name as table key
Instance details Defined in Toml.ToValue.Generic Methods gToTable :: S1 s (K1 i a) a0 -> Table #

genericToTable :: (Generic a, GToTable (Rep a)) => a -> Table #

Use a record's field names to generate a `Table`

Since: 1.0.2.0