packages feed

lifted-async 0.9.3.3 → 0.10.0

raw patch · 7 files changed

+65/−63 lines, 7 filesdep ~asyncdep ~monad-controlPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: async, monad-control

API changes (from Hackage documentation)

+ Control.Concurrent.Async.Lifted: AsyncCancelled :: AsyncCancelled
+ Control.Concurrent.Async.Lifted: [ExceptionInLinkedThread] :: ExceptionInLinkedThread
+ Control.Concurrent.Async.Lifted: compareAsyncs :: () => Async a -> Async b -> Ordering
+ Control.Concurrent.Async.Lifted: data AsyncCancelled :: *
+ Control.Concurrent.Async.Lifted: data ExceptionInLinkedThread :: *
+ Control.Concurrent.Async.Lifted: uninterruptibleCancel :: MonadBase IO m => Async a -> m ()
+ Control.Concurrent.Async.Lifted.Safe: AsyncCancelled :: AsyncCancelled
+ Control.Concurrent.Async.Lifted.Safe: [ExceptionInLinkedThread] :: ExceptionInLinkedThread
+ Control.Concurrent.Async.Lifted.Safe: compareAsyncs :: () => Async a -> Async b -> Ordering
+ Control.Concurrent.Async.Lifted.Safe: data AsyncCancelled :: *
+ Control.Concurrent.Async.Lifted.Safe: data ExceptionInLinkedThread :: *
+ Control.Concurrent.Async.Lifted.Safe: uninterruptibleCancel :: MonadBase IO m => Async a -> m ()

Files

