safe-exceptions 0.1.7.0 → 0.1.7.1
raw patch · 5 files changed
+19/−6 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Exception.Safe: instance GHC.Exception.Exception Control.Exception.Safe.AsyncExceptionWrapper
- Control.Exception.Safe: instance GHC.Exception.Exception Control.Exception.Safe.StringException
- Control.Exception.Safe: instance GHC.Exception.Exception Control.Exception.Safe.SyncExceptionWrapper
+ Control.Exception.Safe: generalBracket :: MonadMask m => m a -> (a -> ExitCase b -> m c) -> (a -> m b) -> m (b, c)
+ Control.Exception.Safe: instance GHC.Exception.Type.Exception Control.Exception.Safe.AsyncExceptionWrapper
+ Control.Exception.Safe: instance GHC.Exception.Type.Exception Control.Exception.Safe.StringException
+ Control.Exception.Safe: instance GHC.Exception.Type.Exception Control.Exception.Safe.SyncExceptionWrapper
- Control.Exception.Safe: [Handler] :: Handler m a
+ Control.Exception.Safe: [Handler] :: forall (m :: Type -> Type) a e. Exception e => (e -> m a) -> Handler m a
- Control.Exception.Safe: [SomeAsyncException] :: SomeAsyncException
+ Control.Exception.Safe: [SomeAsyncException] :: forall e. Exception e => e -> SomeAsyncException
- Control.Exception.Safe: [SomeException] :: SomeException
+ Control.Exception.Safe: [SomeException] :: forall e. Exception e => e -> SomeException
- Control.Exception.Safe: class (Typeable * e, Show e) => Exception e
+ Control.Exception.Safe: class (Typeable e, Show e) => Exception e
- Control.Exception.Safe: class MonadThrow m => MonadCatch (m :: * -> *)
+ Control.Exception.Safe: class MonadThrow m => MonadCatch (m :: Type -> Type)
- Control.Exception.Safe: class MonadCatch m => MonadMask (m :: * -> *)
+ Control.Exception.Safe: class MonadCatch m => MonadMask (m :: Type -> Type)
- Control.Exception.Safe: class Monad m => MonadThrow (m :: * -> *)
+ Control.Exception.Safe: class Monad m => MonadThrow (m :: Type -> Type)
- Control.Exception.Safe: class Typeable k (a :: k)
+ Control.Exception.Safe: class Typeable (a :: k)
- Control.Exception.Safe: data Handler (m :: * -> *) a :: (* -> *) -> * -> *
+ Control.Exception.Safe: data Handler (m :: Type -> Type) a
- Control.Exception.Safe: data IOException :: *
+ Control.Exception.Safe: data IOException
- Control.Exception.Safe: data SomeAsyncException :: *
+ Control.Exception.Safe: data SomeAsyncException
- Control.Exception.Safe: data SomeException :: *
+ Control.Exception.Safe: data SomeException
Files
- ChangeLog.md +6/−0
- README.md +7/−0
- safe-exceptions.cabal +3/−3
- src/Control/Exception/Safe.hs +2/−2
- test/Control/Exception/SafeSpec.hs +1/−1
ChangeLog.md view
@@ -1,3 +1,9 @@+# ChangeLog for safe-exceptions++## 0.1.7.1++* Doc update+ ## 0.1.7.0 * Add `bracketWithError`
README.md view
@@ -17,6 +17,13 @@ to turn what was previously something scary into an aspect of Haskell everyone feels safe using. +__NOTE__ The `UnliftIO.Exception` module in [the `unliftio`+library](https://www.stackage.org/package/unliftio) provides a very similar API+to this module, but based around the `MonadUnliftIO` typeclass instead of+`MonadCatch` and `MonadMask`. The [unliftio release+announcement](https://www.fpcomplete.com/blog/2017/07/announcing-new-unliftio-library)+explains why this may be considered preferable from a safety perspective.+ ## Goals This package provides additional safety and simplicity versus
safe-exceptions.cabal view
@@ -1,5 +1,5 @@ name: safe-exceptions-version: 0.1.7.0+version: 0.1.7.1 synopsis: Safe, consistent, and easy exception handling description: Please see README.md homepage: https://github.com/fpco/safe-exceptions#readme@@ -16,9 +16,9 @@ library hs-source-dirs: src exposed-modules: Control.Exception.Safe- build-depends: base >= 4.7 && < 4.11+ build-depends: base >= 4.7 && < 5 , deepseq >= 1.2 && < 1.5- , exceptions >= 0.8 && < 0.9+ , exceptions >= 0.8 && < 0.11 , transformers >= 0.2 && < 0.6 default-language: Haskell2010
src/Control/Exception/Safe.hs view
@@ -376,7 +376,7 @@ -- | Async safe version of 'E.bracket' ----- @since 0.1.7.0+-- @since 0.1.0.0 bracket :: forall m a b c. C.MonadMask m => m a -> (a -> m b) -> (a -> m c) -> m c bracket before after = bracketWithError before (const after)@@ -428,7 +428,7 @@ -- | Async safe version of 'E.bracket' with access to the exception in the -- cleanup action. ----- @since 0.1.0.0+-- @since 0.1.7.0 bracketWithError :: forall m a b c. C.MonadMask m => m a -> (Maybe SomeException -> a -> m b) -> (a -> m c) -> m c bracketWithError before after thing = C.mask $ \restore -> do
test/Control/Exception/SafeSpec.hs view
@@ -4,7 +4,7 @@ module Control.Exception.SafeSpec (spec) where import Control.Concurrent (threadDelay, newEmptyMVar, forkIOWithUnmask, takeMVar, putMVar)-import Control.Exception (assert, ArithException (..), AsyncException (..), BlockedIndefinitelyOnMVar (..), BlockedIndefinitelyOnSTM (..))+import Control.Exception (ArithException (..), AsyncException (..), BlockedIndefinitelyOnMVar (..), BlockedIndefinitelyOnSTM (..)) import qualified Control.Exception as E import Control.Exception.Safe import Control.Monad (forever)