toml-parser-1.3.2.0: TOML 1.0.0 parser
Copyright(c) Eric Mertens 2024
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Toml.Generic

Description

This module makes it possible to easily derive the TOML classes using the DerivingVia extension.

For example:

data Physical = Physical {
    color :: String,
    shape :: String
    }
    deriving (Eq, Show, Generic)
    deriving (ToTable, ToValue, FromValue) via GenericTomlTable Physical

These derived instances would allow you to match TOML {color="red", shape="round"} to value Coord 1 2.

data Coord = Coord Int Int
    deriving (Eq, Show, Generic)
    deriving (ToValue, FromValue) via GenericTomlArray Physical

These derived instances would allow you to match TOML [1,2] to value Coord 1 2.

Synopsis

Documentation

newtype GenericTomlTable a Source #

Helper type to use GHC's DerivingVia extension to derive ToValue, ToTable, FromValue for records.

Since: 1.3.2.0

Constructors

GenericTomlTable a 

Instances

Instances details
(Generic a, GParseTable (Rep a)) => FromValue (GenericTomlTable a) Source #

Instance derived using genericParseTable

Instance details

Defined in Toml.Generic

(Generic a, GToTable (Rep a)) => ToTable (GenericTomlTable a) Source #

Instance derived using genericToTable

Instance details

Defined in Toml.Generic

(Generic a, GToTable (Rep a)) => ToValue (GenericTomlTable a) Source #

Instance derived from ToTable instance using defaultTableToValue

Instance details

Defined in Toml.Generic

newtype GenericTomlArray a Source #

Helper type to use GHC's DerivingVia extension to derive ToValue, ToTable, FromValue for any product type.

Since: 1.3.2.0

Constructors

GenericTomlArray a 

Instances

Instances details
(Generic a, GFromArray (Rep a)) => FromValue (GenericTomlArray a) Source #

Instance derived using genericFromArray

Instance details

Defined in Toml.Generic

(Generic a, GToArray (Rep a)) => ToValue (GenericTomlArray a) Source #

Instance derived using genericToArray

Instance details

Defined in Toml.Generic