raulraja
06/04/2019, 2:22 PMsuspend
we may even lift that restriction in fx
down the road but in whatever case the biz about getting rid of Either is that IO is gonna be soon IO<E, A>
so you don't need Either
because you can do just(a)
or raiseError(e)
and that is the same as Either. You can also do raiseError(exception)
.Derek Berner
06/04/2019, 2:24 PMTry
going away, but I'll point out I'm not super happy about Either
going away. There are other reasons to use tagged unions besides error conditionsDerek Berner
06/04/2019, 2:25 PMDerek Berner
06/04/2019, 2:26 PMCoproduct2
because you already have Either
Derek Berner
06/04/2019, 2:27 PMIO
represents a program while Either
represents a tagged union type - one is not a drop-in for the otherDerek Berner
06/04/2019, 2:28 PMTask x a
and Result x a
sam
06/04/2019, 2:33 PMsam
06/04/2019, 2:33 PMDerek Berner
06/04/2019, 2:34 PMIO
to Task
?Derek Berner
06/04/2019, 2:38 PMDerek Berner
06/04/2019, 2:43 PMEither<Long,Customer>
from a JSON RPC call - the left hand case indicating that a database lookup is required.sam
06/04/2019, 2:43 PMDerek Berner
06/04/2019, 2:44 PMEither<RPCError, Customer>
off to Kotlinx SerializationDerek Berner
06/04/2019, 2:45 PMhandleErrorWith
but that seems like taking the long wayraulraja
06/04/2019, 2:52 PMraulraja
06/04/2019, 2:53 PMsuspend() -> Either<E, A>
then you can replace it with IO<E, A>
raulraja
06/04/2019, 2:53 PMraulraja
06/04/2019, 2:54 PMraulraja
06/04/2019, 2:55 PMTry
because it can't suspend side effectsam
06/04/2019, 2:56 PMraulraja
06/04/2019, 3:03 PMTry { suspendedFunction() }
unless you are in suspend right?raulraja
06/04/2019, 3:04 PMraulraja
06/04/2019, 3:04 PMIO { suspendedFunction() }
that works and handles errorsraulraja
06/04/2019, 3:05 PMdelay
inside suspension because it has no way to suspend the coroutineraulraja
06/04/2019, 3:05 PMraulraja
06/04/2019, 3:06 PMraulraja
06/04/2019, 3:06 PMraulraja
06/04/2019, 3:07 PMsam
06/04/2019, 3:19 PMsam
06/04/2019, 3:19 PMsam
06/04/2019, 3:19 PMraulraja
06/04/2019, 5:37 PMraulraja
06/04/2019, 5:37 PMraulraja
06/04/2019, 5:38 PMraulraja
06/04/2019, 5:38 PMsam
06/04/2019, 5:58 PMkioba
06/04/2019, 8:24 PM