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.
Returns the composition of this schedule and the specified schedule, by piping the output of this one into the input of the other. Effects described by this schedule will always be executed before the effects described by the second schedule.
Returns a new schedule with the given delay added to every update.
Returns a new schedule with the effectfully calculated delay added to every update.
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 output 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.
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 with the specified effectful 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 all sleeps executed by the schedule.
Puts this schedule into the first element of a either, and passes along another value unchanged as the second element of the either.
Returns a new schedule that maps over the output of this one.
Returns a new schedule with the specified effectful modification applied to each sleep performed by this schedule.
Returns a new schedule with the specified effectful modification applied to each sleep performed by this schedule.
Note that this does not apply to sleeps performed in Schedule#initial. All effects executed while calculating the modified duration will run with the old environment.
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.
Provide all requirements to the schedule.
Provide some of the requirements to the schedule.
Returns a new schedule that effectfully reconsiders the decision made by this schedule.
Returns a new schedule that effectfully reconsiders the decision made by this schedule. The provided either will be a Left if the schedule has failed and will contain the old state or a Right with the new state if the schedule has updated successfully.
Emit the number of repetitions of the schedule so far.
Puts this schedule into the second element of a either, and passes along another value unchanged as the first element of the either.
Puts this schedule into the second element of a tuple, and passes along another value unchanged as the first element of the tuple.
Sends every input value to the specified sink.
Sends every output value to the specified sink.
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 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.
Returns a new schedule that continues this schedule so long as the effectful 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.
Defines a stateful, possibly effectful, recurring schedule of actions.
A
Schedule[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.