stepango
suspend fun <T : Any> IO<T>.await(): Either<Throwable, T> = suspendCoroutine { cont -> unsafeRunAsync { it.fold( { cont.resume(it.left()) }, { cont.resume(it.right()) } ) } }
arrow-effects-kotlinx-coroutines
raulraja
val result = DeferredK<Int> = DeferredK.monad.binding { val a = async { 1 }.k().bind() val b = async { 1 }.k().bind() a + b }
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) })
A modern programming language that makes developers happier.