non-intuitive error message in ghci

Hal Daume t-hald at microsoft.com
Mon Aug 11 15:55:58 EDT 2003


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 at isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume



More information about the Glasgow-haskell-bugs mailing list