lifted-async 0.7.0.2 → 0.8.0
raw patch · 4 files changed
+81/−13 lines, 4 filesdep ~asyncdep ~base
Dependency ranges changed: async, base
Files
- CHANGELOG.md +7/−0
- lifted-async.cabal +5/−5
- src/Control/Concurrent/Async/Lifted.hs +38/−4
- src/Control/Concurrent/Async/Lifted/Safe.hs +31/−4
CHANGELOG.md view
@@ -1,3 +1,10 @@+## v0.8.0 - 2016-01-10++* Drop Monad instance for Concurrently+* Expose STM operations+* Relax upper bound for base and async+* Add Monoid and Semigroup instances for Concurrently+ ## v0.7.0.2 - 2015-11-26 * Relax upper bound for the constraints package
lifted-async.cabal view
@@ -1,5 +1,5 @@ name: lifted-async-version: 0.7.0.2+version: 0.8.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@@ -7,7 +7,7 @@ license-file: LICENSE author: Mitsutoshi Aoe maintainer: Mitsutoshi Aoe <maoe@foldr.in>-copyright: Copyright (C) 2012-2015 Mitsutoshi Aoe+copyright: Copyright (C) 2012-2016 Mitsutoshi Aoe category: Concurrency build-type: Simple cabal-version: >= 1.8@@ -34,8 +34,8 @@ Control.Concurrent.Async.Lifted Control.Concurrent.Async.Lifted.Safe build-depends:- base >= 4.5 && < 4.9- , async >= 2.0.1 && < 2.1+ base >= 4.5 && < 4.10+ , async >= 2.0.1 && < 2.2 , lifted-base >= 0.2 && < 0.3 , transformers-base >= 0.4 && < 0.5 if flag(monad-control-1)@@ -114,5 +114,5 @@ source-repository this type: git- tag: v0.7.0.2+ tag: v0.8.0 location: https://github.com/maoe/lifted-async.git
src/Control/Concurrent/Async/Lifted.hs view
@@ -49,11 +49,21 @@ , waitEither_ , waitBoth +#if MIN_VERSION_async(2, 1, 0)+ -- ** Waiting for multiple 'Async's in STM+ , A.waitAnySTM+ , A.waitAnyCatchSTM+ , A.waitEitherSTM+ , A.waitEitherCatchSTM+ , A.waitEitherSTM_+ , A.waitBothSTM+#endif+ -- ** Linking , link, link2 -- * Convenient utilities- , race, race_, concurrently, mapConcurrently+ , race, race_, concurrently, mapConcurrently, forConcurrently , Concurrently(..) ) where @@ -73,6 +83,11 @@ #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 710 import Data.Traversable #endif+#if !MIN_VERSION_base(4, 8, 0)+import Data.Monoid (Monoid(mappend, mempty))+#elif MIN_VERSION_base(4, 9, 0)+import Data.Semigroup (Semigroup((<>)))+#endif -- | Generalized version of 'A.async'. async :: MonadBaseControl IO m => m a -> m (Async (StM m a))@@ -352,6 +367,14 @@ -> m (t b) mapConcurrently f = runConcurrently . traverse (Concurrently . f) +-- | Generalized version of 'A.forConcurrently'.+forConcurrently+ :: (Traversable t, MonadBaseControl IO m)+ => t a+ -> (a -> m b)+ -> m (t b)+forConcurrently = flip mapConcurrently+ -- | Generalized version of 'A.Concurrently'. -- -- A value of type @'Concurrently' m a@ is an IO-based operation that can be@@ -385,9 +408,20 @@ Concurrently as <|> Concurrently bs = Concurrently $ either id id <$> race as bs -instance MonadBaseControl IO m => Monad (Concurrently m) where- return = Concurrently . return- Concurrently a >>= f = Concurrently $ a >>= runConcurrently . f+#if MIN_VERSION_base(4, 9, 0)+instance (MonadBaseControl IO m, Semigroup a) =>+ Semigroup (Concurrently m a) where+ (<>) = liftA2 (<>)++instance (MonadBaseControl IO m, Semigroup a, Monoid a) =>+ Monoid (Concurrently m a) where+ mempty = pure mempty+ mappend = (<>)+#else+instance (MonadBaseControl IO m, Monoid a) => Monoid (Concurrently m a) where+ mempty = pure mempty+ mappend = liftA2 mappend+#endif sequenceEither :: MonadBaseControl IO m => Either e (StM m a) -> m (Either e a) sequenceEither = either (return . Left) (liftM Right . restoreM)
src/Control/Concurrent/Async/Lifted/Safe.hs view
@@ -53,6 +53,16 @@ , Unsafe.waitEither_ , waitBoth +#if MIN_VERSION_async(2, 1, 0)+ -- ** Waiting for multiple 'Async's in STM+ , A.waitAnySTM+ , A.waitAnyCatchSTM+ , A.waitEitherSTM+ , A.waitEitherCatchSTM+ , A.waitEitherSTM_+ , A.waitBothSTM+#endif+ -- ** Linking , Unsafe.link, Unsafe.link2 @@ -89,6 +99,11 @@ #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 710 import Data.Traversable #endif+#if !MIN_VERSION_base(4, 8, 0)+import Data.Monoid (Monoid(mappend, mempty))+#elif MIN_VERSION_base(4, 9, 0)+import Data.Semigroup (Semigroup((<>)))+#endif -- | Generalized version of 'A.async'. async@@ -366,8 +381,20 @@ \\ (inst :: Forall (Pure m) :- Pure m a) \\ (inst :: Forall (Pure m) :- Pure m b) -instance (MonadBaseControl IO m, Forall (Pure m)) =>- Monad (Concurrently m) where- return = Concurrently . return- Concurrently a >>= f = Concurrently $ a >>= runConcurrently . f+#if MIN_VERSION_base(4, 9, 0)+instance (MonadBaseControl IO m, Semigroup a, Forall (Pure m)) =>+ Semigroup (Concurrently m a) where+ (<>) = liftA2 (<>)++instance (MonadBaseControl IO m, Semigroup a, Monoid a, Forall (Pure m)) =>+ Monoid (Concurrently m a) where+ mempty = pure mempty+ mappend = (<>)+#else+instance (MonadBaseControl IO m, Monoid a, Forall (Pure m)) =>+ Monoid (Concurrently m a) where+ mempty = pure mempty+ mappend = liftA2 mappend+#endif+ #endif