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

Optimize Alternative (part 3): add prependK/appendK specializations for Cats NE wrappers #4055

Merged

Conversation

satorg
Copy link
Contributor

@satorg satorg commented Nov 28, 2021

@@ -586,10 +586,17 @@ class NonEmptyChainOps[A](private val value: NonEmptyChain[A])

sealed abstract private[data] class NonEmptyChainInstances extends NonEmptyChainInstances1 {

implicit val catsDataInstancesForNonEmptyChain: SemigroupK[NonEmptyChain]
// Required for binary compatibility with v2.6.1.
def catsDataInstancesForNonEmptyChain: SemigroupK[NonEmptyChain]
Copy link
Member

@armanbilge armanbilge Nov 30, 2021

Choose a reason for hiding this comment

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

Should we either deprecate these or make them private[data]?

Copy link
Contributor Author

@satorg satorg Dec 1, 2021

Choose a reason for hiding this comment

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

I was pretty sure that I tried to make it package private in the original PR and it didn't work – it broke binary compatibility for some Scala version (or at least Mima though it does). But I've just given it another try and don't see any errors from Mima neither for Scala 2.12 nor for Scala 2.13. I got confused a little bit :)

On the second thought, I would assume that deprecating it might be slightly better because making it package private potentially (although unlikely) breaks source compatibility – in case if someone references this field explicitly in their code. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, @djspiewak just mentioned in another issue:

We generally don't consider implicits to be part of source compatibility, so IMO this is something we can (and should) do in 2.7.1

Good to know, thanks. I guess I can safely make it package private then (since it seemingly doesn't break BC).

Copy link
Contributor Author

@satorg satorg Dec 2, 2021

Choose a reason for hiding this comment

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

Turns out, private[data] works for catsDataInstancesForNonEmptyChain only. For three other similar obsolete former implicits in this PR it breaks the binary compatibility. So I annotated them as deprecated without changes in their visibility.

Copy link
Member

Choose a reason for hiding this comment

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

Were the mima problems only for static methods? I don't know what the policy about static methods is for cats, since those are only used by Java.

@satorg satorg force-pushed the ne-alternative-specializations-cats-colls branch from d14532f to c97d140 Compare December 2, 2021 04:34
@armanbilge
Copy link
Member

Looking pretty good, but we should wait until MiMa is fixed in #4063.

@satorg satorg force-pushed the ne-alternative-specializations-cats-colls branch from c97d140 to 5d72851 Compare April 2, 2022 00:20
@satorg
Copy link
Contributor Author

satorg commented Apr 2, 2022

Hi @armanbilge , just to confirm with you: is this PR still blocked by #4063 ?

@armanbilge
Copy link
Member

Ah, this one has been sitting for a while, sorry!

IIRC this PR made some changes to type signatures that looked like they could cause the same bincompat issues that we had with the Id instances for Scala 3. I could be wrong though. So, I think better to play it safe.

I would now say this PR is blocked by #4143 which will enable MiMa for Scala 3 and supersede #4063. I hope to work on that this weekend.

@armanbilge armanbilge added this to the 2.8.0 milestone May 16, 2022
@armanbilge
Copy link
Member

@satorg I believe I owe you a review here, also do you mind fixing up the conflicts 😅

@satorg
Copy link
Contributor Author

satorg commented May 17, 2022

Yeah, I'm keeping eye on it.. I will be happy to resume working on this.. Just a lil'bit busy on my work project now – it is approaching a deadline so quite difficult to put aside time for anything else.

@armanbilge armanbilge removed this from the 2.8.0 milestone Jun 9, 2022
@armanbilge armanbilge modified the milestone: 2.9.0 Jun 21, 2022
@satorg satorg force-pushed the ne-alternative-specializations-cats-colls branch from 5d72851 to ade8ce3 Compare September 12, 2022 00:33
@satorg satorg requested review from LukaJCB and removed request for LukaJCB September 12, 2022 01:57
@satorg
Copy link
Contributor Author

satorg commented Sep 12, 2022

@armanbilge here it is, finally :)

@armanbilge
Copy link
Member

That's great, thanks for all your work on this! I'm currently buried working on typelevel/cats-effect#3138 (comment) but I promise we will get this into 2.9.0.

johnynek
johnynek previously approved these changes Sep 12, 2022
@armanbilge armanbilge changed the title Optimize Alternative (part 3): add prependK/appendK specializations for Cats NE wrappers Optimize Alternative (part 3): add prependK/appendK specializations for Cats NE wrappers Sep 13, 2022
Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

This is quite straightforward actually :) LGTM.

The only issue was the version in deprecations should be 2.9.0.

core/src/main/scala/cats/data/NonEmptyChain.scala Outdated Show resolved Hide resolved
core/src/main/scala/cats/data/NonEmptyList.scala Outdated Show resolved Hide resolved
core/src/main/scala/cats/data/NonEmptySeq.scala Outdated Show resolved Hide resolved
core/src/main/scala/cats/data/NonEmptyVector.scala Outdated Show resolved Hide resolved
@satorg
Copy link
Contributor Author

satorg commented Sep 15, 2022

Bumped up deprecation versions to "2.9.0".

Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

Thanks. Hooray 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants