onLeft

inline fun onLeft(action: (left: A) -> Unit): Either<A, B>(source)

Performs the given action on the encapsulated A if this instance represents Either.Left. Returns the original Either unchanged.

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

fun test() {
Either.Left(2).onLeft(::println) shouldBe Either.Left(2)
}