Kind compiler plugin λ not found

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 01:39:15

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

I've just solved this exact problem (and not for the first time, it feels) by doing a quick rm -rf ./target and restarting everything.

I also deleted my ensime project cache, just to make sure - presumably doing the same for IntelliJ would be a good idea too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!