Misleading error message for higher rank type
Consider
foo :: (forall a b. C a b => b -> b) -> Int
foo = error "urk"
With GHC (for ages, incl 8.6) we get
• Could not deduce (C a0 b)
from the context: C a b
bound by the type signature for:
foo :: forall a b. C a b => b -> b <======= Not true!
at Foo.hs:7:8-43
The type variable ‘a0’ is ambiguous
• In the ambiguity check for ‘foo’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the type signature: foo :: (forall a b. C a b => b -> b) -> Int
But foo's type signature is NOT foo :: forall a b. C a b => b -> b!!
Let's fix this.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |