New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace mapN with zip #2315
Replace mapN with zip #2315
Conversation
Task linked: CU-fb4p28 Replace mapN with zip |
i: Either<A, I>, | ||
map: (B, C, D, E, F, G, H, I) -> J | ||
): Either<A, J> = | ||
zip(c, d, e, f, g, h, i, Either.unit, Either.unit) { b, c, d, e, f, g, h, i, _, _ -> map(b, c, d, e, f, g, h, i) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just realized we have Either.unit
vs Eval.Unit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either.unit
is internal
and Eval.Unit
is deprecated ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nomisRev !
* When working with `NonEmptyList` in the `Invalid` side, there is no need to supply `Semigroup` as shown in the example above. | ||
* | ||
* ```kotlin:ank:silent | ||
* import arrow.core.Validated | ||
* import arrow.core.validNel | ||
* import arrow.core.zip | ||
* | ||
* //sampleStart | ||
* val parallelValidate = | ||
* 1.validNel().zip(2.validNel()) | ||
* { a, b -> /* combine the result */ } | ||
* //sampleEnd | ||
* ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanksk @nomisRev 🙌🏾
Currently, in Arrow we have
mapN
fromApply
. This PR proposes to replace it in Arrow withzip
, which is more in line with the Kotlin Std.For example the Kotlin Std exposes
zip
arity 2 forIterable
and instead of duplicatingzip
withmapN
and providing up to arity 10 we can now just extend the Kotlin Std API and expose arity 3-10 forIterable#zip
. Doing so we clearly complement the Kotlin Std instead of proposing alternative APIs.It also prevents us from having to do 2 deprecation cycles, and will result in a
@Deprecated
free library @0.13.0
.This PR also removes all
N
based APIs by also replacingparMapN
in Arrow Fx Coroutines withparZip
.