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

Toml.Schema.Generic.ToValue

Description

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

Use genericToArray to derive an instance of ToValue using the positions of data in a constructor.

Synopsis

Records to Tables

class GToTable f where Source #

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

Methods

gToTable :: f a -> [(Text, Value)] -> [(Text, Value)] Source #

Instances

Instances details
GToTable (U1 :: Type -> Type) Source #

Emits empty table

Instance details

Defined in Toml.Schema.Generic.ToValue

Methods

gToTable :: U1 a -> [(Text, Value)] -> [(Text, Value)] Source #

GToTable (V1 :: Type -> Type) Source # 
Instance details

Defined in Toml.Schema.Generic.ToValue

Methods

gToTable :: V1 a -> [(Text, Value)] -> [(Text, Value)] Source #

(GToTable f, GToTable g) => GToTable (f :*: g) Source # 
Instance details

Defined in Toml.Schema.Generic.ToValue

Methods

gToTable :: (f :*: g) a -> [(Text, Value)] -> [(Text, Value)] Source #

GToTable f => GToTable (C1 c f) Source #

Ignores value constructor names

Instance details

Defined in Toml.Schema.Generic.ToValue

Methods

gToTable :: C1 c f a -> [(Text, Value)] -> [(Text, Value)] Source #

GToTable f => GToTable (D1 c f) Source #

Ignores type constructor names

Instance details

Defined in Toml.Schema.Generic.ToValue

Methods

gToTable :: D1 c f a -> [(Text, Value)] -> [(Text, Value)] Source #

(Selector s, ToValue a) => GToTable (S1 s (K1 i (Maybe a) :: Type -> Type)) Source #

Omits the key from the table on nothing, includes it on just

Instance details

Defined in Toml.Schema.Generic.ToValue

Methods

gToTable :: S1 s (K1 i (Maybe a)) a0 -> [(Text, Value)] -> [(Text, Value)] Source #

(Selector s, ToValue a) => GToTable (S1 s (K1 i a :: Type -> Type)) Source #

Uses record selector name as table key

Instance details

Defined in Toml.Schema.Generic.ToValue

Methods

gToTable :: S1 s (K1 i a) a0 -> [(Text, Value)] -> [(Text, Value)] Source #

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

Use a record's field names to generate a Value'

Product types to Arrays

class GToArray f where Source #

Convert product types to arrays positionally.

Methods

gToArray :: f a -> [Value] -> [Value] Source #

Instances

Instances details
(GToArray f, GToArray g) => GToArray (f :*: g) Source #

Convert left and then right

Instance details

Defined in Toml.Schema.Generic.ToValue

Methods

gToArray :: (f :*: g) a -> [Value] -> [Value] Source #

ToValue a => GToArray (K1 i a :: Type -> Type) Source #

Convert fields using ToValue instances

Instance details

Defined in Toml.Schema.Generic.ToValue

Methods

gToArray :: K1 i a a0 -> [Value] -> [Value] Source #

GToArray f => GToArray (M1 i c f) Source #

Ignore metadata

Instance details

Defined in Toml.Schema.Generic.ToValue

Methods

gToArray :: M1 i c f a -> [Value] -> [Value] Source #

genericToArray :: (Generic a, GToArray (Rep a)) => a -> Value Source #

Use a record's field names to generate a Value'