import * as tsplus_module_1 from "@effect/core/io/Exit/operations/failCause";
import * as tsplus_module_2 from "@effect/core/io/Exit/operations/succeed";
/**
 * Zips this together with the specified result using the combination
 * functions.
 *
 * @tsplus fluent ets/Exit zipWith
 */

export function zipWith_(self, that, f, g) {
  switch (self._tag) {
    case "Failure":
      {
        switch (that._tag) {
          case "Success":
            {
              return self;
            }

          case "Failure":
            {
              return tsplus_module_1.failCause(g(self.cause, that.cause));
            }
        }
      }

    case "Success":
      {
        switch (that._tag) {
          case "Success":
            {
              return tsplus_module_2.succeed(f(self.value, that.value));
            }

          case "Failure":
            {
              return that;
            }
        }
      }
  }
}
/**
 * Zips this together with the specified result using the combination
 * functions.
 *
 * @tsplus static ets/Exit/Aspects zipWith
 */

export const zipWith = (that, f, g) => self => zipWith_(self, that, f, g);
//# sourceMappingURL=zipWith.mjs.map