on dev help sign in
createTypeEnumWith
commite027edec0fa22ebffedbbcafe973339a843d4c2e authorEitan Chatav <eitan.chatav@gmail.com> dateFri 1 Jun 2018, 14:18 (8 years ago) parent7555538
2 files changed+7−17
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+5−15 squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+2−2
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+5−15
@@ -9,7 +9,8 @@ Squeal data definition language.
99-}
1010
1111{-# LANGUAGE
12− ConstraintKinds
12+ AllowAmbiguousTypes
13+ , ConstraintKinds
1314 , DeriveGeneric
1415 , FlexibleContexts
1516 , FlexibleInstances
@@ -793,25 +794,14 @@ createTypeEnum enum labels = UnsafeDefinition $
793794
794795class
795796 ( SOP.IsEnumType hask
796− , PGenumWith hask ~ 'PGenum labels
797+ , SOP.All KnownSymbol (PGenumWith hask)
797798 ) => HasPGenum hask where
798799 createTypeEnumWith
799800 :: KnownSymbol enum
800801 => Alias enum
801− -> Definition schema (Create enum ('Typedef (PGenumWith hask)) schema)
802+ -> Definition schema (Create enum ('Typedef ('PGenum (PGenumWith hask))) schema)
802803 createTypeEnumWith enum = createTypeEnum enum
803− (SOP.hpure label :: NP PGlabel labels)
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)
804+ (SOP.hpure label :: NP PGlabel (PGenumWith hask))
815805
816806createType
817807 :: (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
695695 PG (NetAddr IP) = 'PGinet
696696 PG Value = 'PGjson
697697
698−type family PGenumWith (hask :: Type) :: PGType where
698+type family PGenumWith (hask :: Type) :: [Type.ConstructorName] where
699699 PGenumWith hask =
700− 'PGenum (ConstructorNamesOf (ConstructorsOf (SOP.DatatypeInfoOf hask)))
700+ ConstructorNamesOf (ConstructorsOf (SOP.DatatypeInfoOf hask))
701701
702702type family PGcompositeWith (hask :: Type) :: PGType where
703703 PGcompositeWith hask =