import * as tsplus_module_1 from "@effect/core/io/Effect/operations/failCauseNow";
import * as tsplus_module_2 from "@tsplus/stdlib/data/Maybe/getOrElse";
import * as tsplus_module_3 from "@effect/core/io/Cause/operations/failureTraceOrCause";
import * as tsplus_module_4 from "@tsplus/stdlib/data/Either/fold";
import * as tsplus_module_5 from "@effect/core/io/Effect/operations/succeedNow";
import * as tsplus_module_6 from "@effect/core/io/Effect/operations/foldCauseEffect";
/**
 * A version of `catchSome` that gives you the trace of the error.
 *
 * @tsplus fluent ets/Effect catchSomeTrace
 */

export function catchSomeTrace_(self, f, __tsplusTrace) {
  return tsplus_module_6.foldCauseEffect_(self, cause => tsplus_module_4.fold_(tsplus_module_3.failureTraceOrCause(cause), tuple => tsplus_module_2.getOrElse_(f(tuple), () => tsplus_module_1.failCauseNow(cause, __tsplusTrace)), tsplus_module_1.failCauseNow), tsplus_module_5.succeedNow, __tsplusTrace);
}
/**
 * A version of `catchSome` that gives you the trace of the error.
 *
 * @tsplus static ets/Effect/Aspects catchSomeTrace
 */

export const catchSomeTrace = (f, __tsplusTrace) => self => catchSomeTrace_(self, f, __tsplusTrace);
//# sourceMappingURL=catchSomeTrace.mjs.map