<https://github.com/arrow-kt/arrow/issues/1347>
# arrow-contributors
k
Sorry for the stupid question:
Copy code
fun <E, A> Kind<F, A>.withRetry(err: E, AE: ApplicativeError<F, E>, retries: Int) =
  if (retries == 0) AE.raiseError(err)
  else AE. run { this.handleErrorWith { withRetry(it,AE, retries - 1) } }
Wouldn't that just call itself until 0 without any other possible outcome?
p
that withRetry call is inside a lambda that’s called lazily
it won’t be called unless
this
fails
because
IO
is a lazy, suspended datatype
for eager datatypes…yeah it may stackoverflow if they’re unrecoverable errors and retries is large enough