HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulelifted-async-0.11.0Haskell2010

Control.Concurrent.Async.Lifted

This is a wrapped version of Control.Concurrent.Async with types generalized from IO to all monads in either MonadBase or MonadBaseControl.

All the functions restore the monadic effects in the forked computation unless specified otherwise.

If your monad stack satisfies StM m a ~ a (e.g. the reader monad), consider using Control.Concurrent.Async.Lifted.Safe module, which prevents you from messing up monadic effects.

  • 4 types
  • 49 values

Asynchronous actions

1 declaration
datadata Async a
#

An asynchronous action spawned by async or withAsync. Asynchronous actions are executed in a separate thread, and operations are provided for waiting for asynchronous actions to complete and obtaining their results (see e.g. wait).

Instances4Functor, Eq, Ord, Hashable
  • Functor AsyncDefined in async-2.2.5 · Control.Concurrent.Async.Internal
  • Eq (Async a)Defined in async-2.2.5 · Control.Concurrent.Async.Internal
  • Ord (Async a)Defined in async-2.2.5 · Control.Concurrent.Async.Internal
  • Hashable (Async a)Defined in async-2.2.5 · Control.Concurrent.Async.Internal

Spawning

Spawning with automatic cancelation

Quering Asyncs

STM operations

Waiting for multiple Asyncs

Waiting for multiple Asyncs in STM

Linking

Convenient utilities

12 declarations
valuerace_ :: MonadBaseControl IO m => m a -> m b -> m ()
#

Generalized version of race_.

NOTE: This function discards the monadic effects besides IO in the forked computation.

newtypenewtype Concurrently (m :: Type -> Type) a
#

Generalized version of Concurrently.

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 m a will execute the IO-based lifted operations it contains concurrently, before delivering the result of type a.

For example

  (page1, page2, page3) <- runConcurrently $ (,,)
    <$> Concurrently (getURL "url1")
    <*> Concurrently (getURL "url2")
    <*> Concurrently (getURL "url3")

Constructors

Instances5Functor, Applicative, Alternative, Semigroup, Monoid