Currently using something like ```fun onSomethingC...
# arrow
s
Currently using something like
Copy code
fun onSomethingChecked(isTrue: Boolean, onTrue: () -> Unit, onFalse: () -> Unit) {...}
s
There is
Either.conditionally
but I am personally more a fan of just using
if exprssions
. https://arrow-kt.io/docs/apidocs/arrow-core/arrow.core/-either/-companion/conditionally.html
s
Oo, that should be perfect
In most case I prefer
if
/`else` , but this is a special case where the goal is to extract the `if`/`else` from a UI layer
Thank you, Simon 🙂
👍 1
m
If it is about checking boolean conditions, and you are just returning
Unit
in a positive case, what do you think about using
ensure
? https://arrow-kt.io/docs/apidocs/arrow-core/arrow.core.computations/-either-effect/ensure.html
🔝 1
☝️ 1
s
Oo, that should come in handy. Thank you Mervyn 🙌