composite-aeson-0.7.5.0: JSON for Vinyl records
Safe HaskellNone
LanguageHaskell2010

Composite.Aeson.CoRecord

Synopsis

Documentation

type ToJsonFormatField rs = Rec ToJson rs Source #

Type of records which contain JSON encoders for each element of rs.

type FromJsonFormatField e rs = Rec (FromJson e) rs Source #

Type of records which contain JSON decoders for each element of rs.

type JsonFormatField e rs = Rec (JsonFormat e) rs Source #

Type of records which contain JSON formats for each element of rs.

class DefaultJsonFormatField (rs :: [*]) where Source #

Class which makes up a JsonFormatField for some rs where each r ~ s :-> a by using the DefaultJsonFormat instance for each a.

Methods

defaultJsonFormatField :: JsonFormatField e rs Source #

Make up a JsonFormatField for some rs where each r ~ s :-> a by using the DefaultJsonFormat instance for each a.

Instances

Instances details
DefaultJsonFormatField ('[] :: [Type]) Source # 
Instance details

Defined in Composite.Aeson.CoRecord

(DefaultJsonFormat a, DefaultJsonFormatField rs) => DefaultJsonFormatField ((s :-> a) ': rs) Source # 
Instance details

Defined in Composite.Aeson.CoRecord

fieldToJson :: forall (rs :: [*]) r' (rs' :: [*]). (rs ~ (r' ': rs'), RApply rs, RMap rs, RecApplicative rs, RecWithContext rs rs, RecordToList rs', ReifyNames rs) => SumStyle -> ToJsonFormatField rs -> Field rs -> Value Source #

Make a Field rs -> Value given how to map the sum type to JSON along with a record with encoders for each value the field could have.

fieldFromJson :: forall (rs :: [*]) r' (rs' :: [*]) e. (rs ~ (r' ': rs'), RApply rs, RMap rs, RecApplicative rs, RecWithContext rs rs, RecordToList rs', ReifyNames rs) => SumStyle -> FromJsonFormatField e rs -> Parse e (Field rs) Source #

Make a Parse e (Field rs) given how to map the sum type from JSON along with a record with decoders for each value the field could have.

fieldJsonFormat :: forall (rs :: [*]) r' (rs' :: [*]) e. (rs ~ (r' ': rs'), RApply rs, RMap rs, RecApplicative rs, RecWithContext rs rs, RecordToList rs', ReifyNames rs) => SumStyle -> JsonFormatField e rs -> JsonFormat e (Field rs) Source #

Make a JsonFormat e (Field rs) given how to map the sum type to JSON along with a record with formatters for each value the field could have.