import * as tsplus_module_1 from "@effect/core/io/Effect/operations/done";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/exit";
import * as tsplus_module_3 from "@effect/core/io/Cause/definition";
import * as tsplus_module_4 from "@effect/core/io/Exit/operations/zipWith";
import * as tsplus_module_5 from "@effect/core/io/Effect/operations/zipWith";
import * as tsplus_module_6 from "@effect/core/io/Effect/operations/flatMap";
/**
 * Sequentially zips this effect with the specified effect using the specified
 * combiner function. Combines the causes in case both effect fail.
 *
 * @tsplus fluent ets/Effect validateWith
 */

export function validateWith_(self, that, f, __tsplusTrace) {
  return tsplus_module_6.flatMap_(tsplus_module_5.zipWith_(tsplus_module_2.exit(self, __tsplusTrace), () => tsplus_module_2.exit(that(), __tsplusTrace), (ea, eb) => tsplus_module_4.zipWith_(ea, eb, f, (ca, cb) => tsplus_module_3.combineSeq(ca, cb)), __tsplusTrace), exit => tsplus_module_1.done(() => exit, __tsplusTrace), __tsplusTrace);
}
/**
 * Sequentially zips this effect with the specified effect using the specified
 * combiner function. Combines the causes in case both effect fail.
 *
 * @tsplus static ets/Effect/Aspects validateWith
 */

export const validateWith = (that, f, __tsplusTrace) => self => validateWith_(self, that, f, __tsplusTrace);
//# sourceMappingURL=validateWith.mjs.map