this doesn’t work : `val (a: A, b: B) = parZip({ f...
# arrow
s
this doesn’t work :
val (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.0
j
Kotlin is unable do lift
::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.
s
(A, B) -> Pair<A, B>
 to 
suspend (A, B) -> Pair<A, B>
This has actually been fixed, the reason why
::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.
It's a bit annoying but it's the most precise/powerful signature.
j
Ooo nice, I did not know that. Can we add overloads for that without adding ambiguity?
s
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.
You mean this? It can not be added without duplicating the full API
j
parZip(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.
s
No, that cannot be added as default lambda
j
because of the receiver? If so can't we just use the current context?
Dunno really, probably just need to start intellij and see the error myself