import * as tsplus_module_1 from "@effect/core/io/Effect/operations/succeedNow";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/flatMap";
import * as tsplus_module_3 from "@tsplus/stdlib/collections/Chunk/reduce";
import { concreteChunk, SingletonTypeId } from "@tsplus/stdlib/collections/Chunk/definition";
/**
 * Folds over the elements in this chunk from the left.
 *
 * @tsplus fluent Chunk reduceEffect
 */

export function reduceEffect_(self, s, f, __tsplusTrace) {
  void 0;

  if (self._typeId === SingletonTypeId) {
    return f(s, self.a);
  }

  return tsplus_module_3.reduce_(self, tsplus_module_1.succeedNow(s, __tsplusTrace), (s, a) => tsplus_module_2.flatMap_(s, s1 => f(s1, a), __tsplusTrace));
}
/**
 * Folds over the elements in this chunk from the left.
 *
 * @tsplus static Chunk/Aspects reduceEffect
 */

export const reduceEffect = (s, f, __tsplusTrace) => self => reduceEffect_(self, s, f, __tsplusTrace);
//# sourceMappingURL=reduceEffect.mjs.map