mapOrAccumulate

inline fun <Error, A, B> Iterable<A>.mapOrAccumulate(combine: (Error, Error) -> Error, transform: Raise<Error>.(A) -> B): Either<Error, List<B>>

Returns Either a List containing the results of applying the given transform function to each element in the original collection, or accumulate all the logical errors that were raised while transforming the collection. The combine function is used to accumulate all the logical errors.


inline fun <Error, A, B> Iterable<A>.mapOrAccumulate(transform: Raise<Error>.(A) -> B): Either<NonEmptyList<Error>, List<B>>

Returns Either a List containing the results of applying the given transform function to each element in the original collection, or accumulate all the logical errors into a NonEmptyList that were raised while applying the transform function.