arrow-fx / arrow.fx.typeclasses / Concurrent / parTraverse

parTraverse

open fun <G, A, B> Kind<G, A>.parTraverse(ctx: CoroutineContext, TG: Traverse<G>, f: (A) -> Kind<F, B>): Kind<F, Kind<G, B>>

Given a function which returns an F effect, run this effect in parallel for all the values in G.

Note: Be careful when using this on very large collections or infinite sequences as this needs to fold the entire collection first before it can start executing anything. This may cause excessive memory usage, or even infinite looping (in case of infinite sequences). Using parTraverse like this may imply that what you’d actually want is streaming, which will come to arrow in the future.

open fun <G, A, B> Kind<G, A>.parTraverse(TG: Traverse<G>, f: (A) -> Kind<F, B>): Kind<F, Kind<G, B>> open fun <A, B> Iterable<A>.parTraverse(ctx: CoroutineContext, f: (A) -> Kind<F, B>): Kind<F, List<B>> open fun <A, B> Iterable<A>.parTraverse(f: (A) -> Kind<F, B>): Kind<F, List<B>>

See Also

parTraverse

Do you like Arrow?

Arrow Org
<