Firstly, just a reminder that one should add
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.6")
to build.sbt
and not for example to plugins.sbt
.
Then, for example, for
import scala.language.higherKinds
trait MyTrait[F[_]]
declaration with type lambda
class MyClass extends MyTrait[({ type l[A] = Map[String, A] })#l]
can be replaced with
class MyClass extends MyTrait[Map[String, ?]]
or
class MyClass extends MyTrait[λ[A => Map[String, A]]]
or
class MyClass extends MyTrait[Lambda[A => Map[String, A]]]
I'm not sure if
val f: Id ~> Future = λ[Id ~> Future](???)
is a valid syntax.
~>
is usually used for natural transformations like in
import cats.{Id, ~>}
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
val f: Id ~> Future = new (Id ~> Future) {
override def apply[A](fa: A): Future[A] = Future(fa)
}
and not for type lambdas.
Update. Ok, it's polymorphic lambda https://github.com/typelevel/kind-projector#polymorphic-lambda-values