Skip to content
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

Backport zipOrAccumulate for Either #2916

Merged
merged 11 commits into from
Feb 6, 2023
Merged

Backport zipOrAccumulate for Either #2916

merged 11 commits into from
Feb 6, 2023

Conversation

nomisRev
Copy link
Member

@nomisRev nomisRev commented Feb 3, 2023

No description provided.

@nomisRev nomisRev added the 1.2.0 Tickets belonging to 1.1.2 label Feb 3, 2023
@nomisRev nomisRev requested review from serras, raulraja, franciscodr and a team February 3, 2023 17:17
Copy link
Member

@serras serras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with contracts, awesome!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2023

Kover Report

File Coverage [57.04%]
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Either.kt 56.45%
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/predef.kt 100.00%
Total Project Coverage 42.87%

transform: (A, B) -> Z,
): Either<E, Z> {
contract { callsInPlace(transform, InvocationKind.AT_MOST_ONCE) }
return zipOrAccumulate(combine, a, b, unit, unit, unit, unit, unit, unit, unit, unit) { a, bb, _, _, _, _, _, _, _, _ ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename the lambda parameter to aa as we do with the rest of the parameters? That would avoid some confusion. Same for the rest of the zipOrAccumulate functions below.

Suggested change
return zipOrAccumulate(combine, a, b, unit, unit, unit, unit, unit, unit, unit, unit) { a, bb, _, _, _, _, _, _, _, _ ->
return zipOrAccumulate(combine, a, b, unit, unit, unit, unit, unit, unit, unit, unit) { aa, bb, _, _, _, _, _, _, _, _ ->

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you for catching this @franciscodr 🙏 I updated the code.

Copy link
Collaborator

@franciscodr franciscodr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @nomisRev!

@nomisRev nomisRev merged commit 0fc2721 into main Feb 6, 2023
@nomisRev nomisRev deleted the sv-zipOrAccumulate branch February 6, 2023 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.2.0 Tickets belonging to 1.1.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants