//arrow-core/arrow.core/orElse

orElse

common inline fun <A> Option<A>.orElse(alternative: () -> Option<A>): Option<A>

Returns this option’s if the option is nonempty, otherwise returns another option provided lazily by default.

Parameters

common

   
alternative the default option if this is empty.

common inline fun <E, A> Validated<E, A>.orElse(default: () -> Validated<E, A>): Validated<E, A>

Return this if it is Valid, or else fall back to the given default. The functionality is similar to that of findValid except for failure accumulation, where here only the error on the right is preserved and the error on the left is ignored.

Do you like Arrow?

Arrow Org
<