https://kotlinlang.org logo
#arrow
Title
p

pakoito

04/25/2019, 9:35 PM
Copy code
fun <A> IO<A>.withRetry(err: Throwable, count: Int, shouldRetry: (count: Int, error: Throwable) -> Boolean) =
  if (!shouldRetry(err, count)) IO.raiseError(err)
  else handleErrorWith { withRetry(it, retries + 1, shouldRetry) }