# Companion

common object Companion

## Functions

Name Summary
collect common fun <A> collect(): Schedule<A, List<A»
Creates a Schedule which collects all its inputs in a list.
decision common fun <A> decision(): Schedule<A, Boolean>
Creates a Schedule that returns its decisions.
delayed common
@JvmName(name = “delayedNanos”)
fun <A> delayed(delaySchedule: Schedule<A, Double>): Schedule<A, Double>
@ExperimentalTime
@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.
delayInNanos common fun <A> delayInNanos(): Schedule<A, Double>
doUntil common fun <A> doUntil(f: suspend (A) -> Boolean): Schedule<A, A>
Creates a Schedule that continues until f returns true.
doWhile common fun <A> doWhile(f: suspend (A) -> Boolean): Schedule<A, A>
Creates a Schedule that continues as long as f returns true.
duration common
@ExperimentalTime
fun <A> duration(): Schedule<A, Duration>
exponential common fun <A> exponential(base: Double, factor: Double = 2.0): Schedule<A, Double>
@ExperimentalTime
fun <A> exponential(base: Duration, factor: Double = 2.0): Schedule<A, Duration>
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.
fibonacci common fun <A> fibonacci(one: Double): Schedule<A, Double>
@ExperimentalTime
fun <A> fibonacci(one: Duration): Schedule<A, Duration>
Creates a Schedule that continues with increasing delay by adding the last two delays.
forever common fun <A> forever(): Schedule<A, Int>
Creates a Schedule that continues forever and returns the number of iterations.
identity common fun <A> identity(): Schedule<A, A>
Creates a Schedule that continues without delay and just returns its input.
invoke common operator fun <S, A, B> invoke(initial: suspend () -> S, update: suspend (A, 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.
linear common fun <A> linear(base: Double): Schedule<A, Double>
@ExperimentalTime
fun <A> linear(base: Duration): Schedule<A, Duration>
Creates a Schedule which increases its delay linearly, by n * base where n is the number of executions.
Creates a Schedule with an effectful handler on the input.
logOutput common fun <A> logOutput(f: suspend (A) -> Unit): Schedule<A, A>
Creates a Schedule with an effectful handler on the output.
never common fun <A> never(): Schedule<A, Nothing>
Creates a schedule that never retries.
once common fun <A> once(): Schedule<A, Unit>
Creates a Schedule that only retries once.
recurs common fun <A> recurs(n: Int): Schedule<A, Int>
Creates a Schedule that continues n times and returns the number of iterations.
spaced common fun <A> spaced(interval: Double): Schedule<A, Int>
@ExperimentalTime
fun <A> spaced(interval: Duration): Schedule<A, Int>
Creates a Schedule that continues with a fixed delay.
unfold common fun <I, A> unfold(c: A, f: (A) -> A): Schedule<I, A>
Non-effectful variant of unfoldLazy
unfoldLazy common 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.
unit common fun <A> unit(): Schedule<A, Unit>
Creates a Schedule that continues without delay and always returns Unit.

Do you like Arrow?

<