arrow-core-data / arrow.core / rightIfNotNull
inline fun <A, B> B?.rightIfNotNull(default: () -> A):
Either
<A, B>
Returns Either.Right if the value of type B is not null, otherwise the specified A value wrapped into an Either.Left.
Example:
"value".rightIfNotNull { "left" } // Right(b="value")
null.rightIfNotNull { "left" } // Left(a="left")
Do you like Arrow?
✖