
14 Aug
2004
14 Aug
'04
5:11 a.m.
On Fri, 13 Aug 2004 15:32:51 -0700, Lyle Kopnicky
Simon,
That makes good sense, as it's hard to read code that contains standard terms used in a nonstandard way. I was just concerned that the function name I wanted to use was already in the Prelude! Perhaps the Prelude 'catch', I reasoned, could be called 'catchIO', since it is specific to the IO monad, allowing people to write their own 'catch'. Or 'catch' could be a member of a type class, which could be overloaded for any new monad.
If you don't mind non-haskell98 code, you could always use the MonadError class in Control.Monad.Error: class Monad m => MonadError m e | m -> e where throwError :: e -> m a catchError :: m a -> (e -> m a) -> m a /Martin