on dev help sign in
createTypeEnumWith
e027edeEitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+5−15
@@ -9,7 +9,8 @@ Squeal data definition language.
9-}
9-}
10
10
11{-# LANGUAGE
11{-# LANGUAGE
12+ AllowAmbiguousTypes
12− ConstraintKinds
13+ , ConstraintKinds
13 , DeriveGeneric
14 , DeriveGeneric
14 , FlexibleContexts
15 , FlexibleContexts
15 , FlexibleInstances
16 , FlexibleInstances
@@ -793,25 +794,14 @@ createTypeEnum enum labels = UnsafeDefinition $
793
794
794class
795class
795 ( SOP.IsEnumType hask
796 ( SOP.IsEnumType hask
796− , PGenumWith hask ~ 'PGenum labels
797+ , SOP.All KnownSymbol (PGenumWith hask)
797 ) => HasPGenum hask where
798 ) => HasPGenum hask where
798 createTypeEnumWith
799 createTypeEnumWith
799 :: KnownSymbol enum
800 :: KnownSymbol enum
800 => Alias enum
801 => Alias enum
801− -> Definition schema (Create enum ('Typedef (PGenumWith hask)) schema)
802+ -> Definition schema (Create enum ('Typedef ('PGenum (PGenumWith hask))) schema)
802 createTypeEnumWith enum = createTypeEnum enum
803 createTypeEnumWith enum = createTypeEnum enum
803− (SOP.hpure label :: NP PGlabel labels)
804+ (SOP.hpure label :: NP PGlabel (PGenumWith hask))
804−-- createTypeEnumWith
805−-- :: forall enum labels hask proxy schema
806−-- . ( KnownSymbol enum
807−-- , SOP.All KnownSymbol labels
808−-- , SOP.IsEnumType hask
809−-- , labels ~ DatatypeLabels (SOP.DatatypeInfoOf hask) )
810−-- => Alias enum
811−-- -> proxy hask
812−-- -> Definition schema (Create enum ('Typedef ('PGenum labels)) schema)
813−-- createTypeEnumWith enum _ = createTypeEnum enum
814−-- (SOP.hpure label :: NP PGlabel labels)
815
805
816createType
806createType
817 :: (KnownSymbol comp, SOP.SListI fields)
807 :: (KnownSymbol comp, SOP.SListI fields)
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+2−2
@@ -695,9 +695,9 @@ type family PG (hask :: Type) = (pg :: PGType) | pg -> hask where
695 PG (NetAddr IP) = 'PGinet
695 PG (NetAddr IP) = 'PGinet
696 PG Value = 'PGjson
696 PG Value = 'PGjson
697
697
698−type family PGenumWith (hask :: Type) :: PGType where
698+type family PGenumWith (hask :: Type) :: [Type.ConstructorName] where
699 PGenumWith hask =
699 PGenumWith hask =
700− 'PGenum (ConstructorNamesOf (ConstructorsOf (SOP.DatatypeInfoOf hask)))
700+ ConstructorNamesOf (ConstructorsOf (SOP.DatatypeInfoOf hask))
701
701
702type family PGcompositeWith (hask :: Type) :: PGType where
702type family PGcompositeWith (hask :: Type) :: PGType where
703 PGcompositeWith hask =
703 PGcompositeWith hask =