Let's suppose I have a trait with two type parameters, e.g.
trait Qux[A, B]
and another trait with a higher-kinded type parameter, e.g.
trait Turkle[C[_]]
I'd like to be able to substitute a fixed value for one of the type parameters for Qux
, so that it can be used to parametrize Turkle
.
Here's an example (of code that doesn't make sense in Scala!):
trait Baz[A] extends Turkle[Qux[A, _]]
Anyone have any ideas how to achieve this effect?
The compiler plugin kind projector allows this as well:
Jason Zaugg came up with the most succinct way to do this:
IntelliJ's Scala plugin will optionally collapse this to:
You mean something like this?
This is the analog to partial application for types.