import type { HasClock } from "../Clock"
import * as E from "../Either"
import type { Schedule } from "../Schedule"
import type { Effect } from "./effect"
/**
 * Returns an effect that retries this effect with the specified schedule when it fails, until
 * the schedule is done, then both the value produced by the schedule together with the last
 * error are passed to the specified recovery function.
 */
export declare function retryOrElseEither_<R, E extends I, A, I, R1, O, R2, E2, A2>(
  self: Effect<R, E, A>,
  policy: Schedule<R1, I, O>,
  orElse: (e: E, o: O) => Effect<R2, E2, A2>,
  __trace?: string
): Effect<R & R1 & R2 & HasClock, E2, E.Either<A2, A>>
/**
 * Returns an effect that retries this effect with the specified schedule when it fails, until
 * the schedule is done, then both the value produced by the schedule together with the last
 * error are passed to the specified recovery function.
 *
 * @dataFirst retryOrElseEither_
 */
export declare function retryOrElseEither<E extends I, I, R1, O, R2, E2, A2>(
  policy: Schedule<R1, I, O>,
  orElse: (e: E, o: O) => Effect<R2, E2, A2>,
  __trace?: string
): <R, A>(
  self: Effect<R, E, A>
) => Effect<
  R & R1 & R2 & import("../Has").Has<import("../Clock").Clock>,
  E2,
  E.Either<A2, A>
>
/**
 * 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.
 */
export declare function retryOrElse_<R, E extends I, I, A, R1, O, R2, E2, A2>(
  self: Effect<R, E, A>,
  policy: Schedule<R1, I, O>,
  orElse: (e: E, o: O) => Effect<R2, E2, A2>,
  __trace?: string
): Effect<R & R1 & R2 & HasClock, E2, A | A2>
/**
 * 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.
 *
 * @dataFirst retryOrElse_
 */
export declare function retryOrElse<E extends I, I, R1, O, R2, E2, A2>(
  policy: Schedule<R1, I, O>,
  orElse: (e: E, o: O) => Effect<R2, E2, A2>,
  __trace?: string
): <R, A>(
  self: Effect<R, E, A>
) => Effect<R & R1 & R2 & import("../Has").Has<import("../Clock").Clock>, E2, A2 | A>
/**
 * Retries with the specified retry policy.
 * Retries are done following the failure of the original `io` (up to a fixed maximum with
 * `once` or `recurs` for example), so that that `io.retry(Schedule.once)` means
 * "execute `io` and in case of failure, try again once".
 */
export declare function retry_<R, E extends I, I, A, R1, O>(
  self: Effect<R, E, A>,
  policy: Schedule<R1, I, O>,
  __trace?: string
): Effect<R & R1 & HasClock, E, A>
/**
 * Retries with the specified retry policy.
 * Retries are done following the failure of the original `io` (up to a fixed maximum with
 * `once` or `recurs` for example), so that that `io.retry(Schedule.once)` means
 * "execute `io` and in case of failure, try again once".
 *
 * @dataFirst retry_
 */
export declare function retry<R1, I, O>(
  policy: Schedule<R1, I, O>,
  __trace?: string
): <E extends I, R, A>(
  self: Effect<R, E, A>
) => Effect<R & R1 & import("../Has").Has<import("../Clock").Clock>, E, A>
//# sourceMappingURL=retry.d.ts.map
