Hi everyone, I had a use case recently where I had to return left in an either if the right value was not null. So I ended up writing an extension function for that:
Is there something that might have helped in Arrow and I've missed it?
t
thanh
04/04/2022, 2:56 PM
If you use either effect, I usually use this pattern
Copy code
fun loadValue(): Either<Error, Value?> = TODO()
either {
val valueOrNull = loadValue().bind()
val value = ensureNotNull(valueOrNull) { ValueNotFound }
}