Hugo
04/12/2021, 1:49 AMIO to suspend and wondering about interoperability. E.g. in this example, myFun() works as expected, despite log(..) being a suspended function. I believe this is because IO now uses suspend under the hood?
import <http://arrow.fx.IO|arrow.fx.IO>
import kotlinx.coroutines.delay
suspend fun log(message: String) {
delay(1000)
println(message)
}
fun myFun(): IO<Unit> = IO {
log("test")
}
myFun() // does nothing, suspended
myFun().unsafeRunSync() // logs "test"raulraja
04/12/2021, 7:23 AMsuspend fun main or integrating with an endpoint that takes suspend or in Android in whatever compose handlers etc. Other than that suspend already covers all the use cases of IO. https://www.47deg.com/blog/arrow-0.13.0-release/
https://arrow-kt.io/docs/effects/io/Hugo
04/12/2021, 7:24 AMraulraja
04/12/2021, 7:25 AM