Exceptions

John Goerzen jgoerzen at complete.org
Fri Apr 7 11:00:21 EDT 2006


On Fri, Apr 07, 2006 at 03:49:40PM +0100, Simon Marlow wrote:
> John, have you seen this?
> 
> http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/Extensible
> Exceptions

Yes, and maybe I'm missing something, but I don't think it quite helps.
I followed the link to the example page at:

http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/browser/HaskellPrime/Exception.hs

Down towards the bottom, there is a definition of ArithException, and an
example where it is used to throw Control.Exception.DivideByZero.

But here's my concern.  Let's say that I wanted to, for some reason,
create a MultiplyByZero exception.  It should be broadly considered an
ArithException, and any code that catches an ArithException should be
able to catch my MultiplyByZero exception.

But the ArithException type is limited to storing errors that are
defined by Control.Exception.ArithException.  My MultiplyByZero is not
defined there, so I am out of luck.  The best I could do is define a new
MultiplyByZero, and catch it in my own code.  But any code that others
have written to catch ArithExceptions would be blind to MultiplyByZero.


-- John


More information about the Haskell-prime mailing list