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