Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Async m a where
- async :: forall r a. Member Async r => Sem r a -> Sem r (Async (Maybe a))
- await :: forall r a. Member Async r => Async a -> Sem r a
- runAsync :: LastMember (Lift IO) r => Sem (Async ': r) a -> Sem r a
- runAsyncInIO :: Member (Lift IO) r => (forall x. Sem r x -> IO x) -> Sem (Async ': r) a -> Sem r a
Effect
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
Instances
type DefiningModule Async Source # | |
Defined in Polysemy.Async |
Actions
Interpretations
runAsync :: LastMember (Lift IO) r => Sem (Async ': r) a -> Sem r a Source #
A more flexible --- though less performant --- version of runAsyncInIO
.
This function is capable of running Async
effects anywhere within an
effect stack, without relying on an explicit function to lower it into IO
.
Notably, this means that State
effects will be consistent
in the presence of Async
.
Since: 0.5.0.0