traverse

inline fun <E, A, B> Either<E, A>.traverse(transform: (value: A) -> Iterable<B>): List<Either<E, B>>(source)
inline fun <E, A, B> Either<E, A>.traverse(transform: (value: A) -> Option<B>): Option<Either<E, B>>(source)
inline fun <A, B, AA, C> Ior<A, B>.traverse(f: (B) -> Either<AA, C>): Either<AA, Ior<A, C>>(source)
inline fun <A, B, C> Ior<A, B>.traverse(f: (B) -> Option<C>): Option<Ior<A, C>>(source)
inline fun <A, B, C> Ior<A, B>.traverse(f: (B) -> Iterable<C>): List<Ior<A, C>>(source)


inline fun <E, A, B> Iterable<A>.traverse(f: (A) -> Either<E, B>): Either<E, List<B>>(source)

Returns an Either of a list of B results of applying the given transform function to each element(A) in the original collection.


inline fun <A, B> Iterable<A>.traverse(f: (A) -> Result<B>): Result<List<B>>(source)

Returns a Result of a list of B results of applying the given transform function to each element(A) in the original collection.


inline fun <A, B> Iterable<A>.traverse(f: (A) -> Option<B>): Option<List<B>>(source)

Returns an Option of a list of B results of applying the given transform function to each element(A) in the original collection.


inline fun <K, E, A, B> Map<K, A>.traverse(f: (A) -> Either<E, B>): Either<E, Map<K, B>>(source)

Map a function that returns an Either over all the values in the Map. If the function returns a Right, the value is added to the resulting Map. If the function returns a Left, the result is the Left.


inline fun <K, A, B> Map<K, A>.traverse(f: (A) -> Option<B>): Option<Map<K, B>>(source)

Map a function that returns an Option over all the values in the Map. If the function returns a Some, the value is added to the resulting Map. If the function returns a None, the result is None.


inline fun <E, A, B> Nel<A>.traverse(f: (A) -> Either<E, B>): Either<E, NonEmptyList<B>>(source)

Map a function that returns an Either across the NonEmptyList.

The first Left result from calling the function will be the result, or if no calls result in a Left the result will be a Right(NonEmptyList) of all the B's returned.


inline fun <A, B> NonEmptyList<A>.traverse(f: (A) -> Option<B>): Option<NonEmptyList<B>>(source)

Map a function that returns an Option across the NonEmptyList.

The first None result from calling the function will be the result, or if no calls result in a None the result will be a Some(NonEmptyList) of all the B's returned.


inline fun <T, E, U> Option<T>.traverse(f: (T) -> Either<E, U>): Either<E, Option<U>>(source)

Map a function that returns an Either across the Option.

If the option is a None, return a Right(None). If the option is a Some, apply f to the value. If f returns a Right, wrap the result in a Some.


inline fun <A, B> Option<A>.traverse(f: (A) -> Iterable<B>): List<Option<B>>(source)

Map a function that returns an Iterable across the Option.

If the option is a None, return an empty List If the option is a Some, apply f to the value and wrap the result in a Some.


inline fun <A, E, B> Sequence<A>.traverse(f: (A) -> Either<E, B>): Either<E, List<B>>(source)

Map a function that returns an Either across the Sequence.


inline fun <A, B> Sequence<A>.traverse(f: (A) -> Option<B>): Option<List<B>>(source)

Map a function that returns an Option across the Sequence.