@@ -10,10 +10,12 @@ Stability: experimental
11{-# LANGUAGE
11{-# LANGUAGE
12 AllowAmbiguousTypes
12 AllowAmbiguousTypes
13 , DeriveFoldable
14 , DeriveFoldable
14 , DeriveFunctor
15 , DeriveFunctor
15 , DeriveGeneric
16 , DeriveGeneric
16 , DeriveTraversable
17 , DeriveTraversable
17 , DefaultSignatures
19 , DefaultSignatures
18 , FlexibleContexts
20 , FlexibleContexts
19 , FlexibleInstances
21 , FlexibleInstances
@@ -45,6 +47,7 @@ module Squeal.PostgreSQL.PG
45 , Enumerated (..)
47 , Enumerated (..)
46 , VarArray (..)
48 , VarArray (..)
47 , FixArray (..)
49 , FixArray (..)
48 -- * Type families
51 -- * Type families
49 , LabelsPG
52 , LabelsPG
@@ -105,7 +108,7 @@ type instance PG Int32 = 'PGint4
105-- | `PGint8`
108-- | `PGint8`
106type instance PG Int64 = 'PGint8
109type instance PG Int64 = 'PGint8
107-- | `PGint2`
110-- | `PGint2`
108−type instance PG Word32 = 'PGoid
111+type instance PG Oid = 'PGoid
109-- | `PGnumeric`
112-- | `PGnumeric`
110type instance PG Scientific = 'PGnumeric
113type instance PG Scientific = 'PGnumeric
111-- | `PGfloat4`
114-- | `PGfloat4`
@@ -299,7 +302,8 @@ withConnection "host=localhost port=5432 dbname=exampledb" $ do
301newtype Money = Money { cents :: Int64 }
304newtype 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)
303-- | `PGmoney`
307-- | `PGmoney`
304type instance PG Money = 'PGmoney
308type instance PG Money = 'PGmoney
@@ -307,7 +311,8 @@ type instance PG Money = 'PGmoney
307type it's applied to should be stored as a `PGjson`.
311type it's applied to should be stored as a `PGjson`.
309newtype Json hask = Json {getJson :: hask}
313newtype 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)
311-- | `PGjson`
316-- | `PGjson`
312type instance PG (Json hask) = 'PGjson
317type instance PG (Json hask) = 'PGjson
@@ -315,7 +320,8 @@ type instance PG (Json hask) = 'PGjson
315type it's applied to should be stored as a `PGjsonb`.
320type it's applied to should be stored as a `PGjsonb`.
317newtype Jsonb hask = Jsonb {getJsonb :: hask}
322newtype 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)
319-- | `PGjsonb`
325-- | `PGjsonb`
320type instance PG (Jsonb hask) = 'PGjsonb
326type instance PG (Jsonb hask) = 'PGjsonb
@@ -323,7 +329,8 @@ type instance PG (Jsonb hask) = 'PGjsonb
323type it's applied to should be stored as a `PGcomposite`.
329type it's applied to should be stored as a `PGcomposite`.
325newtype Composite record = Composite {getComposite :: record}
331newtype 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)
327-- | `PGcomposite` @(@`RowPG` @hask)@
334-- | `PGcomposite` @(@`RowPG` @hask)@
328type instance PG (Composite hask) = 'PGcomposite (RowPG hask)
335type instance PG (Composite hask) = 'PGcomposite (RowPG hask)
@@ -331,7 +338,8 @@ type instance PG (Composite hask) = 'PGcomposite (RowPG hask)
331type it's applied to should be stored as a `PGenum`.
338type it's applied to should be stored as a `PGenum`.
333newtype Enumerated enum = Enumerated {getEnumerated :: enum}
340newtype 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)
335-- | `PGenum` @(@`LabelsPG` @hask)@
343-- | `PGenum` @(@`LabelsPG` @hask)@
336type instance PG (Enumerated hask) = 'PGenum (LabelsPG hask)
344type instance PG (Enumerated hask) = 'PGenum (LabelsPG hask)
@@ -343,7 +351,8 @@ PG (VarArray (Vector Double)) :: PGType
343= 'PGvararray ('NotNull 'PGfloat8)
351= 'PGvararray ('NotNull 'PGfloat8)
345newtype VarArray arr = VarArray {getVarArray :: arr}
353newtype 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)
347-- | `PGvararray` @(@`NullPG` @hask)@
356-- | `PGvararray` @(@`NullPG` @hask)@
348type instance PG (VarArray (Vector hask)) = 'PGvararray (NullPG hask)
357type instance PG (VarArray (Vector hask)) = 'PGvararray (NullPG hask)
349type instance PG (VarArray [hask]) = 'PGvararray (NullPG hask)
358type instance PG (VarArray [hask]) = 'PGvararray (NullPG hask)
@@ -356,6 +365,14 @@ PG (FixArray ((Double, Double), (Double, Double))) :: PGType
356= 'PGfixarray '[2, 2] ('NotNull 'PGfloat8)
365= 'PGfixarray '[2, 2] ('NotNull 'PGfloat8)
358newtype FixArray arr = FixArray {getFixArray :: arr}
367newtype 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)
360-- | `PGfixarray` @(@`DimPG` @hask) (@`FixPG` @hask)@
370-- | `PGfixarray` @(@`DimPG` @hask) (@`FixPG` @hask)@
361type instance PG (FixArray hask) = 'PGfixarray (DimPG hask) (FixPG hask)
371type instance PG (FixArray hask) = 'PGfixarray (DimPG hask) (FixPG hask)
373+{- | Object identifiers (`Oid`s) are used internally by PostgreSQL
374+as primary keys for various system tables.
376+newtype Oid = Oid { getOid :: Word32 }
377+ deriving stock (Eq, Ord, Show, Read, GHC.Generic)
378+ deriving anyclass (SOP.HasDatatypeInfo, SOP.Generic)