Satyam Agarwal
03/31/2021, 4:23 PMval (a: A, b: B) = parZip({ funA() }, { funB() }, ::Pair)
but this works :
val (a: A, b: B) = parZip({ funA() }, { funB() }) { a, b -> a to b }
in v0.13.0Jannis
03/31/2021, 4:37 PM::Pair
from (A, B) -> Pair<A, B>
to suspend (A, B) -> Pair<A, B>
.
parZip(a, b, f)
allows f
to be suspend which rules out ::func
in most cases afaik.
Imo { a, b -> a to b }
could also be added as a default to use for all of the zipping operators when no combine function is given.simon.vergauwen
03/31/2021, 7:09 PMThis has actually been fixed, the reason whyto(A, B) -> Pair<A, B>
suspend (A, B) -> Pair<A, B>
::Pair
does no longer work is because there is a CoroutineScope
receiver in the lambda.
The Kotlin compiler cannot ignore unused receivers since those look like (CoroutineScope, A, B) -> Pair<A, B>
on the JVM.simon.vergauwen
03/31/2021, 7:20 PMJannis
03/31/2021, 7:24 PMsimon.vergauwen
03/31/2021, 7:25 PMImoYou mean this? It can not be added without duplicating the full APIcould also be added as a default to use for all of the zipping operators when no combine function is given.{ a, b -> a to b }
Jannis
03/31/2021, 7:27 PMparZip(a, b, f = { a, b -> a to b })
can not be added? With ambiguity I was referring to adding some way of doing parZip(a, b, f)
where f
has no CoroutineScope
receiver.simon.vergauwen
03/31/2021, 7:28 PMJannis
03/31/2021, 7:33 PMJannis
03/31/2021, 7:33 PM