Ticket #4940 (closed feature request: fixed)
Bad error message using poly pat bind with MonoPatBinds
| Reported by: | batterseapower | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2.1 |
| Component: | Compiler (Type checker) | Version: | 7.0.1 |
| Keywords: | Cc: | martijn@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Incorrect warning at compile-time | Difficulty: | |
| Test Case: | typecheck/should_compile/T5302 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
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:
1. It repeats itself: "one argument one argument" 2. It is patently incorrect: the type forall a. a -> a DOES have one argument in the standard nomenclature 3. It does not point the user towards the fix (-XNoMonoPatBinds)
Change History
Note: See
TracTickets for help on using
tickets.
