@@ -10,10 +10,12 @@ Stability: experimental
1010-}
1111{-# LANGUAGE
1212 AllowAmbiguousTypes
13+ , DeriveAnyClass
1314 , DeriveFoldable
1415 , DeriveFunctor
1516 , DeriveGeneric
1617 , DeriveTraversable
18+ , DerivingStrategies
1719 , DefaultSignatures
1820 , FlexibleContexts
1921 , FlexibleInstances
@@ -45,6 +47,7 @@ module Squeal.PostgreSQL.PG
4547 , Enumerated (..)
4648 , VarArray (..)
4749 , FixArray (..)
50+ , Oid (..)
4851 -- * Type families
4952 , LabelsPG
5053 , DimPG
@@ -105,7 +108,7 @@ type instance PG Int32 = 'PGint4
105108-- | `PGint8`
106109type instance PG Int64 = 'PGint8
107110-- | `PGint2`
108−type instance PG Word32 = 'PGoid
111+type instance PG Oid = 'PGoid
109112-- | `PGnumeric`
110113type instance PG Scientific = 'PGnumeric
111114-- | `PGfloat4`
@@ -299,7 +302,8 @@ withConnection "host=localhost port=5432 dbname=exampledb" $ do
299302True
300303-}
301304newtype Money = Money { cents :: Int64 }
302− deriving (Eq, Ord, Show, Read, GHC.Generic)
305+ deriving stock (Eq, Ord, Show, Read, GHC.Generic)
306+ deriving anyclass (SOP.HasDatatypeInfo, SOP.Generic)
303307-- | `PGmoney`
304308type instance PG Money = 'PGmoney
305309
@@ -307,7 +311,8 @@ type instance PG Money = 'PGmoney
307311type it's applied to should be stored as a `PGjson`.
308312-}
309313newtype Json hask = Json {getJson :: hask}
310− deriving (Eq, Ord, Show, Read, GHC.Generic)
314+ deriving stock (Eq, Ord, Show, Read, GHC.Generic)
315+ deriving anyclass (SOP.HasDatatypeInfo, SOP.Generic)
311316-- | `PGjson`
312317type instance PG (Json hask) = 'PGjson
313318
@@ -315,7 +320,8 @@ type instance PG (Json hask) = 'PGjson
315320type it's applied to should be stored as a `PGjsonb`.
316321-}
317322newtype Jsonb hask = Jsonb {getJsonb :: hask}
318− deriving (Eq, Ord, Show, Read, GHC.Generic)
323+ deriving stock (Eq, Ord, Show, Read, GHC.Generic)
324+ deriving anyclass (SOP.HasDatatypeInfo, SOP.Generic)
319325-- | `PGjsonb`
320326type instance PG (Jsonb hask) = 'PGjsonb
321327
@@ -323,7 +329,8 @@ type instance PG (Jsonb hask) = 'PGjsonb
323329type it's applied to should be stored as a `PGcomposite`.
324330-}
325331newtype Composite record = Composite {getComposite :: record}
326− deriving (Eq, Ord, Show, Read, GHC.Generic)
332+ deriving stock (Eq, Ord, Show, Read, GHC.Generic)
333+ deriving anyclass (SOP.HasDatatypeInfo, SOP.Generic)
327334-- | `PGcomposite` @(@`RowPG` @hask)@
328335type instance PG (Composite hask) = 'PGcomposite (RowPG hask)
329336
@@ -331,7 +338,8 @@ type instance PG (Composite hask) = 'PGcomposite (RowPG hask)
331338type it's applied to should be stored as a `PGenum`.
332339-}
333340newtype Enumerated enum = Enumerated {getEnumerated :: enum}
334− deriving (Eq, Ord, Show, Read, GHC.Generic)
341+ deriving stock (Eq, Ord, Show, Read, GHC.Generic)
342+ deriving anyclass (SOP.HasDatatypeInfo, SOP.Generic)
335343-- | `PGenum` @(@`LabelsPG` @hask)@
336344type instance PG (Enumerated hask) = 'PGenum (LabelsPG hask)
337345
@@ -343,7 +351,8 @@ PG (VarArray (Vector Double)) :: PGType
343351= 'PGvararray ('NotNull 'PGfloat8)
344352-}
345353newtype VarArray arr = VarArray {getVarArray :: arr}
346− deriving (Eq, Ord, Show, Read, GHC.Generic)
354+ deriving stock (Eq, Ord, Show, Read, GHC.Generic)
355+ deriving anyclass (SOP.HasDatatypeInfo, SOP.Generic)
347356-- | `PGvararray` @(@`NullPG` @hask)@
348357type instance PG (VarArray (Vector hask)) = 'PGvararray (NullPG hask)
349358type instance PG (VarArray [hask]) = 'PGvararray (NullPG hask)
@@ -356,6 +365,14 @@ PG (FixArray ((Double, Double), (Double, Double))) :: PGType
356365= 'PGfixarray '[2, 2] ('NotNull 'PGfloat8)
357366-}
358367newtype FixArray arr = FixArray {getFixArray :: arr}
359− deriving (Eq, Ord, Show, Read, GHC.Generic)
368+ deriving stock (Eq, Ord, Show, Read, GHC.Generic)
369+ deriving anyclass (SOP.HasDatatypeInfo, SOP.Generic)
360370-- | `PGfixarray` @(@`DimPG` @hask) (@`FixPG` @hask)@
361371type instance PG (FixArray hask) = 'PGfixarray (DimPG hask) (FixPG hask)
372+
373+{- | Object identifiers (`Oid`s) are used internally by PostgreSQL
374+as primary keys for various system tables.
375+-}
376+newtype Oid = Oid { getOid :: Word32 }
377+ deriving stock (Eq, Ord, Show, Read, GHC.Generic)
378+ deriving anyclass (SOP.HasDatatypeInfo, SOP.Generic)