// ets_tracing: off import type { Cause } from "../Cause/index.js" import type { Effect } from "./effect.js" import { sandbox } from "./sandbox.js" import { unsandbox } from "./unsandbox.js" /** * Companion helper to `sandbox`. Allows recovery, and partial recovery, from * errors and defects alike. * * @ets_data_first sandboxWith_ */ export function sandboxWith( f: (_: Effect, A>) => Effect, A>, __trace?: string ) { return (self: Effect) => sandboxWith_(self, f, __trace) } /** * Companion helper to `sandbox`. Allows recovery, and partial recovery, from * errors and defects alike. */ export function sandboxWith_( self: Effect, f: (_: Effect, A>) => Effect, A>, __trace?: string ) { return unsandbox(f(sandbox(self)), __trace) }