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

Avoid kind-projector syntax with variance annotations #3207

Merged

Conversation

travisbrown
Copy link
Contributor

Dotty currently reserves * for use as a type lambda placeholder for compatibility with kind-projector's syntax on Scala 2, via a currently-unimplemented -Ykind-projector compiler option. It's not clear whether -Ykind-projector should or will support kind-projector's λ[`-α` => Whatever[α]] syntax, or even -*. (I'm working on implementing -Ykind-projector at the moment, and personally I don't see compatibility with the goofier corners of kind-projector's syntax as a priority.)

Cats only uses kind-projector's variance annotations in this one file, and they're pretty easy to replace, and in my view the vanilla Scala syntax is clearer, anyway.

/cc @smarter

@travisbrown
Copy link
Contributor Author

Also /cc @djspiewak.

@codecov-io
Copy link

codecov-io commented Dec 13, 2019

Codecov Report

Merging #3207 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3207   +/-   ##
=======================================
  Coverage   93.05%   93.05%           
=======================================
  Files         376      376           
  Lines        7412     7412           
  Branches      192      192           
=======================================
  Hits         6897     6897           
  Misses        515      515
Flag Coverage Δ
#scala_version_212 93.35% <100%> (-0.03%) ⬇️
#scala_version_213 92.82% <100%> (ø) ⬆️
Impacted Files Coverage Δ
core/src/main/scala/cats/evidence/As.scala 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67037ce...7653812. Read the comment docs.

Copy link
Member

@joroKr21 joroKr21 left a comment

Choose a reason for hiding this comment

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

The reason why kind projector exists is for the cases where you can't use a type alias (in type signatures).

It's funny how once we have it we forget that in all other cases you can just use a type alias.

👍 looks clearer now.

Copy link
Contributor

@kailuowang kailuowang left a comment

Choose a reason for hiding this comment

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

seems an improvement to me.

Copy link
Member

@djspiewak djspiewak 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 definitely one of the corners of kind-projector that I don't care for at all. Also it has some weird caveats to it such that, in general, when you need variance or bounds or things, you usually end up being explicit with a type alias anyway. So I'm in favor of this change unambiguously.

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.

6 participants