```suspend fun <T : Any> IO<T>.await()...
# arrow
s
Copy code
suspend fun <T : Any> IO<T>.await(): Either<Throwable, T> = suspendCoroutine { cont ->
    unsafeRunAsync {
        it.fold(
                { cont.resume(it.left()) },
                { cont.resume(it.right()) }
        )
    }
}
Still don't understand how i suppose to use
arrow-effects-kotlinx-coroutines
r
A way to use it...
Copy code
val result = DeferredK<Int> = DeferredK.monad.binding {
  val a = async { 1 }.k().bind()
  val b = async { 1 }.k().bind()
  a + b
}
or gathering async parallel results:
Copy code
val remoteA = async { 1 }.k()
val remoteB = async { '1' }.k()
val remoteC = async { "1" }.k()

val result: DeferredK<Response> =   DeferredK.applicative().map(
  remoteA, remoteB, remoteC, { (a, b, c) -> 
      Response(a, b, c)
})
In the latter case type information is preserved across map and it's also non blocking.
s
thanks a lot 👍