import * as tsplus_module_1 from "@effect/core/io/Effect/operations/failCauseNow";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/zipRight";
import * as tsplus_module_3 from "@effect/core/io/Cause/operations/failureOrCause";
import * as tsplus_module_4 from "@tsplus/stdlib/data/Either/fold";
import * as tsplus_module_5 from "@effect/core/io/Effect/operations/as";
import * as tsplus_module_6 from "@effect/core/io/Effect/operations/foldCauseEffect";
/**
 * Returns an effect that effectfully "peeks" at the failure or success of
 * this effect.
 *
 * @tsplus fluent ets/Effect tapBoth
 */

export function tapBoth_(self, f, g, __tsplusTrace) {
  return tsplus_module_6.foldCauseEffect_(self, cause => tsplus_module_4.fold_(tsplus_module_3.failureOrCause(cause), e => tsplus_module_2.zipRight_(f(e), () => tsplus_module_1.failCauseNow(cause, __tsplusTrace), __tsplusTrace), () => tsplus_module_1.failCauseNow(cause, __tsplusTrace)), a => tsplus_module_5.as_(g(a), () => a, __tsplusTrace), __tsplusTrace);
}
/**
 * Returns an effect that effectfully "peeks" at the failure or success of
 * this effect.
 *
 * @tsplus static ets/Effect/Aspects tapBoth
 */

export const tapBoth = (f, g, __tsplusTrace) => self => tapBoth_(self, f, g, __tsplusTrace);
//# sourceMappingURL=tapBoth.mjs.map