"Fail: unknown exception"

Simon Marlow simonmar at microsoft.com
Tue Dec 16 16:36:10 EST 2003

> This has to be one of the most irritating ways a program can 
> fall over.
> Can't the Haskell RTS try just a /little/ harder to help the poor
> programmer?  For example by saying what sort of exception it is, and
> (if it's a dynamic exception) what type it has?

An "unknown exception" is a dynamic exception.  GHC just uses the
ordinary instance of Show on Exception to print out the value of an
exception, and it so happens that all it prints out for a dynamic
exception is "unknown exception".

Arguably the show instance should print out the type too.  It could; I
just looked into it and unfortunately there's an annoying module loop in
the libraries which means doing this would entail some restructuring.

Why can't GHCi just print out the type itself?  Because it has to be
done in the context of the interpreted program, which means GHCi would
have to compile a little snippet of code to show the exception.
Annoying, but doable.


More information about the Glasgow-haskell-users mailing list