// ets_tracing: off import type { Cause } from "../Cause/cause.js" import { foldCauseM_, succeed } from "./core.js" import type { Effect, RIO } from "./effect.js" /** * A more powerful version of `fold` that allows recovering from any kind of failure except interruptions. */ export function foldCause_( value: Effect, failure: (cause: Cause) => A2, success: (a: A) => A3, __trace?: string ): RIO { return foldCauseM_( value, (c) => succeed(failure(c)), (x) => succeed(success(x)), __trace ) } /** * A more powerful version of `fold` that allows recovering from any kind of failure except interruptions. * * @ets_data_first foldCause_ */ export function foldCause( failure: (cause: Cause) => A2, success: (a: A) => A3, __trace?: string ) { return (value: Effect): RIO => foldCause_(value, failure, success, __trace) }