//arrow-fx-coroutines/arrow.fx.coroutines/parSequenceResultN

parSequenceResultN

common

@JvmName(name = “parSequenceResultNScoped”)

suspend fun <A> Iterable<suspend .() -> [Result](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/index.html)<[A](par-sequence-result-n.html)>>.[parSequenceResultN](par-sequence-result-n.html)(n: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)): [Result](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/index.html)<[List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)<[A](par-sequence-result-n.html)>>

Traverses this Iterable and runs suspend CoroutineScope.() -> Result<A> in n parallel operations on CoroutineContext. If one or more of the tasks returns Result.failure then all the Result.failure results will be combined using addSuppressed.

Cancelling this operation cancels all running tasks.

common suspend fun <A> Iterable<suspend () -> Result<A».parSequenceResultN(n: Int): Result<List<A»

suspend fun <A> Iterable<suspend () -> Result<A».parSequenceResultN(ctx: CoroutineContext = EmptyCoroutineContext, n: Int): Result<List<A»

common

@JvmName(name = “parSequenceResultNScoped”)

suspend fun <A> Iterable<suspend .() -> [Result](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/index.html)<[A](par-sequence-result-n.html)>>.[parSequenceResultN](par-sequence-result-n.html)(ctx: [CoroutineContext](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/-coroutine-context/index.html) = EmptyCoroutineContext, n: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)): [Result](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/index.html)<[List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)<[A](par-sequence-result-n.html)>>

Traverses this Iterable and runs suspend CoroutineScope.() -> Result<A> in n parallel operations on CoroutineContext. If one or more of the tasks returns Result.failure then all the Result.failure results will be combined using addSuppressed.

Coroutine context is inherited from a CoroutineScope, additional context elements can be specified with ctx argument. If the combined context does not have any dispatcher nor any other ContinuationInterceptor, then Dispatchers.Default is used. WARNING If the combined context has a single threaded ContinuationInterceptor, this function will not run in parallel.

Cancelling this operation cancels all running tasks.

Do you like Arrow?

Arrow Org
<