1

I'm getting below depreciation warning in arrow 1.1.2, could anyone please tell me what's the correct replacement for this?

[DEPRECATION] 'invoke(crossinline suspend OptionEffect<*>.() -> A?): Option' is deprecated. Deprecated in favor of the Effect Runtime

import arrow.core.computations.option
import arrow.core.Some
import arrow.core.none
import arrow.core.Option

suspend fun value(): Option<Int> =
//sampleStart
    option {
        val x = none<Int>().bind()
        val y = Some(1 + x).bind()
        val z = Some(1 + y).bind()
        x + y + z
    }

//sampleEnd
suspend fun main() {
    println(value())
}
Vencat
  • 1,272
  • 11
  • 36

1 Answers1

2

You should replace this import import arrow.core.computations.option for import arrow.core.continuations.option and it should fix your deprecation.

It changes the runtime with a package change, there is no breaking change in the Kotlin API.

nomisRev
  • 1,881
  • 8
  • 15
  • I struggled very much to figure out this simple solution. I wish the Deprecated tag in the arrow lib explained this so clearly – Somaiah Kumbera Oct 29 '22 at 13:37
  • 1
    Thanks for the feedback @SomaiahKumbera, I thought this was also explicitly stated in the deprecation message. Seems not :( A contribution or issue on GitHub to improve this would be very welcome, otherwise I will try to improve this before it’ll get hard removed in 2.x.x – nomisRev Oct 30 '22 at 13:41