Returns a new schedule that continues only as long as both schedules continue, using the maximum of the delays of the two schedules.
Split the input
The same as &&
, but ignores the left output.
Chooses between two schedules with different outputs.
The same as &&
, but ignores the right output.
Returns a new schedule that continues only as long as both schedules continue, using the maximum of the delays of the two schedules.
A backwards version of >>>
.
Returns the composition of this schedule and the specified schedule, by piping the output of this one into the input of the other, and summing delays produced by both.
The same as andThenEither
, but merges the output.
Returns a new schedule that first executes this schedule to completion, and then executes the specified schedule to completion.
Returns a new schedule that maps this schedule to a constant output.
A named alias for &&
.
The same as both
followed by map
.
Peeks at the state produced by this schedule, executes some action, and then continues the schedule or not based on the specified state predicate.
Returns a new schedule that collects the outputs of this one into a list.
Creates a new schedule that outputs elements of both underlying schedules pair-wie.
Creates a new schedule that outputs elements of both underlying schedules pair-wie. The decision to continue is a function of the two underlying decisions, as is the delay.
An alias for <<<
Returns a new schedule that deals with a narrower class of inputs than this schedule.
Returns a new schedule with the specified pure modification applied to each delay produced by this schedule.
Returns a new schedule that contramaps the input and maps the output.
A named alias for ||
.
The same as either
followed by map
.
Runs the specified finalizer as soon as the schedule is complete.
Runs the specified finalizer as soon as the schedule is complete. Note
that unlike ZIO#ensuring
, this method does not guarantee the finalizer
will be run. The Schedule
may not initialize or the driver of the
schedule may not run to completion. However, if the Schedule
ever
decides not to continue, then the finalizer will be run.
Puts this schedule into the first element of a tuple, and passes along another value unchanged as the second element of the tuple.
Returns a new schedule that folds over the outputs of this one.
Returns a new schedule that effectfully folds over the outputs of this one.
Returns a new schedule that loops this one forever, resetting the state when this schedule is done.
Returns a new schedule with the specified initial state transformed by the specified initial transformer.
Applies random jitter to the schedule bounded by the specified factors, with a given random generator.
Applies random jitter to the schedule bounded by the factors 0.0 and 1.0.
Puts this schedule into the first element of a either, and passes along another value unchanged as the second element of the either.
Sends every input value to the specified sink.
Sends every output value to the specified sink.
Returns a new schedule that maps over the output of this one.
Returns a new schedule with the specified effectful modification applied to each delay produced by this schedule.
A new schedule that applies the current one but runs the specified effect for every decision of this schedule.
A new schedule that applies the current one but runs the specified effect for every decision of this schedule. This can be used to create schedules that log failures, decisions, or computed values.
Returns a new schedule that reconsiders the decision made by this schedule.
Returns a new schedule that effectfully reconsiders the decision made by this schedule.
Puts this schedule into the second element of a either, and passes along another value unchanged as the first element of the either.
Runs the schedule on the provided list of inputs, returning a list of durations and outputs.
Runs the schedule on the provided list of inputs, returning a list of durations and outputs. This method is useful for testing complicated schedules. Only as many inputs will be used as necessary to run the schedule to completion, and additional inputs will be discarded.
Puts this schedule into the second element of a tuple, and passes along another value unchanged as the first element of the tuple.
Returns a new schedule that inverts the decision to continue.
Returns a new schedule that maps this schedule to a Unit output.
Returns a new schedule that continues the schedule only until the predicate is satisfied on the input of the schedule.
Returns a new schedule that continues the schedule only until the effectful predicate is satisfied on the input of the schedule.
Returns a new schedule that continues the schedule only until the predicate is satisfied on the output value of the schedule.
Returns a new schedule with the update function transformed by the specified update transformer.
Returns a new schedule that continues this schedule so long as the predicate is satisfied on the input of the schedule.
Returns a new schedule that continues this schedule so long as the effectful predicate is satisfied on the input of the schedule.
Returns a new schedule that continues this schedule so long as the predicate is satisfied on the output value of the schedule.
Named alias for <*>
.
Named alias for <*
.
Named alias for *>
.
Returns a new schedule that continues as long as either schedule continues, using the minimum of the delays of the two schedules.
Chooses between two schedules with a common output.
(Since version 1.0.0) use as
Returns a new schedule that maps this schedule to a Unit output.
Returns a new schedule that maps this schedule to a Unit output.
(Since version 1.0.0) use unit
Defines a stateful, possibly effectful, recurring schedule of actions.
A
ZSchedule[R, A, B]
consumesA
values, and based on the inputs and the internal state, decides whether to continue or halt. Every decision is accompanied by a (possibly zero) delay, and an output value of typeB
.Schedules compose in each of the following ways:
1. Intersection, using the
&&
operator, which requires that both schedules continue, using the longer of the two durations. 2. Union, using the||
operator, which requires that only one schedule continues, using the shorter of the two durations. 3. Sequence, using the<||>
operator, which runs the first schedule until it ends, and then switches over to the second schedule.Schedule[R, A, B]
forms a profunctor on[A, B]
, an applicative functor onB
, and a monoid, allowing rich composition of different schedules.