// ets_tracing: off import type { Cause } from "../Cause/cause.js" import { chain_, foldCauseM_, halt, succeed } from "./core.js" import type { Effect } from "./effect.js" /** * Returns an effect that effectually "peeks" at the cause of the failure of * this effect. * * @ets_data_first tapCause_ */ export function tapCause( f: (e: Cause) => Effect, __trace?: string ) { return (effect: Effect) => tapCause_(effect, f, __trace) } /** * Returns an effect that effectually "peeks" at the cause of the failure of * this effect. */ export function tapCause_( effect: Effect, f: (e: Cause) => Effect, __trace?: string ) { return foldCauseM_(effect, (c) => chain_(f(c), () => halt(c)), succeed, __trace) }