effect-io-ai

Package: effect
Module: STM

STM.iterate

Iterates with the specified transactional function. The moral equivalent of:

const s = initial

while (cont(s)) {
  s = body(s)
}

return s

Signature

declare const iterate: <Z, E, R>(initial: Z, options: { readonly while: Predicate<Z>; readonly body: (z: Z) => STM<Z, E, R>; }) => STM<Z, E, R>

Source

Since v2.0.0