andThen

inline fun <E, A, B> Validated<E, A>.andThen(f: (A) -> Validated<E, B>): Validated<E, B>

Apply a function to a Valid value, returning a new Validation that may be valid or invalid

Example:

import arrow.core.Validated
import arrow.core.andThen

fun main() {
Validated.Valid(5).andThen { Validated.Valid(10) } // Result: Valid(10)
Validated.Valid(5).andThen { Validated.Invalid(10) } // Result: Invalid(10)
Validated.Invalid(5).andThen { Validated.Valid(10) } // Result: Invalid(5)
}

expect infix fun <P1, P2, IP, R> (P1, P2) -> IP.andThen(f: (IP) -> R): (P1, P2) -> R
expect infix fun <IP, R> () -> IP.andThen(f: (IP) -> R): () -> R
expect infix fun <P1, IP, R> (P1) -> IP.andThen(f: (IP) -> R): (P1) -> R
actual infix fun <P1, P2, IP, R> (P1, P2) -> IP.andThen(f: (IP) -> R): (P1, P2) -> R
actual infix fun <IP, R> () -> IP.andThen(f: (IP) -> R): () -> R
actual infix fun <P1, IP, R> (P1) -> IP.andThen(f: (IP) -> R): (P1) -> R
actual infix fun <P1, P2, IP, R> (P1, P2) -> IP.andThen(f: (IP) -> R): (P1, P2) -> R
actual infix fun <IP, R> () -> IP.andThen(f: (IP) -> R): () -> R
actual infix fun <P1, IP, R> (P1) -> IP.andThen(f: (IP) -> R): (P1) -> R
actual infix fun <P1, P2, IP, R> (P1, P2) -> IP.andThen(f: (IP) -> R): (P1, P2) -> R
actual infix fun <IP, R> () -> IP.andThen(f: (IP) -> R): () -> R
actual infix fun <P1, IP, R> (P1) -> IP.andThen(f: (IP) -> R): (P1) -> R