Hi, I have a question about definition ```suspend ...
# arrow
r
Hi, I have a question about definition
Copy code
suspend fun <A, B, C> retryOrElseEither(
  schedule: Schedule<A, B>,
  fa: suspend () -> A,
  orElse: suspend (Throwable, B) -> C
): Either<C, A>
Why is input of
schedule
type
A
instead of
Throwable
? I'm trying to use it but I can't figure how
r
A is the input to the Schedule. Schedule in fx coroutines operates over the notion that suspension already handles Throwable and it does not need to appear in the type signature except for the case where the schedule fails in
orElse
j
No this actually feels wrong.
retry
runs the schedule only on failure so the input should be
Throwable
. The
IO
version of this accepts
Throwable
or
E
(with MonadError) here whereas the
suspend
version doesn't. It is also casted to
Schedule<Throwable, B>
in the implementation so I believe this is a bug. @radekm for now you can probably get away with casting the
Schedule
to something like
Schedule<Throwable, B>
or similar @simon.vergauwen Is there a reason this changed when moving to
suspend
? If it's just an oversight I'll look into changing it^^
👍 1
s
@Jannis that was probably an oversight yes
r
@Jannis yes, casting schedule works, thanks
r
@radekm sorry for the confusion what @Jannis said 👍
👍 1