bjonnh
04/25/2019, 9:39 PMfun <A> IO<A>.withRetry(err: Throwable, retries: Int): IO<A> =
if (retries == 0) IO.raiseError(err)
else if (err is BadRequestError) IO.raiseError(err)
else handleErrorWith {
withRetry(it, retries - 1)
}