Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module with newtypes suitable to usage with
DerivingVia
or standalone.
The newtypes are named after packages they wrap.
Documentation
A newtype wrapper with
ToField
and
FromField
instances
based on
ToJSON
and
FromJSON
type classes from
aeson
.
Example using
DerivingVia
:
data Foo = Foo Int String deriving stock (Eq, Show, Generic) -- GHC built int deriving anyclass (FromJSON
,ToJSON
) -- Derived using GHC Generics deriving (ToField
,FromField
) viaAeson
Foo -- DerivingVia
Example using
Aeson
newtype directly, for more ad-hoc queries
execute conn "INSERT INTO tbl (fld) VALUES (?)" (Only (Aeson
x))
Since: 0.6.3
Aeson a |
Instances
Functor Aeson Source # | |
Eq a => Eq ( Aeson a) Source # | |
Read a => Read ( Aeson a) Source # | |
Show a => Show ( Aeson a) Source # | |
ToJSON a => ToField ( Aeson a) Source # | |
( FromJSON a, Typeable a) => FromField ( Aeson a) Source # | |
Defined in Database.PostgreSQL.Simple.Newtypes fromField :: FieldParser ( Aeson a) Source # |