#3613: Better error messages for do-notation
----------------------------------------+-----------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 7.0.1
Component: Compiler (Type checker) | Version: 6.10.4
Keywords: | Testcase:
Blockedby: | Difficulty: Unknown
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: Incorrect warning at
compile-time
----------------------------------------+-----------------------------------
Changes (by michalt):
* cc: michal.terep...@… (added)
* failure: => Incorrect warning at compile-time
Comment:
This seems to work fine with HEAD (i.e. even with (>>=)).
So adding the following to the original examples:
{{{
> fun1' = let fooThen m = foo>> m
> in fooThen (bar>>= \x -> undefined)
>
> fun2' = let fooThen m = foo>> m
> in fooThen (do {x <- bar; undefined})
}}}
I get:
* for fun1:
{{{
Couldn't match expected type `Maybe a' with actual type `IO ()'
In the first argument of `(>>)', namely `bar'
}}}
* for fun2:
{{{
Couldn't match expected type `Maybe a' with actual type `IO ()'
In a stmt of a 'do' expression: bar
}}}
* for fun1':
{{{
Couldn't match expected type `Maybe a' with actual type `IO ()'
In the first argument of `(>>=)', namely `bar'
}}}
* and finally for fun2':
{{{
Couldn't match expected type `Maybe a' with actual type `IO ()'
In a stmt of a 'do' expression: x <- bar
}}}
Which seems ok to me. So unless I'm missing something the ticket can be
closed as fixed..?
Just for the record:
{{{
> ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.1.20101008
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3613#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs