MonadCatchIO-mtl 0.3.0.4 → 0.3.0.5
raw patch · 2 files changed
+11/−11 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Control/Monad/CatchIO.hs +9/−9
- MonadCatchIO-mtl.cabal +2/−2
Control/Monad/CatchIO.hs view
@@ -8,7 +8,7 @@ where -import Prelude hiding ( catch )+import Prelude import qualified Control.Exception.Extensible as E @@ -43,7 +43,7 @@ -- | Generalized version of 'E.catches' catches :: MonadCatchIO m => m a -> [Handler m a] -> m a-catches a handlers = a `catch` handler+catches a handlers = a `Control.Monad.CatchIO.catch` handler where handler e = foldr tryH (throw e) handlers where tryH (Handler h) res = case E.fromException e of Just e' -> h e'@@ -57,36 +57,36 @@ instance MonadCatchIO m => MonadCatchIO (ReaderT r m) where m `catch` f = ReaderT $ \r -> (runReaderT m r)- `catch` (\e -> runReaderT (f e) r)+ `Control.Monad.CatchIO.catch` (\e -> runReaderT (f e) r) block = mapReaderT block unblock = mapReaderT unblock instance MonadCatchIO m => MonadCatchIO (StateT s m) where m `catch` f = StateT $ \s -> (runStateT m s)- `catch` (\e -> runStateT (f e) s)+ `Control.Monad.CatchIO.catch` (\e -> runStateT (f e) s) block = mapStateT block unblock = mapStateT unblock instance (MonadCatchIO m, Error e) => MonadCatchIO (ErrorT e m) where- m `catch` f = mapErrorT (\m' -> m' `catch` (\e -> runErrorT $ f e)) m+ m `catch` f = mapErrorT (\m' -> m' `Control.Monad.CatchIO.catch` (\e -> runErrorT $ f e)) m block = mapErrorT block unblock = mapErrorT unblock instance (Monoid w, MonadCatchIO m) => MonadCatchIO (WriterT w m) where m `catch` f = WriterT $ runWriterT m- `catch` \e -> runWriterT (f e)+ `Control.Monad.CatchIO.catch` \e -> runWriterT (f e) block = mapWriterT block unblock = mapWriterT unblock instance (Monoid w, MonadCatchIO m) => MonadCatchIO (RWST r w s m) where m `catch` f = RWST $ \r s -> runRWST m r s- `catch` \e -> runRWST (f e) r s+ `Control.Monad.CatchIO.catch` \e -> runRWST (f e) r s block = mapRWST block unblock = mapRWST unblock throw = liftIO . E.throwIO -try a = catch (a >>= \ v -> return (Right v)) (\e -> return (Left e))+try a = Control.Monad.CatchIO.catch (a >>= \ v -> return (Right v)) (\e -> return (Left e)) tryJust p a = do r <- try a@@ -143,7 +143,7 @@ -- | Generalized version of 'E.onException' onException :: MonadCatchIO m => m a -> m b -> m a-onException a onEx = a `catch` (\e -> onEx >> throw (e::E.SomeException))+onException a onEx = a `Control.Monad.CatchIO.catch` (\e -> onEx >> throw (e::E.SomeException)) _void :: Monad m => m a -> m () _void a = a >> return ()
MonadCatchIO-mtl.cabal view
@@ -1,5 +1,5 @@ name: MonadCatchIO-mtl-version: 0.3.0.4+version: 0.3.0.5 description: Provides a monad-transformer version of the @Control.Exception.catch@ function. For this, it defines the @MonadCatchIO@ class, a subset of@@ -15,7 +15,7 @@ cabal-version: >= 1.2 build-type: Simple-tested-with: GHC==6.10+tested-with: GHC==6.12.3, GHC==7.0.3, GHC==7.2.1, GHC==7.4.2, GHC==7.6.0 Library build-depends: base < 5, mtl, extensible-exceptions