Higher-rank constraint treated as type instead
When I say
{-# LANGUAGE RankNTypes #-}
module Bug where
class P z
foo :: (forall b. P (a, b)) => a -> a
foo x = x
I get
Bug.hs:7:9:
Couldn't match expected type ‘a -> a’ with actual type ‘P (a, b0)’
Relevant bindings include
x :: forall b. P (a, b) (bound at Bug.hs:7:5)
foo :: (forall b. P (a, b)) -> a -> a (bound at Bug.hs:7:1)
In the expression: x
In an equation for ‘foo’: foo x = x
I expected my code to be rejected, but not with that error message. It seems that GHC thinks forall b. P (a, b)) has kind *, not kind Constraint.
Encountered while experimenting with #9195 (closed).
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |