-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implement kind projector's functionality directly #7139
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
Comments
Note that this should be guarded by the (already existing) Lambda[A => (A, A)]
λ[A => (A, A)]
λ[(+[A], +[B]) => Either[A, B]]
λ[(`+A`, `+B`) => Either[A, B]] See https://github.com/typelevel/kind-projector |
For what it's worth we could very easily live without kind-projector's variance syntax in Cats (see this PR for the change), and in all of the other Typelevel or Typelevel-adjacent projects I just checked. I currently have a |
- Support * placeholder (including in tuple and function types) - Support λ alternative to =>> syntax - Add tests
This change adds support for a subset of kind-projector's syntax behind the existing -Ykind-projector flag. It supports the following kind-projector features: - * placeholder (Functor[F[L, *]] instead of Functor[[x] => F[L, x]]). - * in tuple types (Functor[(A, *)] instead of Functor[[x] => (A, x)]). - * in function types (both Functor[S => *] and Functor[* => T] work). - λ syntax (λ[x => Functor[(x, x)]] for Functor[[x] => (x, x)]). There are a few things kind-projector provides that the flag doesn't: - ? as a placeholder (since it collides with wildcards). - * as a placeholder in infix types. - Lambda as an alternative for λ. - λ arguments of a kind other than * (no λ[f[_] => Functor[f]]). - Variance annotations on either * or λ arguments. - Polymorphic lambda values (λ[Vector ~> List](_.toList)). The changes have no effect on parsing if -Ykind-projector isn't enabled.
Fix #7139: Implement kind-projector compatibility
We already accept both
_
and?
as a wildcard. Following kind projector, we should now accept*
as a parameter placeholder for a type lambda.The text was updated successfully, but these errors were encountered: