onRight

inline fun onRight(action: (right: B) -> Unit): Either<A, B>(source)

Performs the given action on the encapsulated B value if this instance represents Either.Right. Returns the original Either unchanged.

import arrow.core.Either
import io.kotest.matchers.shouldBe

fun test() {
Either.Right(1).onRight(::println) shouldBe Either.Right(1)
}