Ticket #2900 (closed bug: fixed)
Confusing error message for monadic function with wrong number of arguments
| Reported by: | tim | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | _|_ |
| Component: | Compiler (Type checker) | Version: | 6.10.1 |
| Keywords: | Cc: | chak | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
If I compile the following code:
import Control.Monad.State foo :: MonadIO m => Int -> m () foo x y = return ()
I get the error message:
bug.hs:6:10:
Couldn't match expected type `()' against inferred type `m ()'
In the expression: return ()
In the definition of `foo': foo x y = return ()
On the other hand, if I change foo's type signature to:
foo :: Int -> IO ()
I get the more helpful:
bug.hs:6:0:
The equation(s) for `foo' have two arguments,
but its type `Int -> IO ()' has only one
It would be good if the second error message appeared in the first case as well.
Change History
Note: See
TracTickets for help on using
tickets.
