HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulepostgresql-simple-0.7.0.0Haskell2010

Database.PostgreSQL.Simple.Newtypes

Module with newtypes suitable to usage with DerivingVia or standalone.

The newtypes are named after packages they wrap.

  • 1 type
  • 1 value
newtypenewtype Aeson a
#

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) via Aeson Foo   -- DerivingVia

Example using Aeson newtype directly, for more ad-hoc queries

execute conn "INSERT INTO tbl (fld) VALUES (?)" (Only (Aeson x))

Constructors

Instances6Functor, Eq, Read, Show, FromField, ToField
  • Functor AesonDefined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.Newtypes
  • Eq a => Eq (Aeson a)Defined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.Newtypes
  • Read a => Read (Aeson a)Defined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.Newtypes
  • Show a => Show (Aeson a)Defined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.Newtypes
  • (FromJSON a, Typeable a) => FromField (Aeson a)Defined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.Newtypes
  • ToJSON a => ToField (Aeson a)Defined in postgresql-simple-0.7.0.0 · Database.PostgreSQL.Simple.Newtypes