hi, Isn't there already a helper function to trans...
# arrow
c
hi, Isn't there already a helper function to transform nullable to either? Something like this:
Copy code
fun <A, B> A?.toEither(error: () -> B): Either<B, A> =
    this?.right() ?: error().left()
You can do mapLeft on the result for a custom error
c
nice, thanks!