carbaj0
fun <A, B> A?.toEither(error: () -> B): Either<B, A> = this?.right() ?: error().left()
stojan