Fixing MonadIO

Judah Jacobson judah.jacobson at gmail.com
Mon Feb 4 19:53:28 EST 2008


On Mon, Feb 4, 2008 at 8:25 AM, Simon Marlow <simonmarhaskell at gmail.com> wrote:
> Yitzchak Gale wrote:
>  > Simon Marlow wrote:
>  >>  Avoiding
>  >> exceptions because MonadIO has trouble with them is not a good enough
>  >> reason, IMO.  We should fix MonadIO instead.
>  >
>  > I'm all for it!
>  >
>  > Below is a summary of the three approaches
>  > that have been proposed, as far as I can remember:
>  >
>  > 1. Make the functions in Control.Exception more polymorphic.
>  >    This is part of the more general program of providing polymorphic
>  >    IO described in Haskell' ticket 110. Brian Hulley attached to that
>  >    ticket a version of Control.Exception that does this by introducing
>  >    the MonadException subclass of MonadIO.
>  >
>  >    http://hackage.haskell.org/trac/haskell-prime/attachment/ticket/110/Exception.txt
>
>  Correct me if I'm wrong, but it doesn't seem to be necessary to modify
>  Control.Exception directly in order to adopt this proposal.  The new module
>  could be provided as Control.Monad.IO.Exception (for example) in the mtl
>  package.  No changes to the base package are required to make this
>  functionality available to everyone.  Right?
>
>  If so, this seems like the smoothest way to address the problem.

Of the three possibilities listed by Yitzchak, I'm most in favor of
adding Brian Hulley's module to the mtl package.  (In particular, I've
decided that I like it more than my own, earlier proposal.)

The only change that I'd make would be to remove
setUncaughtExceptionHandler from the MonadException class; it's
GHC-specific, and I'm not sure how useful having it in arbitrary
MonadIO would be anyway.

Best,
-Judah


More information about the Libraries mailing list