arrow-fx-coroutines / arrow.fx.coroutines / Atomic / tryModify

tryModify

abstract suspend fun <B> tryModify(f: (A) -> Pair<A, B>): B?

Attempts to inspect the state, uptade it, and extract a different state.

tryModify behaves as tryUpdate but allows the update function to return an output value of type B.

Returns null if the update fails and B otherwise.

Do you like Arrow?

Arrow Org
<