简体   繁体   中英

How do I translate this type lambda into Kind-Projector syntax?

Given type parameters of F[_] and A[_] how do I turn the following type lambda into the more pleasant Kind-Projector syntax?

({type λ[α] = F[A[α]]})#λ

I would have imagined it would be something like F[A[?_]] , but the compiler complains about wanting type parameters in this case.

Using the Lambda (or λ ) syntax worked:

λ[α => F[A[α]]]

Found here under Function Syntax .

You should use Inline Syntax where possible but in this case you have to use Function Syntax with nested parametrized types.

Also, Intellij IDEA 15 has an inspection to convert type lambdas to kind projector syntax if kind projector is enabled for the project. So this is what the inspection converted your type lambda to: Lambda[α => F[A[α]]]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM