There are too many error handling conventions used in library code!

Simon Marlow simonmarhaskell at gmail.com
Wed Mar 14 09:33:58 EDT 2007


ajb at spamcop.net wrote:

> 6. throwDyn
> 7. ioError and catch

Since deprecating throwDyn was mentioned, I should say that the plan I've had in 
mind has been to merge (6) and (7) by using the Exception class:

http://hackage.haskell.org/cgi-bin/haskell-prime/trac.cgi/wiki/ExtensibleExceptions
http://www.haskell.org/~simonmar/papers/ext-exceptions.pdf

So there would be just one throw & catch, and you would be able to use them with 
  arbitrary types.  The scheme suggested in the paper is not completely 
satisfactory, and various people have suggested ways to simplify it, so it needs 
some reworking before I'd call it a proposal though.

Just to clarify something I've seen mentioned: throwDyn is *not* tied to the IO 
monad, since it has type Typeable ex => ex -> a.  However, you can only catch it 
in the IO monad.  So you should think of it as a version of 'error' that you can 
use with something other than String.

Cheers,
	Simon



More information about the Libraries mailing list