As of Arrow 0.9.0, we have deprecated support for Deferred from kotlinx.coroutines. Using Deferred as a return type is considered a smell by the library owners, and we were not able to make it work consistently against some of the Laws.

But, we have not given up support for suspend functions! If you would like to use suspend fun, you can do so using arrow-fx:

import arrow.fx.IO
import arrow.unsafe
import arrow.fx.extensions.fx
suspend fun sayHello(): Unit =
  println("Hello World")

suspend fun sayGoodBye(): Unit =
  println("Good bye World!")

fun greet(): IO<Unit> =
  IO.fx {
    !effect { sayHello() }
    !effect { sayGoodBye() }
fun main() { // The edge of our world
  unsafe { runBlocking { greet() } }

Do you like Arrow?

Arrow Org