Safe Haskell | None |
---|---|
Language | Haskell2010 |
Allow unit-like types to be serialized as the empty object
This can be combined with WithConstantFields
.
Synopsis
- newtype EmptyObject a = EmptyObject a
- class UnitLike (f :: Type -> Type) where
- gPoint :: f a
Documentation
newtype EmptyObject a Source #
For data types with exactly one value, this data type changes the serialization to be the empty JSON object.
It can be combined with WithConstantFields
.
Instances
UnitLike (Rep a) => ToJSON (EmptyObject a) Source # | |
Defined in Data.Aeson.Deriving.EmptyObject toJSON :: EmptyObject a -> Value # toEncoding :: EmptyObject a -> Encoding # toJSONList :: [EmptyObject a] -> Value # toEncodingList :: [EmptyObject a] -> Encoding # | |
(Generic a, UnitLike (Rep a)) => FromJSON (EmptyObject a) Source # | |
Defined in Data.Aeson.Deriving.EmptyObject parseJSON :: Value -> Parser (EmptyObject a) # parseJSONList :: Value -> Parser [EmptyObject a] # |