Bad error message using poly pat bind with MonoPatBinds
This program:
foo :: a -> a
bar :: a -> a
(foo, bar) = (\x -> x, \y -> y)
main = print $ foo $ bar 1
Is trying to pattern-bind a polymorphic function. The error message is dreadful:
/Users/mbolingbroke/Junk/PolyPatBinds.hs:5:15:
Couldn't match expected type `t -> t1'
with actual type `forall a. a -> a'
The lambda expression `\ x -> x' has one argument one argument,
but its type `forall a. a -> a' has none
In the expression: \ x -> x
In the expression: (\ x -> x, \ y -> y)
The issues are:
- It repeats itself: "one argument one argument"
- It is patently incorrect: the type forall a. a -> a DOES have one argument in the standard nomenclature
- It does not point the user towards the fix (-XNoMonoPatBinds)
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.0.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |