Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Implement kind projector's functionality directly #7139
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]]
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
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.