lifted-async 0.3.0 → 0.4.0
raw patch · 4 files changed
+43/−31 lines, 4 filesdep ~constraintsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: constraints
API changes (from Hackage documentation)
- Control.Concurrent.Async.Lifted: instance (b ~ IO, Functor m) => Functor (Concurrently b m)
- Control.Concurrent.Async.Lifted: instance (b ~ IO, MonadBaseControl b m) => Alternative (Concurrently b m)
- Control.Concurrent.Async.Lifted: instance (b ~ IO, MonadBaseControl b m) => Applicative (Concurrently b m)
- Control.Concurrent.Async.Lifted: instance Monad m => Monad (Concurrently b m)
- Control.Concurrent.Async.Lifted.Safe: instance (Monad m, Forall (Pure m)) => Monad (Concurrently base m)
+ Control.Concurrent.Async.Lifted: instance (base ~ IO, Functor m) => Functor (Concurrently base m)
+ Control.Concurrent.Async.Lifted: instance (base ~ IO, MonadBaseControl base m) => Alternative (Concurrently base m)
+ Control.Concurrent.Async.Lifted: instance (base ~ IO, MonadBaseControl base m) => Applicative (Concurrently base m)
+ Control.Concurrent.Async.Lifted: instance (base ~ IO, MonadBaseControl base m) => Monad (Concurrently base m)
+ Control.Concurrent.Async.Lifted.Safe: instance (base ~ IO, MonadBaseControl base m, Forall (Pure m)) => Monad (Concurrently base m)
- Control.Concurrent.Async.Lifted: newtype Concurrently (b :: * -> *) m a
+ Control.Concurrent.Async.Lifted: newtype Concurrently (base :: * -> *) m a
Files
- CHANGELOG.md +5/−1
- lifted-async.cabal +3/−8
- src/Control/Concurrent/Async/Lifted.hs +24/−16
- src/Control/Concurrent/Async/Lifted/Safe.hs +11/−6
CHANGELOG.md view
@@ -1,4 +1,8 @@-=======+## v0.4.0 - 2014-12-29++* Accept `constraints > 0.4` as well even when built with ghc < 7.8.+* Support for GHC 7.10.1+ ## v0.3.0 - 2014-12-28 * Support for `monad-control == 1.0.*`
lifted-async.cabal view
@@ -1,5 +1,5 @@ name: lifted-async-version: 0.3.0+version: 0.4.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@@ -36,13 +36,8 @@ , 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.5- else- build-depends:- constraints >= 0.2 && <= 0.4+ , monad-control == 1.0.* else build-depends: monad-control == 0.*@@ -112,5 +107,5 @@ source-repository this type: git- tag: v0.3.0+ tag: v0.4.0 location: https://github.com/maoe/lifted-async.git
src/Control/Concurrent/Async/Lifted.hs view
@@ -59,7 +59,6 @@ import Control.Applicative import Control.Concurrent (threadDelay) import Control.Monad ((>=>), forever, liftM)-import Data.Traversable (Traversable(..)) import GHC.IO (unsafeUnmask) import Prelude hiding (mapM) @@ -70,6 +69,10 @@ import qualified Control.Concurrent.Async as A import qualified Control.Exception.Lifted as E +#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 710+import Data.Traversable+#endif+ -- | Generalized version of 'A.async'. async :: MonadBaseControl IO m => m a -> m (Async (StM m a)) async = asyncUsing A.async@@ -366,29 +369,34 @@ -- '<*>' 'Concurrently' (getURL "url2") -- '<*>' 'Concurrently' (getURL "url3") -- @-newtype Concurrently (b :: * -> *) m a = Concurrently { runConcurrently :: m a }+newtype Concurrently (base :: * -> *) m a =+ Concurrently { runConcurrently :: m a } --- NOTE: The phantom type variable @b :: * -> *@ in 'Concurrently' is needed to--- avoid @UndecidableInstances@ in the following instance declarations.+-- NOTE: The phantom type variable @base :: * -> *@ in 'Concurrently' is+-- necessary to avoid @UndecidableInstances@ in the following instance+-- declarations. -- See https://github.com/maoe/lifted-async/issues/4 for alternative -- implementaions. -instance (b ~ IO, Functor m) => Functor (Concurrently b m) where+instance (base ~ IO, Functor m) => Functor (Concurrently base m) where fmap f (Concurrently a) = Concurrently $ f <$> a -instance (b ~ IO, MonadBaseControl b m) => Applicative (Concurrently b m) where- pure = Concurrently . pure- Concurrently fs <*> Concurrently as =- Concurrently $ uncurry ($) <$> concurrently fs as+instance (base ~ IO, MonadBaseControl base m) =>+ Applicative (Concurrently base m) where+ pure = Concurrently . pure+ Concurrently fs <*> Concurrently as =+ Concurrently $ uncurry ($) <$> concurrently fs as -instance (b ~ IO, MonadBaseControl b m) => Alternative (Concurrently b m) where- empty = Concurrently . liftBaseWith . const $ forever (threadDelay maxBound)- Concurrently as <|> Concurrently bs =- Concurrently $ either id id <$> race as bs+instance (base ~ IO, MonadBaseControl base m) =>+ Alternative (Concurrently base m) where+ empty = Concurrently . liftBaseWith . const $ forever (threadDelay maxBound)+ Concurrently as <|> Concurrently bs =+ Concurrently $ either id id <$> race as bs -instance Monad m => Monad (Concurrently b m) where- return = Concurrently . return- Concurrently a >>= f = Concurrently $ a >>= runConcurrently . f+instance (base ~ IO, MonadBaseControl base m) =>+ Monad (Concurrently base m) where+ return = Concurrently . return+ Concurrently a >>= f = Concurrently $ a >>= runConcurrently . f 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
@@ -72,7 +72,6 @@ import Control.Applicative import Control.Concurrent (threadDelay) import Control.Monad-import Data.Traversable import Control.Concurrent.Async (Async) import Control.Exception.Lifted (SomeException, Exception)@@ -84,6 +83,10 @@ import qualified Control.Concurrent.Async.Lifted as Unsafe +#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 710+import Data.Traversable+#endif+ -- | Generalized version of 'A.async'. async :: (MonadBaseControl IO m, StM m a ~ a) => m a -> m (Async a) async = Unsafe.async@@ -295,8 +298,9 @@ :: Forall (Pure m) => { runConcurrently :: m a } -> Concurrently base m a --- NOTE: The phantom type variable @b :: * -> *@ in 'Concurrently' is needed to--- avoid @UndecidableInstances@ in the following instance declarations.+-- NOTE: The phantom type variable @base :: * -> *@ in 'Concurrently' is+-- necessary to avoid @UndecidableInstances@ in the following instance+-- declarations. -- See https://github.com/maoe/lifted-async/issues/4 for alternative -- implementaions. @@ -325,7 +329,8 @@ \\ (inst :: Forall (Pure m) :- Pure m a) \\ (inst :: Forall (Pure m) :- Pure m b) -instance (Monad m, Forall (Pure m)) => Monad (Concurrently base m) where- return = Concurrently . return- Concurrently a >>= f = Concurrently $ a >>= runConcurrently . f+instance (base ~ IO, MonadBaseControl base m, Forall (Pure m)) =>+ Monad (Concurrently base m) where+ return = Concurrently . return+ Concurrently a >>= f = Concurrently $ a >>= runConcurrently . f #endif