Copyright  Copyright (C) 20122014 Mitsutoshi Aoe 

License  BSDstyle (see the file LICENSE) 
Maintainer  Mitsutoshi Aoe <maoe@foldr.in> 
Stability  experimental 
Safe Haskell  None 
Language  Haskell98 
This is a safe variant of Control.Concurrent.Async.Lifted
.
This module assumes your monad stack to satisfy
so you can't
mess up monadic effects. If your monad stack is stateful, use
StM
m a ~ aControl.Concurrent.Async.Lifted
with special care.
 data Async a :: * > *
 async :: (MonadBaseControl IO m, StM m a ~ a) => m a > m (Async a)
 asyncBound :: (MonadBaseControl IO m, StM m a ~ a) => m a > m (Async a)
 asyncOn :: (MonadBaseControl IO m, StM m a ~ a) => Int > m a > m (Async a)
 asyncWithUnmask :: (MonadBaseControl IO m, StM m a ~ a) => ((forall b. m b > m b) > m a) > m (Async a)
 asyncOnWithUnmask :: (MonadBaseControl IO m, StM m a ~ a) => Int > ((forall b. m b > m b) > m a) > m (Async a)
 withAsync :: (MonadBaseControl IO m, StM m a ~ a) => m a > (Async a > m b) > m b
 withAsyncBound :: (MonadBaseControl IO m, StM m a ~ a) => m a > (Async a > m b) > m b
 withAsyncOn :: (MonadBaseControl IO m, StM m a ~ a) => Int > m a > (Async a > m b) > m b
 withAsyncWithUnmask :: (MonadBaseControl IO m, StM m a ~ a) => ((forall c. m c > m c) > m a) > (Async a > m b) > m b
 withAsyncOnWithUnmask :: (MonadBaseControl IO m, StM m a ~ a) => Int > ((forall c. m c > m c) > m a) > (Async a > m b) > m b
 wait :: (MonadBaseControl IO m, StM m a ~ a) => Async a > m a
 poll :: (MonadBaseControl IO m, StM m a ~ a) => Async a > m (Maybe (Either SomeException a))
 waitCatch :: (MonadBaseControl IO m, StM m a ~ a) => Async a > m (Either SomeException a)
 cancel :: MonadBase IO m => Async a > m ()
 cancelWith :: (MonadBase IO m, Exception e) => Async a > e > m ()
 asyncThreadId :: Async a > ThreadId
 waitSTM :: Async a > STM a
 pollSTM :: Async a > STM (Maybe (Either SomeException a))
 waitCatchSTM :: Async a > STM (Either SomeException a)
 waitAny :: (MonadBaseControl IO m, StM m a ~ a) => [Async a] > m (Async a, a)
 waitAnyCatch :: (MonadBaseControl IO m, StM m a ~ a) => [Async a] > m (Async a, Either SomeException a)
 waitAnyCancel :: (MonadBaseControl IO m, StM m a ~ a) => [Async a] > m (Async a, a)
 waitAnyCatchCancel :: (MonadBaseControl IO m, StM m a ~ a) => [Async a] > m (Async a, Either SomeException a)
 waitEither :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => Async a > Async b > m (Either a b)
 waitEitherCatch :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => Async a > Async b > m (Either (Either SomeException a) (Either SomeException b))
 waitEitherCancel :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => Async a > Async b > m (Either a b)
 waitEitherCatchCancel :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => Async a > Async b > m (Either (Either SomeException a) (Either SomeException b))
 waitEither_ :: MonadBaseControl IO m => Async a > Async b > m ()
 waitBoth :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => Async a > Async b > m (a, b)
 link :: MonadBase IO m => Async a > m ()
 link2 :: MonadBase IO m => Async a > Async a > m ()
 race :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => m a > m b > m (Either a b)
 race_ :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => m a > m b > m ()
 concurrently :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => m a > m b > m (a, b)
 mapConcurrently :: (Traversable t, MonadBaseControl IO m, Forall (Pure m)) => (a > m b) > t a > m (t b)
 data Concurrently m a where
 Concurrently :: Forall (Pure m) => {
 runConcurrently :: m a
 Concurrently :: Forall (Pure m) => {
 class (StM m a ~ a) => Pure m a
Asynchronous actions
data Async a :: * > *
Spawning
async :: (MonadBaseControl IO m, StM m a ~ a) => m a > m (Async a) Source
Generalized version of async
.
asyncBound :: (MonadBaseControl IO m, StM m a ~ a) => m a > m (Async a) Source
Generalized version of asyncBound
.
asyncOn :: (MonadBaseControl IO m, StM m a ~ a) => Int > m a > m (Async a) Source
Generalized version of asyncOn
.
asyncWithUnmask :: (MonadBaseControl IO m, StM m a ~ a) => ((forall b. m b > m b) > m a) > m (Async a) Source
Generalized version of asyncWithUnmask
.
asyncOnWithUnmask :: (MonadBaseControl IO m, StM m a ~ a) => Int > ((forall b. m b > m b) > m a) > m (Async a) Source
Generalized version of asyncOnWithUnmask
.
Spawning with automatic cancel
ation
withAsync :: (MonadBaseControl IO m, StM m a ~ a) => m a > (Async a > m b) > m b Source
Generalized version of withAsync
.
withAsyncBound :: (MonadBaseControl IO m, StM m a ~ a) => m a > (Async a > m b) > m b Source
Generalized version of withAsyncBound
.
withAsyncOn :: (MonadBaseControl IO m, StM m a ~ a) => Int > m a > (Async a > m b) > m b Source
Generalized version of withAsyncOn
.
withAsyncWithUnmask :: (MonadBaseControl IO m, StM m a ~ a) => ((forall c. m c > m c) > m a) > (Async a > m b) > m b Source
Generalized version of withAsyncWithUnmask
.
withAsyncOnWithUnmask :: (MonadBaseControl IO m, StM m a ~ a) => Int > ((forall c. m c > m c) > m a) > (Async a > m b) > m b Source
Generalized version of withAsyncOnWithUnmask
.
Quering Async
s
poll :: (MonadBaseControl IO m, StM m a ~ a) => Async a > m (Maybe (Either SomeException a)) Source
Generalized version of poll
.
waitCatch :: (MonadBaseControl IO m, StM m a ~ a) => Async a > m (Either SomeException a) Source
Generalized version of waitCatch
.
cancelWith :: (MonadBase IO m, Exception e) => Async a > e > m () Source
Generalized version of cancelWith
.
asyncThreadId :: Async a > ThreadId
STM operations
pollSTM :: Async a > STM (Maybe (Either SomeException a))
A version of poll
that can be used inside an STM transaction.
waitCatchSTM :: Async a > STM (Either SomeException a)
A version of waitCatch
that can be used inside an STM transaction.
Waiting for multiple Async
s
waitAny :: (MonadBaseControl IO m, StM m a ~ a) => [Async a] > m (Async a, a) Source
Generalized version of waitAny
.
waitAnyCatch :: (MonadBaseControl IO m, StM m a ~ a) => [Async a] > m (Async a, Either SomeException a) Source
Generalized version of waitAnyCatch
.
waitAnyCancel :: (MonadBaseControl IO m, StM m a ~ a) => [Async a] > m (Async a, a) Source
Generalized version of waitAnyCancel
.
waitAnyCatchCancel :: (MonadBaseControl IO m, StM m a ~ a) => [Async a] > m (Async a, Either SomeException a) Source
Generalized version of waitAnyCatchCancel
.
waitEither :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => Async a > Async b > m (Either a b) Source
Generalized version of waitEither
.
waitEitherCatch :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => Async a > Async b > m (Either (Either SomeException a) (Either SomeException b)) Source
Generalized version of waitEitherCatch
.
waitEitherCancel :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => Async a > Async b > m (Either a b) Source
Generalized version of waitEitherCancel
.
waitEitherCatchCancel :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => Async a > Async b > m (Either (Either SomeException a) (Either SomeException b)) Source
Generalized version of waitEitherCatchCancel
.
waitEither_ :: MonadBaseControl IO m => Async a > Async b > m () Source
Generalized version of waitEither_
.
NOTE: This function discards the monadic effects besides IO in the forked computation.
waitBoth :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => Async a > Async b > m (a, b) Source
Generalized version of waitBoth
.
Linking
Convenient utilities
race :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => m a > m b > m (Either a b) Source
Generalized version of race
.
race_ :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => m a > m b > m () Source
Generalized version of race_
.
concurrently :: (MonadBaseControl IO m, StM m a ~ a, StM m b ~ b) => m a > m b > m (a, b) Source
Generalized version of concurrently
.
mapConcurrently :: (Traversable t, MonadBaseControl IO m, Forall (Pure m)) => (a > m b) > t a > m (t b) Source
Generalized version of mapConcurrently
.
data Concurrently m a where Source
Generalized version of Concurrently
.
A value of type
is an IObased operation that can be
composed with other Concurrently
m aConcurrently
values, using the Applicative
and
Alternative
instances.
Calling runConcurrently
on a value of type
will
execute the IObased lifted operations it contains concurrently, before
delivering the result of type Concurrently
m aa
.
For example
(page1, page2, page3) <runConcurrently
$ (,,)<$>
Concurrently
(getURL "url1")<*>
Concurrently
(getURL "url2")<*>
Concurrently
(getURL "url3")
Concurrently :: Forall (Pure m) => m a > Concurrently m a  

(MonadBaseControl IO m, Forall (Pure m)) => Alternative (Concurrently m)  
(MonadBaseControl IO m, Forall (Pure m)) => Monad (Concurrently m)  
Functor m => Functor (Concurrently m)  
(MonadBaseControl IO m, Forall (Pure m)) => Applicative (Concurrently m) 