Package: effect
Module: STM
Loops with the specified transactional function, collecting the results into a list. The moral equivalent of:
const as = []
let s = initial
while (cont(s)) {
as.push(body(s))
s = inc(s)
}
return as
Signature
declare const loop: { <Z, A, E, R>(initial: Z, options: { readonly while: (z: Z) => boolean; readonly step: (z: Z) => Z; readonly body: (z: Z) => STM<A, E, R>; readonly discard?: false | undefined; }): STM<Array<A>, E, R>; <Z, A, E, R>(initial: Z, options: { readonly while: (z: Z) => boolean; readonly step: (z: Z) => Z; readonly body: (z: Z) => STM<A, E, R>; readonly discard: true; }): STM<void, E, R>; }
Since v2.0.0