import * as tsplus_module_1 from "@effect/core/stm/STM/operations/reduce";
import * as tsplus_module_2 from "@effect/core/stm/TMap/operations/toChunk";
import * as tsplus_module_3 from "@effect/core/stm/STM/operations/flatMap";
/**
 * folds the key/value pair matching the specified predicate, and uses the
 * provided effectful function to extract a value out of it.
 *
 * @tsplus fluent ets/TMap foldSTM
 */

export function foldSTM_(self, zero, op) {
  return tsplus_module_3.flatMap_(tsplus_module_2.toChunk(self), _ => tsplus_module_1.reduce(() => _, () => zero, op));
}
/**
 * folds the key/value pair matching the specified predicate, and uses the
 * provided effectful function to extract a value out of it.
 *
 * @tsplus static ets/TMap/Aspects foldSTM
 */

export const foldSTM = (zero, op) => self => foldSTM_(self, zero, op);
//# sourceMappingURL=foldSTM.mjs.map