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


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?

Arrow Org