Proposal: Extensible exceptions
Ian Lynagh
igloo at earth.li
Fri Jul 4 15:14:27 EDT 2008
On Fri, Jul 04, 2008 at 09:17:47PM +0400, Bulat Ziganshin wrote:
> Friday, July 4, 2008, 5:29:24 PM, you wrote:
>
> > This is a proposal to replace the current exception mechanism in the
> > base library with extensible exceptions.
>
> extensible exceptions, records and syntax are my favorite
> missing-in-haskell-garden pets, so my +1000
>
> syntax to defining new exceptions is a bit too fat, but it's probably
> impossible to use something more direct and consistent like it's done in
> OOP languages?
If you have alternative suggestions, now is the time to propose them!
> is it planned to be included in 6.10?
Yes.
> how it will work with legacy
> code, in particular libraries developed with old base in mind?
If you import Control.OldException instead of Control.Exception then it
will be identical.
But fixing old code to work with the new library is very easy (e.g.
changing catch to catchAny if you get an ambiguous type variable), and
as Simon pointed out, places were you actually have to make changes
could do with being sanity checked anyway.
> how
> mixed code (throwing/catching exceptions in old and new styles) will
> work together?
The new catch will catch all the old exceptions.
The old catch will catch all the old types of exception thrown by the
new throw.
Thanks
Ian
More information about the Libraries
mailing list