packages feed

lifted-async 0.4.0 → 0.5.0

raw patch · 4 files changed

+34/−49 lines, 4 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

- 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, Functor m) => Functor (Concurrently base m)
- Control.Concurrent.Async.Lifted.Safe: instance (base ~ IO, MonadBaseControl base m, Forall (Pure m)) => Alternative (Concurrently base m)
- Control.Concurrent.Async.Lifted.Safe: instance (base ~ IO, MonadBaseControl base m, Forall (Pure m)) => Applicative (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: instance Functor m => Functor (Concurrently m)
+ Control.Concurrent.Async.Lifted: instance MonadBaseControl IO m => Alternative (Concurrently m)
+ Control.Concurrent.Async.Lifted: instance MonadBaseControl IO m => Applicative (Concurrently m)
+ Control.Concurrent.Async.Lifted: instance MonadBaseControl IO m => Monad (Concurrently m)
+ Control.Concurrent.Async.Lifted.Safe: instance (MonadBaseControl IO m, Forall (Pure m)) => Alternative (Concurrently m)
+ Control.Concurrent.Async.Lifted.Safe: instance (MonadBaseControl IO m, Forall (Pure m)) => Applicative (Concurrently m)
+ Control.Concurrent.Async.Lifted.Safe: instance (MonadBaseControl IO m, Forall (Pure m)) => Monad (Concurrently m)
+ Control.Concurrent.Async.Lifted.Safe: instance Functor m => Functor (Concurrently m)
- Control.Concurrent.Async.Lifted: newtype Concurrently (base :: * -> *) m a
+ Control.Concurrent.Async.Lifted: newtype Concurrently m a
- Control.Concurrent.Async.Lifted.Safe: Concurrently :: m a -> Concurrently base m a
+ Control.Concurrent.Async.Lifted.Safe: Concurrently :: m a -> Concurrently m a
- Control.Concurrent.Async.Lifted.Safe: data Concurrently (base :: * -> *) m a
+ Control.Concurrent.Async.Lifted.Safe: data Concurrently m a
- Control.Concurrent.Async.Lifted.Safe: runConcurrently :: Concurrently base m a -> m a
+ Control.Concurrent.Async.Lifted.Safe: runConcurrently :: Concurrently m a -> m a

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+## v0.5.0 - 2014-12-29++* Simplify the type of `Concurrently` (#10)+ ## v0.4.0 - 2014-12-29  * Accept `constraints > 0.4` as well even when built with ghc < 7.8.
lifted-async.cabal view
@@ -1,5 +1,5 @@ name:                lifted-async-version:             0.4.0+version:             0.5.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@@ -107,5 +107,5 @@  source-repository this   type: git-  tag: v0.4.0+  tag: v0.5.0   location: https://github.com/maoe/lifted-async.git
src/Control/Concurrent/Async/Lifted.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE UndecidableInstances #-}  {- | Module      : Control.Concurrent.Async.Lifted@@ -353,11 +354,11 @@  -- | Generalized version of 'A.Concurrently'. ----- A value of type @'Concurrently' b m a@ is an IO-based operation that can be+-- A value of type @'Concurrently' m a@ is an IO-based operation that can be -- composed with other 'Concurrently' values, using the 'Applicative' and -- 'Alternative' instances. ----- Calling 'runConcurrently' on a value of type @'Concurrently' b m a@ will+-- Calling 'runConcurrently' on a value of type @'Concurrently' m a@ will -- execute the IO-based lifted operations it contains concurrently, before -- delivering the result of type 'a'. --@@ -369,34 +370,24 @@ --     '<*>' 'Concurrently' (getURL "url2") --     '<*>' 'Concurrently' (getURL "url3") -- @-newtype Concurrently (base :: * -> *) m a =-  Concurrently { runConcurrently :: m a }---- 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.+newtype Concurrently m a = Concurrently { runConcurrently :: m a } -instance (base ~ IO, Functor m) => Functor (Concurrently base m) where+instance Functor m => Functor (Concurrently m) where   fmap f (Concurrently a) = Concurrently $ f <$> a -instance (base ~ IO, MonadBaseControl base m) =>-  Applicative (Concurrently base m) where-    pure = Concurrently . pure-    Concurrently fs <*> Concurrently as =-      Concurrently $ uncurry ($) <$> concurrently fs as+instance MonadBaseControl IO m => Applicative (Concurrently m) where+  pure = Concurrently . pure+  Concurrently fs <*> Concurrently as =+    Concurrently $ uncurry ($) <$> concurrently fs as -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 MonadBaseControl IO m => Alternative (Concurrently 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) =>-  Monad (Concurrently base m) where-    return = Concurrently . return-    Concurrently a >>= f = Concurrently $ a >>= runConcurrently . f+instance MonadBaseControl IO m => Monad (Concurrently 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
@@ -1,5 +1,5 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-}@@ -8,10 +8,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-}--#if defined(__GLASGOW_HASKELL__) && __GLAGOW_HASKELL__ <= 706 {-# LANGUAGE UndecidableInstances #-}-#endif  {- | Module      : Control.Concurrent.Async.Lifted.Safe@@ -277,11 +274,11 @@  -- | Generalized version of 'A.Concurrently'. ----- A value of type @'Concurrently' b m a@ is an IO-based operation that can be+-- A value of type @'Concurrently' m a@ is an IO-based operation that can be -- composed with other 'Concurrently' values, using the 'Applicative' and -- 'Alternative' instances. ----- Calling 'runConcurrently' on a value of type @'Concurrently' b m a@ will+-- Calling 'runConcurrently' on a value of type @'Concurrently' m a@ will -- execute the IO-based lifted operations it contains concurrently, before -- delivering the result of type 'a'. --@@ -293,16 +290,9 @@ --     '<*>' 'Concurrently' (getURL "url2") --     '<*>' 'Concurrently' (getURL "url3") -- @-data Concurrently (base :: * -> *) m a where+data Concurrently m a where   Concurrently-    :: Forall (Pure m)-    => { runConcurrently :: m a } -> Concurrently base m a---- 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.+    :: Forall (Pure m) => { runConcurrently :: m a } -> Concurrently m a  -- | @'Pure' m a@ only means @m@ satisfies @'StM' m a ~ a@ (i.e. the monad -- @m@ has no monadic state). The boring 'Pure' class is necessary just to@@ -310,27 +300,27 @@ class StM m a ~ a => Pure m a instance StM m a ~ a => Pure m a -instance (base ~ IO, Functor m) => Functor (Concurrently base m) where+instance Functor m => Functor (Concurrently m) where   fmap f (Concurrently a) = Concurrently $ f <$> a -instance (base ~ IO, MonadBaseControl base m, Forall (Pure m)) =>-  Applicative (Concurrently base m) where+instance (MonadBaseControl IO m, Forall (Pure m)) =>+  Applicative (Concurrently m) where     pure = Concurrently . pure     Concurrently (fs :: m (a -> b)) <*> Concurrently as =       Concurrently (uncurry ($) <$> concurrently fs as)         \\ (inst :: Forall (Pure m) :- Pure m a)         \\ (inst :: Forall (Pure m) :- Pure m (a -> b)) -instance (base ~ IO, MonadBaseControl base m, Forall (Pure m)) =>-  Alternative (Concurrently base m) where+instance (MonadBaseControl IO m, Forall (Pure m)) =>+  Alternative (Concurrently m) where     empty = Concurrently . liftBaseWith . const $ forever (threadDelay maxBound)     Concurrently (as :: m a) <|> Concurrently bs =       Concurrently (either id id <$> race as bs)         \\ (inst :: Forall (Pure m) :- Pure m a)         \\ (inst :: Forall (Pure m) :- Pure m b) -instance (base ~ IO, MonadBaseControl base m, Forall (Pure m)) =>-  Monad (Concurrently base m) where+instance (MonadBaseControl IO m, Forall (Pure m)) =>+  Monad (Concurrently m) where     return = Concurrently . return     Concurrently a >>= f = Concurrently $ a >>= runConcurrently . f #endif