import * as tsplus_module_1 from "@tsplus/stdlib/data/Either/merge";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/retryOrElseEither";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/map";
export const retryOrElse_ = retryOrElse_1;
/**
 * Retries with the specified schedule, until it fails, and then both the
 * value produced by the schedule together with the last error are passed to
 * the recovery function.
 *
 * @tsplus fluent ets/Effect retryOrElse
 */

function retryOrElse_1(self, policy, orElse, __tsplusTrace) {
  return tsplus_module_3.map_(tsplus_module_2.retryOrElseEither_(self, policy, orElse, __tsplusTrace), either => tsplus_module_1.merge(either), __tsplusTrace);
}
/**
 * Retries with the specified schedule, until it fails, and then both the
 * value produced by the schedule together with the last error are passed to
 * the recovery function.
 *
 * @tsplus static ets/Effect/Aspects retryOrElse
 */


export function retryOrElse(policy, orElse, __tsplusTrace) {
  return self => retryOrElse_1(self, policy, orElse, __tsplusTrace);
}
//# sourceMappingURL=retryOrElse.mjs.map