Kev
06/30/2025, 6:28 AMsimon.vergauwen
06/30/2025, 7:16 AMAtomicReference
is a side-effect and thus needs to be wrapped in IO
(or suspend
).
It didn't make any sense in Kotlin (nor in Arrow-kt), it was a bad decision and we reverted it in 2.x.x.
Besides the history rant, you can safely wrap in runBlocking
and just extract it because it never suspend during construction. I think you can safely do this for KMP since it doesn't actually suspend.
var breaker: CircuitBreaker
suspend {
CircuitBreaker(..)
}.startCoroutine(Continuation(EmptyCoroutineContext) {
breaker = it.getOrThrow()
})
Kev
07/01/2025, 6:26 AMKev
07/01/2025, 6:27 AM