// ets_tracing: off import type { Cause } from "../Cause/cause.js" import * as O from "../Option/index.js" import { foldCauseM_, halt, succeed } from "./core.js" import type { Effect } from "./effect.js" /** * Recovers from some or all of the error cases with provided cause. */ export function catchSomeCause_( effect: Effect, f: (_: Cause) => O.Option>, __trace?: string ) { return foldCauseM_( effect, (c): Effect => O.fold_( f(c), () => halt(c), (a) => a ), succeed, __trace ) } /** * Recovers from some or all of the error cases with provided cause. * * @ets_data_first catchSomeCause_ */ export function catchSomeCause( f: (_: Cause) => O.Option>, __trace?: string ) { return (effect: Effect) => catchSomeCause_(effect, f, __trace) }