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

Use alignWith in alignMergeWith #4676

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

joroKr21
Copy link
Member

alignWith is usually overridden for efficiency

`alignWith` is usually overridden for efficiency
johnynek
johnynek previously approved these changes Nov 14, 2024
@satorg
Copy link
Contributor

satorg commented Nov 14, 2024

Thank you!
Would you consider adding a new law into cats.laws.AlignLaws along with a corresponding rule in AlingTests please?
Something similar to

def alignWithConsistent[A, B, C](fa: F[A], fb: F[B], f: A Ior B => C): IsEq[F[C]] =
fa.alignWith(fb)(f) <-> fa.align(fb).map(f)

satorg
satorg previously approved these changes Nov 14, 2024
@joroKr21
Copy link
Member Author

@satorg that law already exists. Am I missing something?

@satorg
Copy link
Contributor

satorg commented Nov 15, 2024

I mean, a law that would check a correspondence between alignMergeWith and alignWith.
The existing law checks alignWith <-> align.

@joroKr21 joroKr21 dismissed stale reviews from satorg and johnynek via 943c83b November 15, 2024 08:57
@joroKr21
Copy link
Member Author

Done, but it seems like now unrelated tests are failing

Comment on lines +25 to +26
import cats.syntax.align.*
import cats.syntax.functor.*
Copy link
Member

Choose a reason for hiding this comment

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

Just a nit but maybe these changes to the import style are unnecessary. Although it's Scalafmt duty, we use scala213source3 dialect that allows cross-version syntax constructions to be put together.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess Scalafmt is not configured to update the imports

Copy link
Member

@danicheg danicheg Nov 15, 2024

Choose a reason for hiding this comment

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

Hmm, we have this
runner.dialectOverride.allowStarWildcardImport = false
and it appears to be not working (or maybe it works oppositely to my expectations)

Copy link
Contributor

@satorg satorg left a comment

Choose a reason for hiding this comment

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

Thank you!

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