@@ -115,9 +115,7 @@ module Squeal.PostgreSQL.Schema
115115 , Composite (..)
116116 , Enumerated (..)
117117 , NullPG
118− , EnumFrom
119118 , LabelsFrom
120− , CompositeFrom
121119 , RowPG
122120 , RowOf
123121 , FieldPG
@@ -722,26 +720,13 @@ type instance PG (hask, hask, hask, hask, hask, hask, hask, hask, hask)
722720type instance PG (hask, hask, hask, hask, hask, hask, hask, hask, hask, hask)
723721 = 'PGfixarray 10 (NullPG hask)
724722type instance PG (Composite hask) = 'PGcomposite (RowOf (RecordCodeOf hask))
725−type instance PG (Enumerated hask)
726− = 'PGenum (ConstructorNamesOf (ConstructorsOf (DatatypeInfoOf hask)))
723+type instance PG (Enumerated hask) = 'PGenum (LabelsFrom hask)
727724
728725newtype Json hask = Json {getJson :: hask}
729726newtype Jsonb hask = Jsonb {getJsonb :: hask}
730727newtype Composite record = Composite {getComposite :: record}
731728newtype Enumerated enum = Enumerated {getEnumerated :: enum}
732729
733−-- | The `EnumFrom` type family embeds Haskell enum types, ADTs with
734−-- nullary constructors, as Postgres enum types
735−--
736−-- >>> data Schwarma = Beef | Lamb | Chicken deriving GHC.Generic
737−-- >>> instance Generic Schwarma
738−-- >>> instance HasDatatypeInfo Schwarma
739−-- >>> :kind! EnumFrom Schwarma
740−-- EnumFrom Schwarma :: PGType
741−-- = 'PGenum '["Beef", "Lamb", "Chicken"]
742−type family EnumFrom (hask :: Type) :: PGType where
743− EnumFrom hask = PG (Enumerated hask)
744−
745730-- | The `LabelsFrom` type family calculates the constructors of a
746731-- Haskell enum type.
747732--
@@ -755,20 +740,6 @@ type family LabelsFrom (hask :: Type) :: [Type.ConstructorName] where
755740 LabelsFrom hask =
756741 ConstructorNamesOf (ConstructorsOf (DatatypeInfoOf hask))
757742
758−-- | The `CompositeFrom` type family embeds Haskell record types as
759−-- Postgres composite types, as long as the record fields
760−-- are `Maybe`s of Haskell types that can be embedded as basic types
761−-- with the `PG` type family.
762−--
763−-- >>> data Row = Row { a :: Maybe Int16, b :: Maybe LocalTime } deriving GHC.Generic
764−-- >>> instance Generic Row
765−-- >>> instance HasDatatypeInfo Row
766−-- >>> :kind! CompositeFrom Row
767−-- CompositeFrom Row :: PGType
768−-- = 'PGcomposite '["a" ::: 'Null 'PGint2, "b" ::: 'Null 'PGtimestamp]
769−type family CompositeFrom (hask :: Type) :: PGType where
770− CompositeFrom hask = PG (Composite hask)
771−
772743type family RowPG (hask :: Type) :: RowType where
773744 RowPG hask = RowOf (RecordCodeOf hask)
774745