Skip to content

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

Merged
satorg merged 1 commit into
typelevel:mainfrom
satorg:ne-alternative-specializations-cats-colls
Sep 15, 2022
Merged

Optimize Alternative (part 3): add prependK/appendK specializations for Cats NE wrappers#4055
satorg merged 1 commit into
typelevel:mainfrom
satorg:ne-alternative-specializations-cats-colls

Conversation

@satorg

@satorg satorg commented Nov 28, 2021

Copy link
Copy Markdown
Contributor


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

@armanbilge armanbilge Nov 30, 2021

Copy link
Copy Markdown
Member

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]?

@satorg satorg Dec 1, 2021

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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).

@satorg satorg Dec 2, 2021

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
@satorg
satorg requested a review from armanbilge December 2, 2021 07:36
@armanbilge

Copy link
Copy Markdown
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

satorg commented Apr 2, 2022

Copy link
Copy Markdown
Contributor Author

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

@armanbilge

Copy link
Copy Markdown
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
Copy Markdown
Member

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

@satorg

satorg commented May 17, 2022

Copy link
Copy Markdown
Contributor Author

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

satorg commented Sep 12, 2022

Copy link
Copy Markdown
Contributor Author

@armanbilge here it is, finally :)

@armanbilge

Copy link
Copy Markdown
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

@armanbilge armanbilge left a comment

Copy link
Copy Markdown
Member

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.

Comment thread core/src/main/scala/cats/data/NonEmptyChain.scala Outdated
Comment thread core/src/main/scala/cats/data/NonEmptyList.scala Outdated
Comment thread core/src/main/scala/cats/data/NonEmptySeq.scala Outdated
Comment thread core/src/main/scala/cats/data/NonEmptyVector.scala Outdated
@satorg
satorg force-pushed the ne-alternative-specializations-cats-colls branch from ade8ce3 to 475eff7 Compare September 15, 2022 06:20
@satorg
satorg requested a review from armanbilge September 15, 2022 07:12
@satorg

satorg commented Sep 15, 2022

Copy link
Copy Markdown
Contributor Author

Bumped up deprecation versions to "2.9.0".

@armanbilge armanbilge left a comment

Copy link
Copy Markdown
Member

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