Copyright | (c) Eric Mertens 2023 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Use genericParseTable
to derive a ParseTable
using the field names
of a record. This can be combined with parseTableFromValue
to derive a FromValue
instance.
Synopsis
- class GParseTable f where
- gParseTable :: ParseTable (f a)
- genericParseTable :: (Generic a, GParseTable (Rep a)) => ParseTable a
- class GFromArray f where
- gFromArray :: StateT [Value] Matcher (f a)
- genericFromArray :: (Generic a, GFromArray (Rep a)) => Value -> Matcher a
Record from table
class GParseTable f where Source #
Supports conversion of TOML tables into record values using field selector names as TOML keys.
Since: 1.0.2.0
gParseTable :: ParseTable (f a) Source #
Convert a value and apply the continuation to the result.
Instances
GParseTable (U1 :: Type -> Type) Source # | Emits empty table |
Defined in Toml.FromValue.Generic gParseTable :: ParseTable (U1 a) Source # | |
(GParseTable f, GParseTable g) => GParseTable (f :*: g) Source # | Matches left then right component |
Defined in Toml.FromValue.Generic gParseTable :: ParseTable ((f :*: g) a) Source # | |
GParseTable f => GParseTable (C1 ('MetaCons sym fix 'True) f) Source # | Ignores value constructor name - only supports record constructors |
Defined in Toml.FromValue.Generic gParseTable :: ParseTable (C1 ('MetaCons sym fix 'True) f a) Source # | |
GParseTable f => GParseTable (D1 c f) Source # | Ignores type constructor name |
Defined in Toml.FromValue.Generic gParseTable :: ParseTable (D1 c f a) Source # | |
(Selector s, FromValue a) => GParseTable (S1 s (K1 i (Maybe a) :: Type -> Type)) Source # | Omits the key from the table on nothing, includes it on just |
Defined in Toml.FromValue.Generic gParseTable :: ParseTable (S1 s (K1 i (Maybe a)) a0) Source # | |
(Selector s, FromValue a) => GParseTable (S1 s (K1 i a :: Type -> Type)) Source # | Uses record selector name as table key |
Defined in Toml.FromValue.Generic gParseTable :: ParseTable (S1 s (K1 i a) a0) Source # |
genericParseTable :: (Generic a, GParseTable (Rep a)) => ParseTable a Source #
Match a Table
using the field names in a record.
Since: 1.2.0.0
Product type from array
class GFromArray f where Source #
Supports conversion of TOML arrays into product-type values.
Since: 1.3.2.0
Instances
GFromArray (U1 :: Type -> Type) Source # | Uses no array elements |
Defined in Toml.FromValue.Generic | |
(GFromArray f, GFromArray g) => GFromArray (f :*: g) Source # | |
Defined in Toml.FromValue.Generic | |
FromValue a => GFromArray (K1 i a :: Type -> Type) Source # | |
Defined in Toml.FromValue.Generic | |
GFromArray f => GFromArray (M1 i c f) Source # | |
Defined in Toml.FromValue.Generic |
genericFromArray :: (Generic a, GFromArray (Rep a)) => Value -> Matcher a Source #
Match a Value
as an array positionally matching field fields
of a constructor to the elements of the array.
Since: 1.3.2.0