logo       

non-intuitive error message in ghci: msg#00012

lang.haskell.glasgow.bugs

Subject: non-intuitive error message in ghci

When we'd try to evaluate a finite map at the prompt, we get an error
about there not being a show instance:

Prelude> :m Data.FiniteMap
Prelude Data.FiniteMap> emptyFM

No instance for (Show (FiniteMap key elt))
arising from use of `print' at <No locn>
In a 'do' expression pattern binding: print it


However, if we have Control.Exception in scope, we get a very different
message:

Prelude> :m Prelude Control.Exception Data.FiniteMap
Data.FiniteMap Control.Exception Prelude> emptyFM

No instance for (Monad (FiniteMap key))
arising from use of `print' at <No locn>
In a 'do' expression: print it


Presumably this is because Control.Exception introduces some instance of
Monad which then confuses the environment. It took me a while to figure
this out and I can imagine that it would be confusing to other people
too.

Is there any (relatively easy) way to get it to report the "real" error
message?

- Hal

--
Hal Daume III | hdaume@xxxxxxx
"Arrest this man, he talks in maths." | www.isi.edu/~hdaume


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise