import * as tsplus_module_1 from "@effect/core/io/Effect/operations/fail";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/repeatOrElse";
export const repeat_ = repeat_1;
/**
 * Returns a new effect that repeats this effect according to the specified
 * schedule or until the first failure. Scheduled recurrences are in addition
 * to the first execution, so that `io.repeat(Schedule.once)` yields an effect
 * that executes `io`, and then if that succeeds, executes `io` an additional
 * time.
 *
 * @tsplus fluent ets/Effect repeat
 */

function repeat_1(self, schedule, __tsplusTrace) {
  return tsplus_module_2.repeatOrElse_(self, schedule, (e, _) => tsplus_module_1.fail(() => e, __tsplusTrace), __tsplusTrace);
}
/**
 * Returns a new effect that repeats this effect according to the specified
 * schedule or until the first failure. Scheduled recurrences are in addition
 * to the first execution, so that `io.repeat(Schedule.once)` yields an effect
 * that executes `io`, and then if that succeeds, executes `io` an additional
 * time.
 *
 * @tsplus static ets/Effect/Aspects repeat
 */


export function repeat(schedule, __tsplusTrace) {
  return self => repeat_1(self, schedule, __tsplusTrace);
}
//# sourceMappingURL=repeat.mjs.map