stm
Helper to create stm blocks that can be run with STM.orElse
import arrow.fx.stm.atomically
import arrow.fx.stm.stm
suspend fun main() {
//sampleStart
val i = 4
val result = atomically {
stm {
if (i == 4) retry()
"Not 4"
} orElse { "4" }
}
//sampleEnd
println("Result $result")
}
Content copied to clipboard