RFC: Type-class type signatures (:: Constraint)
Data types can be defined:
data A a b
-- or
data A (a :: Bool) (b :: Type)
-- or
data A (a :: Bool) (b :: Type) :: Type
-- or
data A :: Bool -> Type -> Type
data B :: Type
while type classes can't:
class A a b
-- or
class A (a :: Bool) (b :: Type)
-- but not
-- class A (a :: Bool) (b :: Type) :: Constraint
-- nor
-- class A :: Bool -> Type -> Constraint
-- class B :: Constraint
I foresee problems with how to bind a and b, but adding a final :: Constraint should be legal:
class A a b :: Constraint
class A (a :: Bool) (b :: Type) :: Constraint
class B :: Constraint
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |