Attila Domokos
01/22/2020, 6:14 PMEitherT<ForIO>
extensively. I really like the code I have, however, some people are lost with monad transformers. I tried to dummy down the example to use IO<Either<A, B>
, however, the code is not very attractive. Check out the functions run
using EitherT and run2
using IO<Either> types. Why do I need to call unsafeRunSync
in function run2
to call that code? Does flatMap
invalidate the fx
context? https://github.com/adomokos/kotlin-sandbox/blob/ad/io-either/src/main/kotlin/sandbox/explorer/App.kt#L65-L98simon.vergauwen
01/22/2020, 6:20 PMConcurrent
instances for EitherT
a while ago, they should be released soon.
Anyhow, it’s hard to see what’s going on. You should be able to call !
for those `IO`s within that IO.fx
block, but I am unsure what is going on with the transaction
block. It seems to be missing in the EitherT
alternativeJannis
01/22/2020, 7:40 PMtraverse
followed by bind().flatten()
on the either, because you cannot bind
inside Either.flatMap
as you are technically no longer in fx
comprehension scope.Jannis
01/22/2020, 7:41 PMunsafeRunSync
is probably as already mentioned because transaction
messes with scope, it should work unless transaction
introduces suspend or somethingsimon.vergauwen
01/22/2020, 7:42 PMIO<Either<E, A>>
from EitherT
by simply calling value()
that way you can still use EitherT
nested in functions or only in places where you wants it’s powers over IO<Either<E, A>>
but you can perfectly mix-and-match them.raulraja
01/22/2020, 8:14 PMAttila Domokos
01/22/2020, 8:15 PMBifunctor IO
?raulraja
01/22/2020, 8:34 PMraulraja
01/22/2020, 8:35 PMAttila Domokos
01/22/2020, 8:36 PM