packages feed

enclosed-exceptions 1.0.2 → 1.0.3

raw patch · 5 files changed

+51/−3 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

+ ChangeLog.md view
@@ -0,0 +1,17 @@+# ChangeLog for enclosed-exceptions++## 1.0.3++* Skip some tests on GHC 8.4 [#12](https://github.com/jcristovao/enclosed-exceptions/issues/12)++## 1.0.2.1++* Support for GHC 7.4 and earlier++## 1.0.2++* Use MVar in tryAny, drop async dependency [#9](https://github.com/jcristovao/enclosed-exceptions/pull/9)++## 1.0.1++* Added tryDeep and catchDeep
+ README.md view
@@ -0,0 +1,26 @@+enclosed-exceptions+===================++The purpose of this module is to allow you to capture all exceptions originating from within the enclosed computation,+while still reacting to asynchronous exceptions aimed at the calling thread.++This way, you can be sure that the function that calls, for example,  ```catchAny```,+will still respond to ```ThreadKilled``` or ```Timeout``` events raised by another thread +(with ``throwTo``), while capturing all exceptions, synchronous or asynchronous,+resulting from the execution of the enclosed computation.++One particular use case is to allow the safe execution of code from various+libraries (which you do not control), capturing any faults that might occur,+while remaining responsive to higher level events and control actions.++This library was originally developed by [Michael Snoyman](http://www.snoyman.com/) for the+[ClassyPrelude](http://hackage.haskell.org/package/classy-prelude) library,+and was latter spun-off into a separate independent package.++For a more detailed explanation of the motivation behind this functions, see:++[Catching all exceptions](https://www.fpcomplete.com/user/snoyberg/general-haskell/exceptions/catching-all-exceptions)++and + +[the discussion in haskell-cafe](https://groups.google.com/forum/#!topic/haskell-cafe/e9H2I-3uVJE)
enclosed-exceptions.cabal view
@@ -1,5 +1,5 @@ name:                enclosed-exceptions-version:             1.0.2+version:             1.0.3 synopsis:            Catching all exceptions from within an enclosed computation description:         Catching all exceptions raised within an enclosed computation,                      while remaining responsive to (external) asynchronous exceptions.@@ -13,11 +13,12 @@ category:            Control build-type:          Simple cabal-version:       >=1.8+extra-source-files:  README.md ChangeLog.md  library   exposed-modules:   Control.Exception.Enclosed   hs-source-dirs:    src-  build-depends:       base                          >= 4          && < 5+  build-depends:       base                          >= 4.6        && < 5                      , transformers                      , lifted-base                   >= 0.2                      , monad-control
src/Control/Exception/Enclosed.hs view
@@ -122,7 +122,7 @@         loop cnt0       where         loop 0 = action-        loop cnt = action `catch`+        loop cnt = action `Control.Exception.catch`             \BlockedIndefinitelyOnMVar -> loop (cnt - 1)  -- | An extension to @catch@ which ensures that the return value is fully
test/main.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE ScopedTypeVariables #-}@@ -6,6 +7,7 @@ import Test.Hspec import Test.QuickCheck.Arbitrary () import Control.Exception.Lifted hiding (throwTo)+import Prelude hiding (catch) import Data.IORef import Data.Typeable import Control.Concurrent (threadDelay)@@ -78,6 +80,7 @@             it "doesn't catch exceptions lazily thrown in its pure result" $ do                 tryAny `trierCatchesDeep` False +#if !MIN_VERSION_async(2, 2, 0)             let shouldBeShow :: Show a => a -> a -> IO ()                 shouldBeShow x y = show x `shouldBe` show y @@ -92,6 +95,7 @@                     var <- atomically newEmptyTMVar                     atomically $ takeTMVar (var :: TMVar ())                 res `shouldBeShow` Left (toException BlockedIndefinitelyOnSTM)+#endif          describe "tryDeep" $ do             it "catches exceptions thrown from the inside" $ do