/** * Retries this effect the specified number of times. * * @tsplus static effect/core/io/Effect.Aspects retryN * @tsplus pipeable effect/core/io/Effect retryN */ export function retryN(n: number) { return (self: Effect): Effect => retryNLoop(self, n) } function retryNLoop( self: Effect, n: number ): Effect { return self.catchAll((e) => n < 0 ? Effect.fail(e) : Effect.yieldNow > retryNLoop(self, n - 1)) }