/** * Folds an `Collection` using an effectual function f, working sequentially * from left to right. * * @tsplus static effect/core/stm/STM.Ops reduce */ export function reduce( as: Collection, z: Z, f: (z: Z, a: A) => STM ): STM { return STM.suspend( as.reduce(STM.succeed(z) as STM, (acc, el) => acc.flatMap((a) => f(a, el))) ) }