packages feed

safe-exceptions 0.1.7.0 → 0.1.7.1

raw patch · 5 files changed

+19/−6 lines, 5 files

Files

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)