safe-exceptions 0.1.2.0 → 0.1.3.0
raw patch · 3 files changed
+27/−1 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Control.Exception.Safe: catchIO :: MonadCatch m => m a -> (IOException -> m a) -> m a
+ Control.Exception.Safe: handleIO :: MonadCatch m => (IOException -> m a) -> m a -> m a
+ Control.Exception.Safe: tryIO :: MonadCatch m => m a -> m (Either IOException a)
- Control.Exception.Safe: displayException :: Exception e => e -> String
+ Control.Exception.Safe: displayException :: e -> String
- Control.Exception.Safe: fromException :: Exception e => SomeException -> Maybe e
+ Control.Exception.Safe: fromException :: SomeException -> Maybe e
- Control.Exception.Safe: mask :: MonadMask m => ((forall a. m a -> m a) -> m b) -> m b
+ Control.Exception.Safe: mask :: ((forall a. m a -> m a) -> m b) -> m b
- Control.Exception.Safe: toException :: Exception e => e -> SomeException
+ Control.Exception.Safe: toException :: e -> SomeException
- Control.Exception.Safe: uninterruptibleMask :: MonadMask m => ((forall a. m a -> m a) -> m b) -> m b
+ Control.Exception.Safe: uninterruptibleMask :: ((forall a. m a -> m a) -> m b) -> m b
Files
- ChangeLog.md +4/−0
- safe-exceptions.cabal +1/−1
- src/Control/Exception/Safe.hs +22/−0
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.1.3.0++* Add `catchIO`, `handleIO`, and `tryIO`+ ## 0.1.2.0 * Added `catches` [#13](https://github.com/fpco/safe-exceptions/issues/13)
safe-exceptions.cabal view
@@ -1,5 +1,5 @@ name: safe-exceptions-version: 0.1.2.0+version: 0.1.3.0 synopsis: Safe, consistent, and easy exception handling description: Please see README.md homepage: https://github.com/fpco/safe-exceptions#readme
src/Control/Exception/Safe.hs view
@@ -17,18 +17,21 @@ , impureThrow -- * Catching (with recovery) , catch+ , catchIO , catchAny , catchDeep , catchAnyDeep , catchAsync , handle+ , handleIO , handleAny , handleDeep , handleAnyDeep , handleAsync , try+ , tryIO , tryAny , tryDeep , tryAnyDeep@@ -134,6 +137,12 @@ -- since we want to preserve async behavior else C.throwM e +-- | 'C.catch' specialized to only catching 'E.IOException's+--+-- @since 0.1.3.0+catchIO :: C.MonadCatch m => m a -> (E.IOException -> m a) -> m a+catchIO = C.catch+ -- | 'catch' specialized to catch all synchronous exception -- -- @since 0.1.0.0@@ -176,6 +185,13 @@ handle :: (C.MonadCatch m, Exception e) => (e -> m a) -> m a -> m a handle = flip catch +-- | 'C.handle' specialized to only catching 'E.IOException's+--+-- @since 0.1.3.0+handleIO :: C.MonadCatch m => (E.IOException -> m a) -> m a -> m a+handleIO = C.handle++ -- | Flipped version of 'catchAny' -- -- @since 0.1.0.0@@ -210,6 +226,12 @@ -- @since 0.1.0.0 try :: (C.MonadCatch m, E.Exception e) => m a -> m (Either e a) try f = catch (liftM Right f) (return . Left)++-- | 'C.try' specialized to only catching 'E.IOException's+--+-- @since 0.1.3.0+tryIO :: C.MonadCatch m => m a -> m (Either E.IOException a)+tryIO = C.try -- | 'try' specialized to catch all synchronous exceptions --