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

Fix Either deprecation replacement expressions #2973

Merged
merged 15 commits into from
Mar 10, 2023
Merged

Conversation

gutiory
Copy link
Collaborator

@gutiory gutiory commented Mar 9, 2023

This PR fixes some of the deprecation ReplaceWith suggestions for Either listed in #2964. I'll update the issue table once this is merged.

@gutiory gutiory changed the title Fix Either deprecation replacement expression Fix Either deprecation replacement expressions Mar 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

Kover Report

File Coverage [57.86%]
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/Either.kt 57.86%
Total Project Coverage 43.16%

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, @gutiory!

Comment on lines 2296 to 2297
RedundantAPI + "Prefer zipOrAccumulate",
ReplaceWith("Either.zipOrAccumulate({ a, bb -> SGA.run { a.combine(bb) } }, this, b) { a, bb -> SGB.run { a.combine(bb) } }")
ReplaceWith("Either.zipOrAccumulate<A, B, B, B>({ a:A, bb:A -> a.plus(bb) }, this, b) { a:B, bb:B -> a.plus(bb) }")
Copy link
Member

@nomisRev nomisRev Mar 10, 2023

Choose a reason for hiding this comment

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

question: Was the SGA.run { a.combine(bb) } here broken? If yes, then I think this is an improvement but we should probably just use a + b instead of a.plus(b) or is that also broken? 😅

Perhaps we should also add in the description that for custom types, plus needs to be replaced with a custom combine function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

+ works fine! Thanks @nomisRev . See 6332005 (#2973)

Copy link
Member

@nomisRev nomisRev left a comment

Choose a reason for hiding this comment

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

Really awesome @gutiory. Thank you so much 😘 One question/remark.

@gutiory gutiory merged commit 5f7921c into main Mar 10, 2023
@nomisRev nomisRev deleted the jg-fix-either-deprecations branch March 10, 2023 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants