async-dejafu 0.1.2.2 → 0.1.3.0
raw patch · 3 files changed
+12/−51 lines, 3 filesdep +concurrencydep ~dejafuPVP ok
version bump matches the API change (PVP)
Dependencies added: concurrency
Dependency ranges changed: dejafu
API changes (from Hackage documentation)
Files
- Control/Concurrent/Async.hs +1/−31
- async-dejafu.cabal +10/−7
- tests/Main.hs +1/−13
Control/Concurrent/Async.hs view
@@ -78,45 +78,15 @@ ) where import Control.Applicative+import Control.Concurrent.Classy.STM.TMVar (newEmptyTMVar, putTMVar, readTMVar) import Control.Exception (AsyncException(ThreadKilled), BlockedIndefinitelyOnSTM(..), Exception, SomeException) import Control.Monad import Control.Monad.Catch (finally, try, onException) import Control.Monad.Conc.Class import Control.Monad.STM.Class -#if MIN_VERSION_dejafu(0,3,0)-import Control.Concurrent.Classy.STM.TMVar (newEmptyTMVar, putTMVar, readTMVar)-#else-import Control.Concurrent.STM.CTMVar (CTMVar, newEmptyCTMVar, putCTMVar, readCTMVar)-#endif- #if !MIN_VERSION_base(4,8,0) import Data.Traversable-#endif--#if !MIN_VERSION_dejafu(0,3,0)-type MVar m = CVar m--newEmptyMVar :: MonadConc m => m (MVar m a)-newEmptyMVar = newEmptyCVar--putMVar :: MonadConc m => MVar m a -> a -> m ()-putMVar = putCVar--takeMVar :: MonadConc m => MVar m a -> m a-takeMVar = takeCVar--type STM m = STMLike m-type TMVar m = CTMVar m--newEmptyTMVar :: MonadSTM stm => stm (TMVar stm a)-newEmptyTMVar = newEmptyCTMVar--putTMVar :: MonadSTM stm => TMVar stm a -> a -> stm ()-putTMVar = putCTMVar--readTMVar :: MonadSTM stm => TMVar stm a -> stm a-readTMVar = readCTMVar #endif -----------------------------------------------------------------------------------------
async-dejafu.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: async-dejafu-version: 0.1.2.2+version: 0.1.3.0 synopsis: Run MonadConc operations asynchronously and wait for their results. description:@@ -11,10 +11,13 @@ conveniently run IO operations asynchronously and wait for their results. This package is a reimplementation of async using the @MonadConc@ abstraction from- <https://hackage.haskell.org/package/dejafu dejafu>, providing+ <https://hackage.haskell.org/package/concurrency concurrency>, providing easy-to-use asynchronous operaitons within an easily-testable framework. .+ This library itself is tested with+ <https://hackage.haskell.org/package/dejafu dejafu>.+ . When these functions are used in an IO context, the behaviour should appear identical to the original async package. @@ -37,15 +40,15 @@ source-repository this type: git location: https://github.com/barrucadu/dejafu.git- tag: async-dejafu-0.1.2.2+ tag: async-dejafu-0.1.3.0 library exposed-modules: Control.Concurrent.Async -- other-modules: -- other-extensions: - build-depends: base >=4.8 && <5- , dejafu >=0.2 && <0.4- , exceptions >=0.7 && <0.9+ build-depends: base >=4.8 && <5+ , concurrency >=1 && <2+ , exceptions >=0.7 && <0.9 -- hs-source-dirs: default-language: Haskell2010 ghc-options: -Wall@@ -54,5 +57,5 @@ hs-source-dirs: tests type: exitcode-stdio-1.0 main-is: Main.hs- build-depends: base, async-dejafu, dejafu, HUnit, hunit-dejafu+ build-depends: base, async-dejafu, concurrency, dejafu>=0.4, HUnit, hunit-dejafu default-language: Haskell2010
tests/Main.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE LambdaCase #-} @@ -15,16 +14,6 @@ import Test.HUnit (Test(..), runTestTT, test) import Test.HUnit.DejaFu -#if !MIN_VERSION_dejafu(0,3,0)-type MVar m = CVar m--newEmptyMVar :: MonadConc m => m (MVar m a)-newEmptyMVar = newEmptyCVar--takeMVar :: MonadConc m => MVar m a -> m a-takeMVar = takeCVar-#endif- main :: IO () main = void . runTestTT $ TestList [ TestLabel "async" $ test@@ -111,8 +100,7 @@ withasync_waitCatch_blocked :: MonadConc m => m (Maybe BlockedIndefinitelyOnMVar) withasync_waitCatch_blocked = do- _concAllKnown- r <- withAsync (_concAllKnown >> newEmptyMVar >>= takeMVar) waitCatch+ r <- withAsync (newEmptyMVar >>= takeMVar) waitCatch return $ case r of Left e -> fromException e _ -> Nothing