The current proposed names looks like the followin...
# arrow
r
The current proposed names looks like the following. Note this is not the actual impl but just the names.
Copy code
CatchIO<E, A> // base IO that has built in bifunctor and its parametric to E
typealias IO<A> = CatchIO<Throwable, A>
typealias EnvIO<R, E, A> = R.() -> IO<E, A>
We are open to new names or suggestions that are easy for users so feel free to comment on this message in a thread and we can look into different options
🤔 1
i
EnvIO would be used to create a IO were the Throwable is mapped to E (sealed class) using a function? I'm trying to understand if I will be able to replicate what I do today with Either but in a IO world.
Today I pattern match on Throwable to put on left a specific type from the sealed class that represents the domain errors. Would it be possible with the new enhanced IO types?
r
You will be able to use directly also any of the following as effects suspend () -> A suspend () -> Either<E, A> suspend R.() -> Either<E, A>
🙌 1
🔥 1
p
should we start using runNonBlocking on the examples? unless there’s threading they’ll behave like runBlocking
r
I think if they are equiped with
main
it has to
runBlocking
to get back
A
before the JVM exits. But for people integrating them on Android etc they should definetly not call
runBlocking
unless they know what they are doing
is that what you mean @pakoito?
p
yeah. Case is, runNonBlocking behaves like runBlocking for non-threaded calls, right?
yeah it returns unit, but it starts executing immediatelly and because it doens’t change threads by the time the function returns control to runNonBlocking to return Unit, everything has run
s
This is currently the case in
IO
and in the current impl of
Fx
. Although @raulraja originally designed it to start
runNonBlocking
on the
NonBlocking
ctx we provide in effects. To improve that “weird” behavior, “weird” is not the correct word but it has caused me quite some confusion already
So I think the idea is still to start it on
NonBlocking
instead of
EmptyCoroutineContext
or
Unconfined
. @raulraja right?
r
Can't recall now but let's revisit this as part of the Fx Revamp