The Append
constructor instructs the driver to continue with
evaluation of first step found in tail Vector.
The Append
constructor instructs the driver to continue with
evaluation of first step found in tail Vector.
Instead of this constructor please use:
Process.append
The Await
constructor instructs the driver to evaluate
req
.
The Await
constructor instructs the driver to evaluate
req
. If it returns successfully, recv
is called with result on right side
to transition to the next state.
In case the req terminates with failure the Error(failure)
is passed on left side
giving chance for any fallback action.
In case the process was killed before the request is evaluated Kill
is passed on left side.
Kill
is passed on left side as well as when the request is already in progress, but process was killed.
The preempt
parameter is used when constructing resource and preemption safe cleanups.
See Process.bracket
for more.
Note that
Instead of this constructor directly, please use:
Process.await or Process.bracket
Continuation of the process.
Continuation of the process. Represents process _stack_. Used in conjunction with Step
.
The Emit
constructor instructs the driver to emit
the given sequence of values to the output
and then halt execution with supplied reason.
The Emit
constructor instructs the driver to emit
the given sequence of values to the output
and then halt execution with supplied reason.
Instead calling this constructor directly, please use one of the following helpers:
Process.emit Process.emitAll
Marker trait representing process in Emit or Await state.
Marker trait representing process in Emit or Await state. Is useful for more type safety.
Provides infix syntax for eval: Process[F,F[O]] => Process[F,O]
The Halt
constructor instructs the driver
that the last evaluation of Process completed with
supplied cause.
Tags a state of process that has no appended tail, tha means can be Halt, Emit or Await
Marker trait representing next step of process or terminated process in Halt
This class provides infix syntax specific to Process0
.
Syntax for processes that have its effects wrapped in Task
Intermediate step of process.
Intermediate step of process. Used to step within the process to define complex combinators.
Alias for emitAll
Await the given F
request and use its result.
Await the given F
request and use its result.
If you need to specify fallback, use awaitOr
The Process1
which awaits a single input, emits it, then halts normally.
Like await1
, but consults fb
when await fails to receive an I
Writer
based version of await1
.
The Wye
which request from both branches concurrently.
Writer
based version of awaitBoth
.
The Tee
which requests from the left branch, emits this value, then halts.
Writer
based version of awaitL
.
Await a request, and if it fails, use fb
to determine the next state.
Await a request, and if it fails, use fb
to determine the next state.
Otherwise, use rcv
to determine the next state.
The Tee
which requests from the right branch, emits this value, then halts.
Writer
based version of awaitR
.
Resource and preemption safe await
constructor.
Resource and preemption safe await
constructor.
Use this combinator, when acquiring resources. This build a process that when run
evaluates req
, and then runs rcv
. Once rcv
is completed, fails, or is interrupted, it will run release
When the acquisition (req
) is interrupted, neither release
or rcv
is run, however when the req was interrupted after
resource in req
was acquired then, the release
is run.
If,the acquisition fails, use bracket(req)(onPreempt)(rcv).onFailure(err => ???)
code to recover from the
failure eventually.
The infinite Process
, always emits a
.
The infinite Process
, always emits a
.
If for performance reasons it is good to emit a
in chunks,
specify size of chunk by chunkSize
parameter
The Process
which emits the single value given, then halts.
The Process
which emits the given sequence of values, then halts.
A Writer
which emits one value to the output.
A Writer
which writes the given value.
Alias for halt
.
Alias for await(fo)(emit)
Evaluate an arbitrary effect once, purely for its effects, ignoring its return value.
Evaluate an arbitrary effect once, purely for its effects,
ignoring its return value. This Process
emits no values.
The Process
which emits no values and halts immediately with the given exception.
A Process
which emits n
repetitions of a
.
Produce a continuous stream from a discrete stream by using the most recent value.
The Process
which emits no values and signals normal termination.
An infinite Process
that repeatedly applies a given function
to a start value.
An infinite Process
that repeatedly applies a given function
to a start value. start
is the first value emitted, followed
by f(start)
, then f(f(start))
, and so on.
Like iterate, but takes an effectful function for producing the next state.
Like iterate, but takes an effectful function for producing
the next state. start
is the first value emitted.
Lazily produce the range [start, stopExclusive)
.
Lazily produce the range [start, stopExclusive)
. If you want to produce the sequence in one chunk, instead of lazily, use emitAll(start until stopExclusive)
.
Lazily produce a sequence of nonoverlapping ranges, where each range
contains size
integers, assuming the upper bound is exclusive.
Lazily produce a sequence of nonoverlapping ranges, where each range
contains size
integers, assuming the upper bound is exclusive.
Example: ranges(0, 1000, 10)
results in the pairs
(0, 10), (10, 20), (20, 30) ... (990, 1000)
Note: The last emitted range may be truncated at stopExclusive
. For
instance, ranges(0,5,4)
results in (0,4), (4,5)
.
IllegalArgumentException
if size
<= 0
The Process1
which awaits a single input and passes it to rcv
to
determine the next state.
Like receive1
, but consults fb
when it fails to receive an input.
Prefix syntax for p.repeat
.
Evaluate an arbitrary effect in a Process
.
Evaluate an arbitrary effect in a Process
. The resulting Process
will emit values
until an error occurs.
Delay running p
until awaken
becomes true for the first time.
Delay running p
until awaken
becomes true for the first time.
The awaken
process may be discrete.
A supply of Long
values, starting with initial
.
A supply of Long
values, starting with initial
.
Each read is guaranteed to return a value which is unique
across all threads reading from this supply
.
Produce p
lazily.
Produce p
lazily. Useful if producing the process involves allocation of
some local mutable resource we want to ensure is freshly allocated
for each consumer of p
.
Note that this implementation assures that:
suspend(p).kill === suspend(p.kill) suspend(p).kill === p.kill suspend(p).repeat === suspend(p.repeat) suspend(p).repeat === p.repeat suspend(p).eval === suspend(p.eval) suspend(p).eval === p.eval Halt(cause) ++ suspend(p) === Halt(cause) ++ p
A Writer
which writes the given value; alias for emitW
.
Adds syntax for Channel
.
Adds syntax for Process1
.
Adds syntax for Sink
.
Adds syntax for Sink
that is specialized for Task.
Adds syntax for Tee
.
Adds syntax for Writer
.
Adds syntax for Writer
that is specialized for Task.
Adds syntax for Wye
.
Produce a (potentially infinite) source from an unfold.
Like unfold, but takes an effectful function.