asynchronous-exceptions 1.0 → 1.1
raw patch · 2 files changed
+33/−23 lines, 2 filesdep ~base
Dependency ranges changed: base
Files
- Control/Exception/Async.hs +31/−21
- asynchronous-exceptions.cabal +2/−2
Control/Exception/Async.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable, ExistentialQuantification #-}+{-# LANGUAGE DeriveDataTypeable, ExistentialQuantification, CPP #-} -- | -- It is often useful to distinguish between synchronous and asynchronous -- exceptions. The common idiom is to run a user-supplied computation@@ -14,10 +14,28 @@ -- exceptions. module Control.Exception.Async- ( SomeAsyncException- , asyncToException- , asyncFromException+ (+ -- * Exception class for asynchronous exceptions++ -- | To mark an exception as asynchronous:+ --+ -- >instance Exception MyException where+ -- > fromException = asyncFromException+ -- > toException = asyncToException+ --+ -- Note that until base 4.7 (GHC 7.8) 'AsyncException' was not a subclass+ -- of 'SomeAsyncException'. Use 'isAsynchronous' to recognize both+ -- 'AsyncException' and 'SomeAsyncException'.+ --+ -- The re-exported documentation may say «Since: 4.7.0.0» — ignore+ -- that. For older versions this package provides its own compatible+ -- definitions.+ SomeAsyncException+ , asyncExceptionToException+ , asyncExceptionFromException+ -- * Detecting asynchronous exceptions , isAsynchronous+ -- * Catching synchronous exceptions , catchSync , handleSync , trySync@@ -29,17 +47,8 @@ import Data.Typeable import Data.Maybe --- | Exception class for asynchronous exceptions.------ To mark an exception as asynchronous:------ >instance Exception MyException where--- > fromException = asyncFromException--- > toException = asyncToException------ Note that as of base 4.6, 'AsyncException' is not yet a subclass of--- 'SomeAsyncException'. Use 'isAsynchronous' to recognize both--- 'AsyncException' and 'SomeAsyncException'.+#if !MIN_VERSION_base(4,7,0)+-- | Exception class for asynchronous exceptions data SomeAsyncException = forall e . Exception e => SomeAsyncException e deriving Typeable@@ -50,14 +59,15 @@ showsPrec p (SomeAsyncException e) = showsPrec p e -- | 'toException' implementation for asynchronous exceptions-asyncToException :: Exception e => e -> SomeException-asyncToException = toException . SomeAsyncException+asyncExceptionToException :: Exception e => e -> SomeException+asyncExceptionToException = toException . SomeAsyncException -- | 'fromException' implementation for asynchronous exceptions-asyncFromException :: Exception e => SomeException -> Maybe e-asyncFromException x = do- SomeException e <- fromException x- cast e+asyncExceptionFromException :: Exception e => SomeException -> Maybe e+asyncExceptionFromException x = do+ SomeAsyncException a <- fromException x+ cast a+#endif -- | Check whether an exception is asynchronous isAsynchronous :: SomeException -> Bool
asynchronous-exceptions.cabal view
@@ -2,7 +2,7 @@ -- further documentation, see http://haskell.org/cabal/users-guide/ name: asynchronous-exceptions-version: 1.0+version: 1.1 synopsis: Distinguish between synchronous and asynchronous exceptions description: Distinguish between synchronous and asynchronous exceptions homepage: https://github.com/feuerbach/asynchronous-exceptions@@ -20,6 +20,6 @@ exposed-modules: Control.Exception.Async -- other-modules: other-extensions: DeriveDataTypeable, ExistentialQuantification- build-depends: base >=4.6 && <4.7+ build-depends: base >= 4 && < 4.8 -- hs-source-dirs: default-language: Haskell2010