flatMap

inline fun <A, B, C> Either<A, B>.flatMap(f: (right: B) -> Either<A, C>): Either<A, C>(source)

Map, or transform, the right value B of this Either into a new Either with a right value of type C. Returns a new Either with either the original left value of type A or the newly transformed right value of type C.

Parameters

f

The function to bind across Right.


inline fun <A, B, D> Ior<A, B>.flatMap(combine: (A, A) -> A, f: (B) -> Ior<A, D>): Ior<A, D>(source)

Binds the given function across Ior.Right.

Parameters

f

The function to bind across Ior.Right.


inline fun <A, B> Result<A>.flatMap(transform: (value: A) -> Result<B>): Result<B>(source)

Compose a transform operation on the success value A into B whilst flattening Result.

See also

if you want run a function that catches and maps with (A) -> B


fun <K, A, B> Map<K, A>.flatMap(f: (Map.Entry<K, A>) -> Map<K, B>): Map<K, B>(source)

Transform every Map.Entry of the original Map using f, only keeping the Map.Entry of the transformed map that match the input Map.Entry.