We found two possible issues in DeferredK.async,
In this case, we found two issues:
1. the computation never ends.
2. The default value for the start parameter in arrow/effects/DeferredK.kt:63 is CoroutineStart.DEFAULT and it should be CoroutineStart.LAZY
Just using async works, but experimenting with this uncovered the strange behaviour explained in the two points above.
Example:
import arrow.core.*
import arrow.data.*
import arrow.effects.*
import arrow.effects.deferredk.functor.functor
import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
sealed class NumericError
data class NumericConversionError(val stringNumber: String): NumericError()
fun main(args:Array<String>) {
val eitherTDeferred1: EitherT<ForDeferredK, NumericConversionError, Int> = EitherT(DeferredK.async { Either.right(1) })
val folding1 = eitherTDeferred1.fold(DeferredK.functor(), {0}, {it})
runBlocking{println(folding1.await())}
}
@pakoito, @raulraja was able to have a look to this with me.
I am having the same problem. Any update?
We dropped support for DeferredK a couple of versions ago. My advice is to migrate to the latest.
I guess we can close this, otherwise feel free to reopen.
Most helpful comment
I guess we can close this, otherwise feel free to reopen.