My understanding is `parTraverse` operation is dif...
# arrow
g
My understanding is
parTraverse
operation is different from
traverse
operation. It's not just
traverse
operation in parallel. If I am not missing something, aren't their names kind of misleading?
s
parTraverse
works in a similar way as
traverse
. Although the signature is a little different in
Concurrent
as it is in
Traverse
. We could've implemented
parTraverse
as an extension function of
Traverse
which would then require
Concurrent
instead of
Applicative
. Additionally, as it's with all parallel operations. if you'd launch
parTraverse
on a single threaded pool, it'll behave the same as
traverse
on that single pool. That's why in Arrow Fx Coroutines you see the following optimisation. https://github.com/arrow-kt/arrow-fx/blob/master/arrow-fx-coroutines/src/main/kotlin/arrow/fx/coroutines/ParTraverse.kt#L93 Where having no dispatcher, or having an
EmptyCoroutineContext
parTraverse == traverse
.
g
Thank you @simon.vergauwen 🙂
👍 1