[Haskell-cafe] Extensible Exceptions

Henning Thielemann lemming at henning-thielemann.de
Sat Nov 22 16:00:08 EST 2008

On Sat, 22 Nov 2008, Thomas Schilling wrote:

> Be careful, though.  This only works if there's a single constructor
> for your exception type. If there are multiple, you should write it
> like this:
>  thing_to_try `catch` \(e :: MyErrorType) -> case e of MyError1 _ ->
> ..; MyError2 _ -> ...
> If you write `catch` (MyError1 ...) and a MyError2 is thrown, you will
> get a pattern match error exception.

A "pattern match exception" or "pattern match error"? I mean, not handling 
a certain pattern is a programming error not an exceptional condition at 
runtime. Thus there is no need to throw a "pattern match exception" which 
is catched and handled somewhere else.

More information about the Haskell-Cafe mailing list