Copyright | (c) Eric Mertens 2023 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Generic implementations of matching tables and arrays.
Synopsis
- class GParseTable f where
- gParseTable :: ParseTable l (f a)
- genericParseTable :: (Generic a, GParseTable (Rep a)) => ParseTable l a
- genericFromTable :: (Generic a, GParseTable (Rep a)) => Value' l -> Matcher l a
- class GFromArray f where
- gFromArray :: StateT [Value' l] (Matcher l) (f a)
- genericFromArray :: (Generic a, GFromArray (Rep a)) => Value' l -> Matcher l a
Record from table
class GParseTable f where Source #
Supports conversion of TOML tables into record values using field selector names as TOML keys.
gParseTable :: ParseTable l (f a) Source #
Convert a value and apply the continuation to the result.
Instances
genericParseTable :: (Generic a, GParseTable (Rep a)) => ParseTable l a Source #
Match a Table'
using the field names in a record.
genericFromTable :: (Generic a, GParseTable (Rep a)) => Value' l -> Matcher l a Source #
Implementation of fromValue
using genericParseTable
to derive
a match from the record field names of the target type.
Product type from array
class GFromArray f where Source #
Supports conversion of TOML arrays into product-type values.
Instances
GFromArray (U1 :: Type -> Type) Source # | Uses no array elements |
Defined in Toml.Schema.Generic.FromValue | |
(GFromArray f, GFromArray g) => GFromArray (f :*: g) Source # | |
Defined in Toml.Schema.Generic.FromValue | |
FromValue a => GFromArray (K1 i a :: Type -> Type) Source # | |
Defined in Toml.Schema.Generic.FromValue | |
GFromArray f => GFromArray (M1 i c f) Source # | |
Defined in Toml.Schema.Generic.FromValue |
genericFromArray :: (Generic a, GFromArray (Rep a)) => Value' l -> Matcher l a Source #
Match a Value'
as an array positionally matching field fields
of a constructor to the elements of the array.