arrow icon indicating copy to clipboard operation
arrow copied to clipboard

["Request"] Consider overloading Arrow Fx ParZip for tupling

Open nomisRev opened this issue 3 years ago • 0 comments

When working with parZip you often want to combine it with Effect, rather than exposing many variants of the API these API compose naturally. In Arrow 1.x.x we decided not to overload parZip with a default lambda for the size of the binary.

Since Arrow 2.0 will significantly reduce the size of the binary, we should consider adding these overloads again. For example, when ignoring results or turning values into a tuple it currently requires some annoying overhead.

either<E, Unit> {
  parZip(
    { computation().bind() },
    { computation().bind() }
  ) { _,_ -> }
}

either<E, Pair<Unit, Unit>> {
  parZip(
    { computation().bind() },
    { computation().bind() }
  ) { a, b -> Pair(a, b) } // ::Pair lambda reference is not allowed here due to the `CoroutineScope` receiver.
}

See discussion on Slack: https://kotlinlang.slack.com/archives/C5UPMM0A0/p1662715323510559

nomisRev avatar Sep 09 '22 09:09 nomisRev