@@ -100,15 +100,13 @@ module Squeal.PostgreSQL.Schema
100100 , PGlabel (..)
101101 , renderLabel
102102 , renderLabels
103− , LabelOf
104− , LabelsOf
105103 -- * Embedding
106104 , PG
107− , EnumWith
108− , LabelsWith
109− , CompositeWith
110− , FieldNamesWith
111− , FieldTypesWith
105+ , EnumFrom
106+ , LabelsFrom
107+ , CompositeFrom
108+ , FieldNamesFrom
109+ , FieldTypesFrom
112110 , ConstructorsOf
113111 , ConstructorNameOf
114112 , ConstructorNamesOf
@@ -682,13 +680,6 @@ renderLabels
682680 :: All KnownSymbol labels => NP PGlabel labels -> [ByteString]
683681renderLabels = hcollapse
684682 . hcmap (Proxy @KnownSymbol) (K . renderLabel)
685−-- | Gets the name of a type constructor
686−type family LabelOf (cons :: Type.ConstructorInfo) :: Symbol where
687− LabelOf ('Type.Constructor name) = name
688−-- | Gets the names of a list of type constructors
689−type family LabelsOf (conss :: [Type.ConstructorInfo]) :: [Symbol] where
690− LabelsOf '[] = '[]
691− LabelsOf (cons ': conss) = LabelOf cons ': LabelsOf conss
692683
693684-- | The `PG` type family embeds a subset of Haskell types
694685-- as Postgres basic types.
@@ -724,32 +715,32 @@ type family PG (hask :: Type) :: PGType where
724715 PG ty = TypeError
725716 ('Text "There is no Postgres basic type for " ':<>: 'ShowType ty)
726717
727−-- | The `EnumWith` type family embeds Haskell enum types, ADTs with
718+-- | The `EnumFrom` type family embeds Haskell enum types, ADTs with
728719-- nullary constructors, as Postgres enum types
729720--
730721-- >>> data Schwarma = Beef | Lamb | Chicken deriving GHC.Generic
731722-- >>> instance Generic Schwarma
732723-- >>> instance HasDatatypeInfo Schwarma
733−-- >>> :kind! EnumWith Schwarma
734−-- EnumWith Schwarma :: PGType
724+-- >>> :kind! EnumFrom Schwarma
725+-- EnumFrom Schwarma :: PGType
735726-- = 'PGenum '["Beef", "Lamb", "Chicken"]
736−type family EnumWith (hask :: Type) :: PGType where
737− EnumWith hask = 'PGenum (LabelsWith hask)
727+type family EnumFrom (hask :: Type) :: PGType where
728+ EnumFrom hask = 'PGenum (LabelsFrom hask)
738729
739−-- | The `LabelsWith` type family calculates the constructors of a
730+-- | The `LabelsFrom` type family calculates the constructors of a
740731-- Haskell enum type.
741732--
742733-- >>> data Schwarma = Beef | Lamb | Chicken deriving GHC.Generic
743734-- >>> instance Generic Schwarma
744735-- >>> instance HasDatatypeInfo Schwarma
745−-- >>> :kind! LabelsWith Schwarma
746−-- LabelsWith Schwarma :: [Type.ConstructorName]
736+-- >>> :kind! LabelsFrom Schwarma
737+-- LabelsFrom Schwarma :: [Type.ConstructorName]
747738-- = '["Beef", "Lamb", "Chicken"]
748−type family LabelsWith (hask :: Type) :: [Type.ConstructorName] where
749− LabelsWith hask =
739+type family LabelsFrom (hask :: Type) :: [Type.ConstructorName] where
740+ LabelsFrom hask =
750741 ConstructorNamesOf (ConstructorsOf (DatatypeInfoOf hask))
751742
752−-- | The `CompositeWith` type family embeds Haskell record types as
743+-- | The `CompositeFrom` type family embeds Haskell record types as
753744-- Postgres composite types, as long as the record fields
754745-- are `Maybe`s of Haskell types that can be embedded as basic types
755746-- with the `PG` type family.
@@ -757,30 +748,30 @@ type family LabelsWith (hask :: Type) :: [Type.ConstructorName] where
757748-- >>> data Row = Row { a :: Maybe Int16, b :: Maybe LocalTime } deriving GHC.Generic
758749-- >>> instance Generic Row
759750-- >>> instance HasDatatypeInfo Row
760−-- >>> :kind! CompositeWith Row
761−-- CompositeWith Row :: PGType
751+-- >>> :kind! CompositeFrom Row
752+-- CompositeFrom Row :: PGType
762753-- = 'PGcomposite '['("a", 'PGint2), '("b", 'PGtimestamp)]
763−type family CompositeWith (hask :: Type) :: PGType where
764− CompositeWith hask =
765− 'PGcomposite (ZipAs (FieldNamesWith hask) (FieldTypesWith hask))
754+type family CompositeFrom (hask :: Type) :: PGType where
755+ CompositeFrom hask =
756+ 'PGcomposite (ZipAs (FieldNamesFrom hask) (FieldTypesFrom hask))
766757
767758-- | >>> data Row = Row { a :: Maybe Int16, b :: Maybe LocalTime } deriving GHC.Generic
768759-- >>> instance Generic Row
769760-- >>> instance HasDatatypeInfo Row
770−-- >>> :kind! FieldNamesWith Row
771−-- FieldNamesWith Row :: [Type.FieldName]
761+-- >>> :kind! FieldNamesFrom Row
762+-- FieldNamesFrom Row :: [Type.FieldName]
772763-- = '["a", "b"]
773−type family FieldNamesWith (hask :: Type) :: [Type.FieldName] where
774− FieldNamesWith hask = FieldNamesOf (FieldsOf (DatatypeInfoOf hask))
764+type family FieldNamesFrom (hask :: Type) :: [Type.FieldName] where
765+ FieldNamesFrom hask = FieldNamesOf (FieldsOf (DatatypeInfoOf hask))
775766
776767-- | >>> data Row = Row { a :: Maybe Int16, b :: Maybe LocalTime } deriving GHC.Generic
777768-- >>> instance Generic Row
778769-- >>> instance HasDatatypeInfo Row
779−-- >>> :kind! FieldTypesWith Row
780−-- FieldTypesWith Row :: [PGType]
770+-- >>> :kind! FieldTypesFrom Row
771+-- FieldTypesFrom Row :: [PGType]
781772-- = '['PGint2, 'PGtimestamp]
782−type family FieldTypesWith (hask :: Type) :: [PGType] where
783− FieldTypesWith hask = FieldTypesOf (RecordCodeOf hask (Code hask))
773+type family FieldTypesFrom (hask :: Type) :: [PGType] where
774+ FieldTypesFrom hask = FieldTypesOf (RecordCodeOf hask (Code hask))
784775
785776-- | Calculates constructors of a datatype.
786777type family ConstructorsOf (datatype :: Type.DatatypeInfo)