CHANGELOG.md view
@@ -1,3 +1,13 @@+## v0.10.0 - 2018-02-08++* Support only async >= 2.2+* Drop support for monad-control == 0.*+* Drop support for GHC < 7.10++## v0.9.3.3 - 2018-01-22++* Relax upper version bound for constraints+ ## v0.9.3.2 - 2017-12-12  * Minor improvements in the cabal file
lifted-async.cabal view
@@ -1,5 +1,5 @@ name:                lifted-async-version:             0.9.3.3+version:             0.10.0 synopsis:            Run lifted IO operations asynchronously and wait for their results homepage:            https://github.com/maoe/lifted-async bug-reports:         https://github.com/maoe/lifted-async/issues@@ -12,11 +12,9 @@ build-type:          Simple cabal-version:       >= 1.8 tested-with:-    GHC == 8.2.1+    GHC == 8.2.2   , GHC == 8.0.2   , GHC == 7.10.2-  , GHC == 7.8.4-  , GHC == 7.6.3  extra-source-files:   README.md@@ -26,29 +24,20 @@   This package provides IO operations from @async@ package lifted to any   instance of 'MonadBase' or 'MonadBaseControl'. -flag monad-control-1-  description: User moand-control == 1.*-  default: True-  manual: False- library   exposed-modules:     Control.Concurrent.Async.Lifted     Control.Concurrent.Async.Lifted.Safe   build-depends:       base >= 4.5 && < 4.11-    , async >= 2.1.1 && < 2.2+    , async >= 2.2 && < 2.3     , lifted-base >= 0.2 && < 0.3     , transformers-base >= 0.4 && < 0.5-  if flag(monad-control-1)-    build-depends: monad-control == 1.0.*-    if impl(ghc >= 7.8)-        build-depends: constraints >= 0.2 && < 0.11-    else-        build-depends: constraints >= 0.2 && < 0.6+    , monad-control == 1.0.*+  if impl(ghc >= 7.8)+    build-depends: constraints >= 0.2 && < 0.11   else-    build-depends:-      monad-control == 0.*+    build-depends: constraints >= 0.2 && < 0.6   ghc-options: -Wall   hs-source-dirs: src @@ -61,6 +50,7 @@     Test.Async.IO     Test.Async.State     Test.Async.Reader+  ghc-options: -Wall -threaded   build-depends:       base     , HUnit
src/Control/Concurrent/Async/Lifted.hs view
@@ -1,13 +1,12 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE KindSignatures #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-}  {- | Module      : Control.Concurrent.Async.Lifted-Copyright   : Copyright (C) 2012-2017 Mitsutoshi Aoe+Copyright   : Copyright (C) 2012-2018 Mitsutoshi Aoe License     : BSD-style (see the file LICENSE) Maintainer  : Mitsutoshi Aoe <maoe@foldr.in> Stability   : experimental@@ -18,11 +17,9 @@ All the functions restore the monadic effects in the forked computation unless specified otherwise. -#if MIN_VERSION_monad_control(1, 0, 0) If your monad stack satisfies @'StM' m a ~ a@ (e.g. the reader monad), consider using @Control.Concurrent.Async.Lifted.Safe@ module, which prevents you from messing up monadic effects.-#endif -}  module Control.Concurrent.Async.Lifted@@ -37,8 +34,12 @@   , withAsyncWithUnmask, withAsyncOnWithUnmask      -- ** Quering 'Async's-  , wait, poll, waitCatch, cancel, cancelWith+  , wait, poll, waitCatch+  , cancel+  , uninterruptibleCancel+  , cancelWith   , A.asyncThreadId+  , A.AsyncCancelled(..)      -- ** STM operations   , A.waitSTM, A.pollSTM, A.waitCatchSTM@@ -49,7 +50,6 @@   , waitEither_   , waitBoth -#if MIN_VERSION_async(2, 1, 0)     -- ** Waiting for multiple 'Async's in STM   , A.waitAnySTM   , A.waitAnyCatchSTM@@ -57,10 +57,10 @@   , A.waitEitherCatchSTM   , A.waitEitherSTM_   , A.waitBothSTM-#endif      -- ** Linking   , link, link2+  , A.ExceptionInLinkedThread(..)      -- * Convenient utilities   , race, race_, concurrently, concurrently_@@ -68,14 +68,16 @@   , forConcurrently, forConcurrently_   , replicateConcurrently, replicateConcurrently_   , Concurrently(..)++  , A.compareAsyncs   ) where  import Control.Applicative import Control.Concurrent (threadDelay)-import Control.Monad ((>=>), forever, liftM, void)+import Control.Monad ((>=>), forever, void) import Data.Foldable (fold) import GHC.IO (unsafeUnmask)-import Prelude hiding (mapM)+import Prelude  import Control.Concurrent.Async (Async) import Control.Exception.Lifted (SomeException, Exception)@@ -205,22 +207,20 @@   -> m (Maybe (Either SomeException a)) poll a =   liftBase (A.poll a) >>=-  maybe (return Nothing) (liftM Just . sequenceEither)+  maybe (return Nothing) (fmap Just . sequenceEither)  -- | Generalized version of 'A.cancel'.------ NOTE: This function discards the monadic effects besides IO in the forked--- computation. cancel :: MonadBase IO m => Async a -> m () cancel = liftBase . A.cancel  -- | Generalized version of 'A.cancelWith'.------ NOTE: This function discards the monadic effects besides IO in the forked--- computation. cancelWith :: (MonadBase IO m, Exception e) => Async a -> e -> m () cancelWith = (liftBase .) . A.cancelWith +-- | Generalized version of 'A.uninterruptibleCancel'.+uninterruptibleCancel :: MonadBase IO m => Async a -> m ()+uninterruptibleCancel = liftBase . A.uninterruptibleCancel+ -- | Generalized version of 'A.waitCatch'. waitCatch   :: MonadBaseControl IO m@@ -273,7 +273,7 @@   -> m (Either a b) waitEither a b =   liftBase (A.waitEither a b) >>=-  either (liftM Left . restoreM) (liftM Right . restoreM)+  either (fmap Left . restoreM) (fmap Right . restoreM)  -- | Generalized version of 'A.waitEitherCatch'. waitEitherCatch@@ -283,7 +283,7 @@   -> m (Either (Either SomeException a) (Either SomeException b)) waitEitherCatch a b =   liftBase (A.waitEitherCatch a b) >>=-  either (liftM Left . sequenceEither) (liftM Right . sequenceEither)+  either (fmap Left . sequenceEither) (fmap Right . sequenceEither)  -- | Generalized version of 'A.waitEitherCancel'. waitEitherCancel@@ -293,7 +293,7 @@   -> m (Either a b) waitEitherCancel a b =   liftBase (A.waitEitherCancel a b) >>=-  either (liftM Left . restoreM) (liftM Right . restoreM)+  either (fmap Left . restoreM) (fmap Right . restoreM)  -- | Generalized version of 'A.waitEitherCatchCancel'. waitEitherCatchCancel@@ -303,7 +303,7 @@   -> m (Either (Either SomeException a) (Either SomeException b)) waitEitherCatchCancel a b =   liftBase (A.waitEitherCatch a b) >>=-  either (liftM Left . sequenceEither) (liftM Right . sequenceEither)+  either (fmap Left . sequenceEither) (fmap Right . sequenceEither)  -- | Generalized version of 'A.waitEither_'. --@@ -468,4 +468,4 @@ #endif  sequenceEither :: MonadBaseControl IO m => Either e (StM m a) -> m (Either e a)-sequenceEither = either (return . Left) (liftM Right . restoreM)+sequenceEither = either (return . Left) (fmap Right . restoreM)
src/Control/Concurrent/Async/Lifted/Safe.hs view
@@ -3,7 +3,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-}-{-# LANGUAGE KindSignatures #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-}@@ -12,7 +11,7 @@  {- | Module      : Control.Concurrent.Async.Lifted.Safe-Copyright   : Copyright (C) 2012-2017 Mitsutoshi Aoe+Copyright   : Copyright (C) 2012-2018 Mitsutoshi Aoe License     : BSD-style (see the file LICENSE) Maintainer  : Mitsutoshi Aoe <maoe@foldr.in> Stability   : experimental@@ -25,7 +24,6 @@ -}  module Control.Concurrent.Async.Lifted.Safe-#if MIN_VERSION_monad_control(1, 0, 0)   (     -- * Asynchronous actions     A.Async@@ -41,8 +39,11 @@      -- ** Quering 'Async's   , wait, poll, waitCatch-  , cancel, cancelWith+  , cancel+  , uninterruptibleCancel+  , cancelWith   , A.asyncThreadId+  , A.AsyncCancelled(..)      -- ** STM operations   , A.waitSTM, A.pollSTM, A.waitCatchSTM@@ -53,7 +54,6 @@   , waitEither_   , waitBoth -#if MIN_VERSION_async(2, 1, 0)     -- ** Waiting for multiple 'Async's in STM   , A.waitAnySTM   , A.waitAnyCatchSTM@@ -61,10 +61,10 @@   , A.waitEitherCatchSTM   , A.waitEitherSTM_   , A.waitBothSTM-#endif      -- ** Linking   , Unsafe.link, Unsafe.link2+  , A.ExceptionInLinkedThread(..)      -- * Convenient utilities   , race, race_, concurrently, concurrently_@@ -73,18 +73,10 @@   , replicateConcurrently, replicateConcurrently_   , Concurrently(..) -+  , A.compareAsyncs   )-#else-{-# WARNING-  "This module is available only if built with @monad-control >= 1.0.0@.\-  If you have an older version of @monad-control@, use\-  @Control.Concurrent.Async.Lifted@ instead."-  #-}-#endif   where -#if MIN_VERSION_monad_control(1, 0, 0) import Control.Applicative import Control.Concurrent (threadDelay) import Control.Monad@@ -226,6 +218,10 @@ cancelWith :: (MonadBase IO m, Exception e) => Async a -> e -> m () cancelWith = Unsafe.cancelWith +-- | Generalized version of 'A.uninterruptibleCancel'.+uninterruptibleCancel :: MonadBase IO m => Async a -> m ()+uninterruptibleCancel = Unsafe.uninterruptibleCancel+ -- | Generalized version of 'A.waitAny'. waitAny   :: forall m a. (MonadBase IO m, Forall (Pure m))@@ -456,6 +452,4 @@   Monoid (Concurrently m a) where     mempty = pure mempty     mappend = liftA2 mappend-#endif- #endif
tests/Test/Async/IO.hs view
@@ -59,7 +59,7 @@   a <- withAsync (threadDelay 1000000) $ return   r <- waitCatch a   case r of-    Left e  -> fromException e @?= Just ThreadKilled+    Left e  -> fromException e @?= Just AsyncCancelled     Right _ -> assertFailure ""  case_async_cancel :: Assertion
tests/Test/Async/Reader.hs view
@@ -71,7 +71,7 @@     waitCatch a   case r of     Left e  -> do-      fromException e @?= Just ThreadKilled+      fromException e @?= Just AsyncCancelled     Right _ -> assertFailure "An exception must be raised."  case_async_cancel :: Assertion@@ -119,6 +119,10 @@     cancelWith a TestException     wait a   case r of-    Left e -> do-      fromException e @?= Just TestException+    Left e -> case fromException e of+      Just (ExceptionInLinkedThread _ e') ->+        fromException e' @?= Just TestException+      Nothing -> assertFailure $+        "expected ExceptionInLinkedThread _ TestException"+          ++ " but got " ++ show e     Right _ -> assertFailure "An exception must be raised."
tests/Test/Async/State.hs view
@@ -73,7 +73,7 @@     waitCatch a   case r of     Left e  -> do-      fromException e @?= Just ThreadKilled+      fromException e @?= Just AsyncCancelled       s @?= value     Right _ -> assertFailure "An exception must be raised." @@ -154,6 +154,10 @@     cancelWith a TestException     wait a   case r of-    Left e -> do-      fromException e @?= Just TestException+    Left e -> case fromException e of+      Just (ExceptionInLinkedThread _ e') ->+        fromException e' @?= Just TestException+      Nothing -> assertFailure $+        "expected ExceptionInLinkedThread _ TestException"+          ++ " but got " ++ show e     Right _ -> assertFailure "An exception must be raised."