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/reduceRight";
import { concreteChunk, SingletonTypeId } from "@tsplus/stdlib/collections/Chunk/definition";
/**
 * Folds over the elements in this chunk from the right.
 *
 * @tsplus fluent Chunk reduceRightEffect
 */

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

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

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

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