Satyam Agarwal
09/14/2020, 12:02 AMparMapN?
interface SomeRepo {
suspend fun getId(someId: Int): Either<Throwable, Int>
suspend fun getName(someName: String): Either<Throwable, String>
}
interface AnotherClass {
val someRepo: SomeRepo
suspend fun <A, B> getResult(someName: String, someId: Int): Either<Throwable, Tuple2<Int, String>> {
return parMapN(
suspend { someRepo.getId(someId) },
suspend { someRepo.getName(someName) }
) { a, b -> a.product { b } }
}
}
the test doesn’t pass, it says This job hasn't completed yet when i execute getResult with runBlockingTestJannis
09/14/2020, 8:23 AMEnvironment().unsafeRunAsync/unsafeRunSync ?
If you need to bridge between kotlinx and arrow fx Satyam Agarwal
09/14/2020, 8:35 AMbracketCase and they run properly with kotlinx coroutines runner.
And since the implementations are leveraging suspend and kotlinx coroutines, and the documentation says both libraries are interoperable with each other, I shouldn’t have the need to use Environment() if i am using runBlocking or runBlockingTest from kotlinx coroutines.Jannis
09/14/2020, 8:41 AMkotlinx and arrow fx provide runners for kotlin couroutines (suspend functions). They can both be used to run suspend functions with all the benefits they each provide, but kotlinx and arrow fx compete with different approaches to things like for example cancellationJannis
09/14/2020, 8:41 AMkotlinx coroutines != kotlin coroutines which imo is terrible namingSatyam Agarwal
09/14/2020, 8:43 AMJannis
09/14/2020, 8:48 AMkotlinx use those I guess, but if not it is better to just stick to Environment to run arrow fx.