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/failureOrCause";
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";
/**
 * Recovers from some or all of the error cases.
 *
 * @tsplus fluent ets/Effect catchSome
 */

export function catchSome_(self, f, __tsplusTrace) {
  return tsplus_module_6.foldCauseEffect_(self, cause => tsplus_module_4.fold_(tsplus_module_3.failureOrCause(cause), x => tsplus_module_2.getOrElse_(f(x), () => tsplus_module_1.failCauseNow(cause, __tsplusTrace)), tsplus_module_1.failCauseNow), tsplus_module_5.succeedNow, __tsplusTrace);
}
/**
 * Recovers from some or all of the error cases.
 *
 * @tsplus static ets/Effect/Aspects catchSome
 */

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