import * as tsplus_module_1 from "@effect/core/io/Effect/operations/succeed";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/flatMap";
import * as tsplus_module_3 from "@tsplus/stdlib/collections/Collection/functions";
import * as tsplus_module_4 from "@effect/core/io/Effect/operations/suspendSucceed";
/**
 * Folds an `Collection<A>` using an effectual function f, working sequentially from left to right.
 *
 * @tsplus static ets/Effect/Ops reduce
 */

export function reduce(as, z, f, __tsplusTrace) {
  return tsplus_module_4.suspendSucceed(() => tsplus_module_3.reduce_(as(), tsplus_module_1.succeed(z, __tsplusTrace), (acc, el) => tsplus_module_2.flatMap_(acc, a => f(a, el), __tsplusTrace)), __tsplusTrace);
}
//# sourceMappingURL=reduce.mjs.map