Companion

Functions

Link copied to clipboard
fun <A> collect(): Schedule<A, List<A>>

Creates a Schedule which collects all its inputs in a list.

Link copied to clipboard

Creates a Schedule that returns its decisions.

Link copied to clipboard
@JvmName(name = "delayedNanos")
fun <A> delayed(delaySchedule: Schedule<A, Double>): Schedule<A, Double>
@JvmName(name = "delayedDuration")
fun <A> delayed(delaySchedule: Schedule<A, Duration>): Schedule<A, Duration>

Creates a Schedule that uses another Schedule to generate the delay of this schedule. Continues for as long as delaySchedule continues and adds the output of delaySchedule to the delay that delaySchedule produced. Also returns the full delay as output.

Link copied to clipboard
Link copied to clipboard
fun <A> doUntil(f: suspend (A) -> Boolean): Schedule<A, A>

Creates a Schedule that continues until f returns true.

Link copied to clipboard
fun <A> doWhile(f: suspend (A) -> Boolean): Schedule<A, A>

Creates a Schedule that continues as long as f returns true.

Link copied to clipboard
Link copied to clipboard
fun <A> exponential(base: Double, factor: Double = 2.0): Schedule<A, Double>

Creates a Schedule that increases its delay exponentially with a given factor and base. Delays can be calculated as base * factor ^ n where n is the number of executions.

Link copied to clipboard

Creates a Schedule that continues with increasing delay by adding the last two delays.

Link copied to clipboard
fun <A> forever(): Schedule<A, Int>

Creates a Schedule that continues forever and returns the number of iterations.

Link copied to clipboard
fun <A> identity(): Schedule<A, A>

Creates a Schedule that continues without delay and just returns its input.

Link copied to clipboard
operator fun <S, A, B> invoke(initial: suspend () -> S, update: suspend (input: A, state: S) -> Schedule.Decision<S, B>): Schedule<A, B>

Invoke constructor to manually define a schedule. If you need this, please consider adding it to Arrow or suggest a change to avoid using this manual method.

Link copied to clipboard
fun <A> linear(base: Double): Schedule<A, Double>

Creates a Schedule which increases its delay linearly, by n * base where n is the number of executions.

Link copied to clipboard
fun <A> logInput(f: suspend (A) -> Unit): Schedule<A, A>

Creates a Schedule with an effectful handler on the input.

Link copied to clipboard
fun <A> logOutput(f: suspend (A) -> Unit): Schedule<A, A>

Creates a Schedule with an effectful handler on the output.

Link copied to clipboard
fun <A> never(): Schedule<A, Nothing>

Creates a schedule that never retries.

Link copied to clipboard
fun <A> once(): Schedule<A, Unit>

Creates a Schedule that only retries once.

Link copied to clipboard
fun <A> recurs(n: Int): Schedule<A, Int>

Creates a Schedule that continues n times and returns the number of iterations.

Link copied to clipboard
fun <A> spaced(interval: Double): Schedule<A, Int>

Creates a Schedule that continues with a fixed delay.

Link copied to clipboard
fun <I, A> unfold(c: A, f: (A) -> A): Schedule<I, A>

Non-effectful variant of unfoldLazy

Link copied to clipboard
fun <I, A> unfoldLazy(c: suspend () -> A, f: suspend (A) -> A): Schedule<I, A>

Creates a schedule that unfolds effectfully using a seed value c and a unfold function f. This keeps the current state (the current seed) as State and runs the unfold function on every call to update. This schedule always continues without delay and returns the current state.

Link copied to clipboard
fun <A> unit(): Schedule<A, Unit>

Creates a Schedule that continues without delay and always returns Unit.