yield
The
yield action allows (forces, in a co-operative multitasking
implementation) a context-switch to any other currently runnable
threads (if any), and is occasionally useful when implementing
concurrency abstractions.
Send a value downstream to the next component to consume. If the
downstream component terminates, this call will never return control.
Since 0.5.0
Send a single output value downstream. If the downstream Pipe
terminates, this Pipe will terminate as well.
Since 0.5.0
Generalized version of
yield.
Calling
yield x causes the value
Just
x to appear on the input when this generator is converted to an
InputStream. The rest of the computation after the call to
yield is resumed later when the
InputStream is
read again.
A singleton stream
>>> stdoutLn $ yield "hello"
hello
>>> S.sum $ do {yield 1; yield 2; yield 3}
6 :> ()
>>> let number = lift (putStrLn "Enter a number:") >> lift readLn >>= yield :: Stream (Of Int) IO ()
>>> S.toList $ do {number; number; number}
Enter a number:
1<Enter>
Enter a number:
2<Enter>
Enter a number:
3<Enter>
[1,2,3] :> ()
Allows other parallel computations to progress. (should not be
necessary in most cases).
Yield a value of type a and suspend the coroutine.
Lifts a value and a function into the Coroutine effect.
Allows a context-switch to any other unblocked thread (if any).
Suspend the current coroutine yielding a value.
Let another thread wake up.
Transfers control to the caller of the computation with coroutines
along with a value of type a, and receives a value of type
b from the caller.
yield @tag a emits a in the sink capability
tag.
Send output downstream.
Since v0.2.3.0, is strict. See
yieldLazy for the original
behavior.
Not on Stackage, so not searched.
YieldT monad transformer