@@ -794,6 +794,26 @@ type family NullPG (hask :: Type) :: NullityType where
794 NullPG (Maybe hask) = 'Null (PG hask)
794 NullPG (Maybe hask) = 'Null (PG hask)
795 NullPG hask = 'NotNull (PG hask)
795 NullPG hask = 'NotNull (PG hask)
797+type family ParamsOf (hask :: Type) :: [NullityType] where
798+ ParamsOf hask = NullPGs (TupleCodeOf hask (Code hask))
800+type family NullPGs (tuple :: [Type]) :: [NullityType] where
802+ NullPGs (hask ': tuple) = NullPG hask ': NullPGs tuple
804+type family TupleCodeOf (hask :: Type) (code :: [[Type]]) :: [Type] where
805+ TupleCodeOf hask '[tuple] = tuple
806+ TupleCodeOf hask '[] =
808+ ( 'Text "The type `" :<>: 'ShowType hask :<>: 'Text "' is not a tuple type."
809+ :$$: 'Text "It is a void type with no constructors."
811+ TupleCodeOf hask (_ ': _ ': _) =
813+ ( 'Text "The type `" :<>: 'ShowType hask :<>: 'Text "' is not a tuple type."
814+ :$$: 'Text "It is a sum type with more than one constructor."
797-- | Calculates constructors of a datatype.
817-- | Calculates constructors of a datatype.
798type family ConstructorsOf (datatype :: Type.DatatypeInfo)
818type family ConstructorsOf (datatype :: Type.DatatypeInfo)
799 :: [Type.ConstructorInfo] where
819 :: [Type.ConstructorInfo] where