Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Data.Aeson.Possible
Description
Three-valued possible types for use with aeson
.
Useful for use in PATCH endpoints: use in records which have ToJSON
and
FromJSON
instances.
See the README for suggested usage.
The Alternative
instance can be used to update a record (with PATCH data) as
the LHS data is kept unless it is missing:
-- PATCH uses new dataHaveData
new <|> old ==HaveData
new -- PATCH sets nullHaveNull
<|> old ==HaveNull
-- PATCH did not change dataMissing
<|> old == old
Documentation
Instances
Alternative Possible Source # | Similar to the |
Applicative Possible Source # | |
Functor Possible Source # | |
Generic (Possible a) Source # | |
Show a => Show (Possible a) Source # | |
Eq a => Eq (Possible a) Source # | |
FromJSON a => FromJSON (Possible a) Source # | Uses |
Defined in Data.Aeson.Possible | |
ToJSON a => ToJSON (Possible a) Source # | Uses Note that unless the |
type Rep (Possible a) Source # | |
Defined in Data.Aeson.Possible type Rep (Possible a) = D1 ('MetaData "Possible" "Data.Aeson.Possible" "aeson-possible-0.1.0.1-inplace" 'False) (C1 ('MetaCons "Missing" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "HaveNull" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HaveData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))) |