Simon Marlow simonmar at microsoft.com
Tue Apr 11 08:24:07 EDT 2006

Attached is another variant of the extensible exceptions idea, it
improves on the previous designs in a couple of ways:  there's only one
catch & throw, regardless of what type you're throwing or catching.
There is an extensible hierarchy of exceptions, and you can catch and
re-throw subclasses of exceptions.

So this design contains a dynamically-typed extensible hierarchy, but
it's fairly lightweight.  Adding a new leaf exception type requires 3
lines + 1 line for each superclass (just 1 line for a top level leaf, as
before).  Adding a new node requires about 10 lines + 1 line for each
superclass, msotly boilerplate.

Perhaps the type class hackers can do better than this!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Exception-2.hs
Type: application/octet-stream
Size: 5432 bytes
Desc: Exception-2.hs
Url : http://www.haskell.org//pipermail/haskell-prime/attachments/20060411/15157ba9/Exception-2-0001.obj

More information about the Haskell-prime mailing list