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.