Module
Data.Codec.JSON.Record
- Package
- purescript-codec-json
- Repository
- garyb/purescript-codec-json
#Optional Source
newtype Optional a
Used to wrap codec values provided in record
to indicate the field is optional.
This will only decode the property as Nothing
if the field does not exist
in the object - having a values such as null
assigned will need handling
separately.
The property will be omitted when encoding and the value is Nothing
.
Constructors
Instances
(RowListCodec rs ri' ro', Cons sym (Optional a) ri' ri, Cons sym (Maybe a) ro' ro, IsSymbol sym) => RowListCodec (Cons sym (Optional a) rs) ri ro
#RowListCodec Source
class RowListCodec :: RowList Type -> Row Type -> Row Type -> Constraint
class RowListCodec (rl :: RowList Type) (ri :: Row Type) (ro :: Row Type) | rl -> ri ro where
The class used to enable the building of Record
codecs by providing a
record of codecs.
Members
rowListCodec :: forall proxy. proxy rl -> Record ri -> PropCodec (Record ro)
Instances
RowListCodec Nil () ()
(RowListCodec rs ri' ro', Cons sym (Optional a) ri' ri, Cons sym (Maybe a) ro' ro, IsSymbol sym) => RowListCodec (Cons sym (Optional a) rs) ri ro
(RowListCodec rs ri' ro', Cons sym (Codec a) ri' ri, Cons sym a ro' ro, IsSymbol sym) => RowListCodec (Cons sym (Codec a) rs) ri ro