polysemy-1.8.0.0: Higher-order, low-boilerplate free monads.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Polysemy.Async

Synopsis

Effect

data Async m a where Source #

An effect for spawning asynchronous computations.

The Maybe returned by async is due to the fact that we can't be sure an Error effect didn't fail locally.

Since: 0.5.0.0

Constructors

Async :: m a -> Async m (Async (Maybe a)) 
Await :: Async a -> Async m a 
Cancel :: Async a -> Async m () 

Actions

async :: forall r a. Member Async r => Sem r a -> Sem r (Async (Maybe a)) Source #

await :: forall r a. Member Async r => Async a -> Sem r a Source #

cancel :: forall r a. Member Async r => Async a -> Sem r () Source #

Helpers

sequenceConcurrently :: forall t r a. (Traversable t, Member Async r) => t (Sem r a) -> Sem r (t (Maybe a)) Source #

Perform a sequence of effectful actions concurrently.

Since: 1.2.2.0

Interpretations

asyncToIOFinal :: Member (Final IO) r => Sem (Async ': r) a -> Sem r a Source #

Run an Async effect in terms of async through final IO.

Beware: Effects that aren't interpreted in terms of IO will have local state semantics in regards to Async effects interpreted this way. See Final.

Since: 1.2.0.0