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 infix, tuple, and function syntax when using kind-projector #3209

Conversation

travisbrown
Copy link
Contributor

This is more a question than a proposal, I guess. I'm working on -Ykind-projector for Dotty, and I have a WIP implementation that I've confirmed can compile cats-core after #3207, #3193, and the change here (and one big Simulacrum rewrite).

I think it makes sense to try to minimize the scope of Dotty's kind-projector compatibility, and right now my implementation only handles the type-level λ[x => ...] syntax and * in ordinary type application (F[A, *, B, *, C]). This is a really tiny change—around 50 lines in the parser behind a single if (ctx.settings.YkindProjector.value). Adding support for * in tuple types, function types, and infix types would be a lot more invasive.

Maybe we should do it anyway, but for Cats at least only supporting * in type application isn't a very painful limitation—it only requires the changes here, and I think some of these changes (like A Ior * to Ior[A, *]) are readability improvements, anyway.

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.

FWIW, I use function and tuple types with kind-projector all the time. Infix syntax, less so, though obviously it's the same code path. As a general stylistic rule, I think of Function1 and Tuple2 (and family) as being implementation details, and the eternally preferred way of referencing them should be their symbolic form.

@travisbrown
Copy link
Contributor Author

@djspiewak Okay, thanks! I think "yes, we need * in function types and tuples" is a reasonable response, and I'm happy to implement it and advocate for it if people want it (I just don't really care, myself).

@codecov-io
Copy link

codecov-io commented Dec 13, 2019

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3209   +/-   ##
=======================================
  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.38% <100%> (ø) ⬆️
#scala_version_213 92.81% <100%> (-0.02%) ⬇️
Impacted Files Coverage Δ
core/src/main/scala/cats/data/package.scala 88.88% <100%> (ø) ⬆️
core/src/main/scala/cats/data/Ior.scala 98.52% <100%> (ø) ⬆️
core/src/main/scala/cats/instances/tuple.scala 100% <100%> (ø) ⬆️
core/src/main/scala/cats/instances/function.scala 100% <100%> (ø) ⬆️
core/src/main/scala/cats/evidence/Is.scala 91.66% <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 b2711fb...95b0725. Read the comment docs.

@travisbrown
Copy link
Contributor Author

See #3215 for a subset of these changes that I think are reasonable.

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.

3 participants