Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class (MonadSTM m, MonadThread m) => MonadAsync m where
- type Async m = (async :: Type -> Type) | async -> m
- async :: m a -> m (Async m a)
- asyncBound :: m a -> m (Async m a)
- asyncOn :: Int -> m a -> m (Async m a)
- asyncThreadId :: Async m a -> ThreadId m
- withAsync :: m a -> (Async m a -> m b) -> m b
- withAsyncBound :: m a -> (Async m a -> m b) -> m b
- withAsyncOn :: Int -> m a -> (Async m a -> m b) -> m b
- waitSTM :: Async m a -> STM m a
- pollSTM :: Async m a -> STM m (Maybe (Either SomeException a))
- waitCatchSTM :: Async m a -> STM m (Either SomeException a)
- waitAnySTM :: [Async m a] -> STM m (Async m a, a)
- waitAnyCatchSTM :: [Async m a] -> STM m (Async m a, Either SomeException a)
- waitEitherSTM :: Async m a -> Async m b -> STM m (Either a b)
- waitEitherSTM_ :: Async m a -> Async m b -> STM m ()
- waitEitherCatchSTM :: Async m a -> Async m b -> STM m (Either (Either SomeException a) (Either SomeException b))
- waitBothSTM :: Async m a -> Async m b -> STM m (a, b)
- wait :: Async m a -> m a
- poll :: Async m a -> m (Maybe (Either SomeException a))
- waitCatch :: Async m a -> m (Either SomeException a)
- cancel :: Async m a -> m ()
- cancelWith :: Exception e => Async m a -> e -> m ()
- uninterruptibleCancel :: Async m a -> m ()
- waitAny :: [Async m a] -> m (Async m a, a)
- waitAnyCatch :: [Async m a] -> m (Async m a, Either SomeException a)
- waitAnyCancel :: [Async m a] -> m (Async m a, a)
- waitAnyCatchCancel :: [Async m a] -> m (Async m a, Either SomeException a)
- waitEither :: Async m a -> Async m b -> m (Either a b)
- waitEitherCatch :: Async m a -> Async m b -> m (Either (Either SomeException a) (Either SomeException b))
- waitEitherCancel :: Async m a -> Async m b -> m (Either a b)
- waitEitherCatchCancel :: Async m a -> Async m b -> m (Either (Either SomeException a) (Either SomeException b))
- waitEither_ :: Async m a -> Async m b -> m ()
- waitBoth :: Async m a -> Async m b -> m (a, b)
- race :: m a -> m b -> m (Either a b)
- race_ :: m a -> m b -> m ()
- concurrently :: m a -> m b -> m (a, b)
- concurrently_ :: m a -> m b -> m ()
- asyncWithUnmask :: ((forall b. m b -> m b) -> m a) -> m (Async m a)
- asyncOnWithUnmask :: Int -> ((forall b. m b -> m b) -> m a) -> m (Async m a)
- withAsyncWithUnmask :: ((forall c. m c -> m c) -> m a) -> (Async m a -> m b) -> m b
- withAsyncOnWithUnmask :: Int -> ((forall c. m c -> m c) -> m a) -> (Async m a -> m b) -> m b
- compareAsyncs :: Async m a -> Async m b -> Ordering
- data AsyncCancelled = AsyncCancelled
- data ExceptionInLinkedThread = ExceptionInLinkedThread String SomeException
- link :: (MonadAsync m, MonadFork m, MonadMask m) => Async m a -> m ()
- linkOnly :: forall m a. (MonadAsync m, MonadFork m, MonadMask m) => (SomeException -> Bool) -> Async m a -> m ()
- link2 :: (MonadAsync m, MonadFork m, MonadMask m) => Async m a -> Async m b -> m ()
- link2Only :: (MonadAsync m, MonadFork m, MonadMask m) => (SomeException -> Bool) -> Async m a -> Async m b -> m ()
- mapConcurrently :: (Traversable t, MonadAsync m) => (a -> m b) -> t a -> m (t b)
- forConcurrently :: (Traversable t, MonadAsync m) => t a -> (a -> m b) -> m (t b)
- mapConcurrently_ :: (Foldable f, MonadAsync m) => (a -> m b) -> f a -> m ()
- forConcurrently_ :: (Foldable f, MonadAsync m) => f a -> (a -> m b) -> m ()
- replicateConcurrently :: MonadAsync m => Int -> m a -> m [a]
- replicateConcurrently_ :: MonadAsync m => Int -> m a -> m ()
- newtype Concurrently m a = Concurrently {
- runConcurrently :: m a
Documentation
class (MonadSTM m, MonadThread m) => MonadAsync m where Source #
async, asyncBound, asyncOn, asyncThreadId, cancel, cancelWith, asyncWithUnmask, asyncOnWithUnmask, waitCatchSTM, pollSTM
async :: m a -> m (Async m a) Source #
See async
.
asyncBound :: m a -> m (Async m a) Source #
See asyncBound
.
asyncOn :: Int -> m a -> m (Async m a) Source #
See asyncOn
.
asyncThreadId :: Async m a -> ThreadId m Source #
See asyncThreadId
.
withAsync :: m a -> (Async m a -> m b) -> m b Source #
See withAsync
.
withAsyncBound :: m a -> (Async m a -> m b) -> m b Source #
See withAsyncBound
.
default withAsyncBound :: MonadMask m => m a -> (Async m a -> m b) -> m b Source #
withAsyncOn :: Int -> m a -> (Async m a -> m b) -> m b Source #
See withAsyncOn
.
waitSTM :: Async m a -> STM m a Source #
See waitSTM
.
pollSTM :: Async m a -> STM m (Maybe (Either SomeException a)) Source #
See pollSTM
.
waitCatchSTM :: Async m a -> STM m (Either SomeException a) Source #
See waitCatchSTM
.
waitAnySTM :: [Async m a] -> STM m (Async m a, a) Source #
See waitAnySTM
.
default waitAnySTM :: MonadThrow (STM m) => [Async m a] -> STM m (Async m a, a) Source #
waitAnyCatchSTM :: [Async m a] -> STM m (Async m a, Either SomeException a) Source #
See waitAnyCatchSTM
.
waitEitherSTM :: Async m a -> Async m b -> STM m (Either a b) Source #
See waitEitherSTM
.
default waitEitherSTM :: MonadThrow (STM m) => Async m a -> Async m b -> STM m (Either a b) Source #
waitEitherSTM_ :: Async m a -> Async m b -> STM m () Source #
See waitEitherSTM_
.
default waitEitherSTM_ :: MonadThrow (STM m) => Async m a -> Async m b -> STM m () Source #
waitEitherCatchSTM :: Async m a -> Async m b -> STM m (Either (Either SomeException a) (Either SomeException b)) Source #
See waitEitherCatchSTM
.
waitBothSTM :: Async m a -> Async m b -> STM m (a, b) Source #
See waitBothSTM
.
default waitBothSTM :: MonadThrow (STM m) => Async m a -> Async m b -> STM m (a, b) Source #
wait :: Async m a -> m a Source #
See wait
.
poll :: Async m a -> m (Maybe (Either SomeException a)) Source #
See poll
.
waitCatch :: Async m a -> m (Either SomeException a) Source #
See waitCatch
.
cancel :: Async m a -> m () Source #
See cancel
.
cancelWith :: Exception e => Async m a -> e -> m () Source #
See cancelWith
.
uninterruptibleCancel :: Async m a -> m () Source #
default uninterruptibleCancel :: MonadMask m => Async m a -> m () Source #
waitAny :: [Async m a] -> m (Async m a, a) Source #
See waitAny
.
waitAnyCatch :: [Async m a] -> m (Async m a, Either SomeException a) Source #
See waitAnyCatch
.
waitAnyCancel :: [Async m a] -> m (Async m a, a) Source #
See waitAnyCancel
.
default waitAnyCancel :: MonadThrow m => [Async m a] -> m (Async m a, a) Source #
waitAnyCatchCancel :: [Async m a] -> m (Async m a, Either SomeException a) Source #
See waitAnyCatchCancel
.
default waitAnyCatchCancel :: MonadThrow m => [Async m a] -> m (Async m a, Either SomeException a) Source #
waitEither :: Async m a -> Async m b -> m (Either a b) Source #
See waitEither
.
waitEitherCatch :: Async m a -> Async m b -> m (Either (Either SomeException a) (Either SomeException b)) Source #
Note, IO-based implementations should override the default
implementation. See the async
package implementation and comments.
http://hackage.haskell.org/package/async-2.2.1/docs/src/Control.Concurrent.Async.html#waitEitherCatch
See waitEitherCatch
.
waitEitherCancel :: Async m a -> Async m b -> m (Either a b) Source #
See waitEitherCancel
.
default waitEitherCancel :: MonadThrow m => Async m a -> Async m b -> m (Either a b) Source #
waitEitherCatchCancel :: Async m a -> Async m b -> m (Either (Either SomeException a) (Either SomeException b)) Source #
default waitEitherCatchCancel :: MonadThrow m => Async m a -> Async m b -> m (Either (Either SomeException a) (Either SomeException b)) Source #
waitEither_ :: Async m a -> Async m b -> m () Source #
See waitEither_
.
waitBoth :: Async m a -> Async m b -> m (a, b) Source #
See waitBoth
.
race :: m a -> m b -> m (Either a b) Source #
See race
.
race_ :: m a -> m b -> m () Source #
See race_
.
concurrently :: m a -> m b -> m (a, b) Source #
See concurrently
.
concurrently_ :: m a -> m b -> m () Source #
See concurrently_
.
asyncWithUnmask :: ((forall b. m b -> m b) -> m a) -> m (Async m a) Source #
See concurrently_
.
asyncOnWithUnmask :: Int -> ((forall b. m b -> m b) -> m a) -> m (Async m a) Source #
See asyncOnWithUnmask
.
withAsyncWithUnmask :: ((forall c. m c -> m c) -> m a) -> (Async m a -> m b) -> m b Source #
See withAsyncWithUnmask
.
default withAsyncWithUnmask :: MonadMask m => ((forall c. m c -> m c) -> m a) -> (Async m a -> m b) -> m b Source #
withAsyncOnWithUnmask :: Int -> ((forall c. m c -> m c) -> m a) -> (Async m a -> m b) -> m b Source #
default withAsyncOnWithUnmask :: MonadMask m => Int -> ((forall c. m c -> m c) -> m a) -> (Async m a -> m b) -> m b Source #
compareAsyncs :: Async m a -> Async m b -> Ordering Source #
See compareAsyncs
.
Instances
data AsyncCancelled #
The exception thrown by cancel
to terminate a thread.
Instances
Exception AsyncCancelled | |
Defined in Control.Concurrent.Async | |
Show AsyncCancelled | |
Defined in Control.Concurrent.Async showsPrec :: Int -> AsyncCancelled -> ShowS # show :: AsyncCancelled -> String # showList :: [AsyncCancelled] -> ShowS # | |
Eq AsyncCancelled | |
Defined in Control.Concurrent.Async (==) :: AsyncCancelled -> AsyncCancelled -> Bool # (/=) :: AsyncCancelled -> AsyncCancelled -> Bool # |
data ExceptionInLinkedThread Source #
Exception from child thread re-raised in parent thread
We record the thread ID of the child thread as a String
. This avoids
an m
parameter in the type, which is important: ExceptionInLinkedThread
must be an instance of Exception
, requiring it to be Typeable
; if m
appeared in the type, we would require m
to be Typeable
, which does not
work with with the simulator, as it would require a Typeable
constraint
on the s
parameter of IOSim
.
Instances
linkOnly :: forall m a. (MonadAsync m, MonadFork m, MonadMask m) => (SomeException -> Bool) -> Async m a -> m () Source #
Like linkOnly
.
link2 :: (MonadAsync m, MonadFork m, MonadMask m) => Async m a -> Async m b -> m () Source #
Like link2
.
link2Only :: (MonadAsync m, MonadFork m, MonadMask m) => (SomeException -> Bool) -> Async m a -> Async m b -> m () Source #
Like link2Only
.
mapConcurrently :: (Traversable t, MonadAsync m) => (a -> m b) -> t a -> m (t b) Source #
See mapConcurrently
.
forConcurrently :: (Traversable t, MonadAsync m) => t a -> (a -> m b) -> m (t b) Source #
See forConcurrently
.
mapConcurrently_ :: (Foldable f, MonadAsync m) => (a -> m b) -> f a -> m () Source #
See mapConcurrently_
.
forConcurrently_ :: (Foldable f, MonadAsync m) => f a -> (a -> m b) -> m () Source #
See forConcurrently_
.
replicateConcurrently :: MonadAsync m => Int -> m a -> m [a] Source #
replicateConcurrently_ :: MonadAsync m => Int -> m a -> m () Source #
newtype Concurrently m a Source #
Similar to Concurrently
but which works for any MonadAsync
instance.
Concurrently | |
|