concurrent-machines-0.3.1: Concurrent networked stream transducers

Safe HaskellNone
LanguageHaskell2010

Data.Machine.Concurrent.AsyncStep

Description

Internal helpers for taking asynchronous machine steps.

Synopsis

Documentation

type MachineStep m k o = Step k o (MachineT m k o) Source #

Slightly more compact notation for a Step.

type AsyncStep m k o = Async (StM m (MachineStep m k o)) Source #

Compact notation for a Step taken asynchronously.

awaitStep :: (a -> d) -> k' a -> d -> (d -> r) -> Step k' b r Source #

Build an Await step given a continuation that provides subsequent steps. awaitStep f sel ff k is like applying the Await constructor directly, but the continuation k is used to continue the machine.

awaitStep f sel ff k = Await (k . f) sel (k ff)

asyncRun :: MonadBaseControl IO m => MachineT m k o -> m (AsyncStep m k o) Source #

Run one step of a machine as an Async operation.

stepAsync :: forall m k k' a' d b. MonadBaseControl IO m => (forall c. k c -> k' c) -> AsyncStep m k a' -> (a' -> d) -> d -> d -> (AsyncStep m k a' -> d -> MachineT m k' b) -> MachineT m k' b Source #

Satisfy a downstream Await by blocking on an upstream step.

asyncEncased :: MonadBaseControl IO m => (AsyncStep m k1 o1 -> MachineT m k o) -> MachineT m k1 o1 -> MachineT m k o Source #

asyncEncased f x launches x and provides the resulting AsyncStep to f. Turn a function on AsyncStep to a funciton on MachineT.

asyncAwait :: MonadBaseControl IO m => (a -> MachineT m k o) -> k' a -> MachineT m k o -> (AsyncStep m k o -> MachineT m k1 o1) -> m (Step k' b (MachineT m k1 o1)) Source #

Similar to awaitStep, but for continuations that want their inputs to be run asynchronously.