I've started work on a module to replace Control.Exception by wrapping all
the original Control.Exception functions in more general monadic functions
and using two type classes as follows:
class MonadIO m => MonadException m where
catch :: m a -> (Exception -> m a) -> m a
catchDyn :: Typeable exception => m a -> (exception -> m a) -> m a
catchJust :: (Exception -> Maybe b) -> m a -> (b -> m a) -> m a
try :: m a -> m (Either Exception a)
tryJust :: (Exception -> Maybe b) -> m a -> m (Either b a)
and
class MonadIO m => MonadIOU m where
getUnliftIO :: m (m a -> IO a)
All the other functions can be implemented just using MonadIO or MonadIOU or
MonadException in place of IO (depending on the function eg bracket needs
MonadIOU) - just in case anyone is interested.
As far as I can tell this seems to be the one and only way to do it with the
minimal sized classes but I'd be interested if anyone has found a better
way.
Regards, Brian.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe