//arrow-core/arrow.core/Either/tapLeft
common inline fun tapLeft(f: (A) -> Unit): Either<A, B>
The given function is applied as a fire and forget effect if this is a Left. When applied the result is ignored and the original Either value is returned
Example:
import arrow.core.*
fun main() {
Either.Right(12).tapLeft { println("flower") } // Result: Right(12)
Either.Left(12).tapLeft { println("flower") } // Result: prints "flower" and returns: Left(12)
}
Do you like Arrow?
✖