Inconsistent treatment of overlap between type and kind variables in type families
The following code compiles on 7.7.20121031:
type family Foo (x :: *) (y :: x)
type instance Foo Bool Int = Int
After some poking around, I discovered that GHC is treating the type variable x
and the kind variable x
as distinct. In core, Foo has three arguments.
The following code does not compile:
type family Bar (x :: *) :: x
The error is
Type variable `x' used in a kind
In the kind `x'
I can see arguments in favor of either of the above treatments (separate namespaces for type and kind variables vs. unified namespace), but the current implementation seems inconsistent to me.
Trac metadata
Trac field | Value |
---|---|
Version | 7.7 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |