[Haskell-cafe] More powerful error handling

Henning Thielemann lemming at henning-thielemann.de
Mon Feb 18 05:58:39 EST 2008


On Sun, 17 Feb 2008, Philippa Cowderoy wrote:

> The nicest use would be for converting between a more specific error type
> and a more general one that handles a wider range of errors - enabling us
> to keep tighter track of which errors are possible in a given piece of
> code. Bonus points for using it together with polymorphic variants where
> rethrow becomes rather trivial.

I guess it's about exception handling, not error handling, right?

I thought that must be possible by plugging various exception types
together, say

data CustomException =
     IOExc      IOError
   | NetworkExc NetworkException
   | ThreadExc  ThreadingException

Now you can turn any IOError to CustomException by wrapping it with IOExc.


More information about the Haskell-Cafe mailing list