Re: [Haskell] generic catch in a MonadIO

2006-02-08 Thread Andrew Pimlott
On Wed, Feb 08, 2006 at 12:59:48AM -0500, David Menendez wrote: Since the monad transformers in MTL all promote MonadError, you can also use throwError and catchError with instances of MonadIO. Currently, the error type associated with IO is IOError, not Exception, but it should be possible to

[Haskell] generic catch in a MonadIO

2006-02-07 Thread oleg
The ability to use functions 'catch', 'bracket', 'catchDyn', etc. in MonadIO other than IO itself has been a fairly frequently requested feature: http://www.haskell.org/pipermail/glasgow-haskell-users/2003-September/005660.html http://haskell.org/pipermail/libraries/2003-February/000774.html

Re: [Haskell] generic catch in a MonadIO

2006-02-07 Thread David Menendez
[EMAIL PROTECTED] writes: The implementation is quite trivial. class MonadIO m = CaughtMonadIO m where gcatch :: m a - (Exception - m a) - m a instance CaughtMonadIO IO where gcatch = Control.Exception.catch instance (CaughtMonadIO m, Error e) = CaughtMonadIO (ErrorT e m)