
This question from John Meacham is really a Libraries Team question. Should the MonadIO class get an extra method? His case looks plausible to me. Simon -----Original Message----- From: John Meacham [mailto:john@repetae.net] Sent: 28 January 2003 06:35 To: haskell@haskell.org Subject: MonadIO needs catch? while genericizing my utility libraries to work within any MonadIO (http://haskell.cs.yale.edu/ghc/docs/latest/html/base/Control.Monad.Tran s.html) I ran into a problem, 'liftIO' is not powerful enough to catch exceptions in a MonadIO. the closest one can get is
genCatch :: MonadIO m => IO a -> (Exception -> IO a) -> m a when we want.. genCatch :: MonadIO m => m a -> (Exception -> m a) -> m a
The only way i can think of to solve this is add 'catch' (perhaps 'catchIO'? 'genCatch'?) to the MonadIO class. some open questions are whether it is possible to implement catch for any MonadIO? I would think so, since you need only store the 'internal state' of your monad at the genCatch and continue with that if an exception was raised. (this might mix badly with other extensions though?) at worst a MonadIOCatchable deriving from MonadIO could be added... John -- ------------------------------------------------------------------------ --- John Meacham - California Institute of Technology, Alum. - john@foo.net ------------------------------------------------------------------------ --- _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell