Proposal: Extensible exceptions

Judah Jacobson judah.jacobson at gmail.com
Fri Jul 4 14:12:16 EDT 2008


On Fri, Jul 4, 2008 at 10:52 AM, Chris Kuklewicz
<haskell at list.mightyreason.com> wrote:
> Ian Lynagh wrote:
>>
>> The old and new types for catch are:
>>    Old: catch ::                IO a -> (Exception -> IO a) -> IO a
>>    New: catch :: Exception e => IO a -> (e         -> IO a) -> IO a
>> i.e. catch can now catch any type of exception; we don't have to force
>> all the different types of extension into one fixed datatype.
>
> Is there any sane way to allow extending or building equivalents to these
> for MonadIO?
>

MonadIO currently isn't enough to implement catch.  There's been
discussion of this in the past, though; for an example solution, see
the following module from the haskell-prime wiki:

http://hackage.haskell.org/trac/haskell-prime/attachment/ticket/110/Exception.txt

I had been thinking of proposing that a Control.Monad.Exception module
be added to the mtl package, but any discussion on this subject should
probably wait until the extensible exceptions API is nailed down.

-Judah


More information about the Libraries mailing list