scalakind-projector

Why does Functor[A => ?] not compile in Scala 2.11.7?


I am following Michael Pilquist's excellent intro to Functors and my Scala 2.11.7 repl fails to compile(interpret?) the following line.

implicit def function1Functor[X]: Functor[X => ?] = new Functor[X => ?] {
    def map[A, B](fa: X => A)(f: A => B): X => B = fa andThen f
}

Is [X => ?] legal Scala?

I see that he is importing his own simulacrum project at the top of the file but I couldn't determine if it's related.


Solution

  • You'll need the kind projector compiler plugin. https://github.com/non/kind-projector