我创建了一个简单的trait
使用cats-tagless
lib:
@finalAlg
@autoFunctorK(true)
trait MyService[F[_]] {
def put(element: Element): F[Element]
def get(elementId: Id): F[Element]
def all(): F[List[Element]]
def delete(elementId: Id): F[Unit]
}
但是当我试图编译它时,我得到了一个错误:
Error:(8, 7) macro annotation could not be expanded (the most common reason for that is that you need to enable the macro paradise plugin; another possibility is that you try to use macro annotation in the same compilation run that defines it)
我也添加addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)
到plugins.sbt
文件中,build.sbt
但它没有帮助。你能帮我解决吗?
我的build.sbt
文件看起来像:
addCompilerPlugin(("org.scalameta" % "paradise" % "3.0.0-M11").cross(CrossVersion.full))
lazy val commonSettings = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % CatsVersion,
"org.typelevel" %% "cats-effect" % "1.2.0",
"org.typelevel" %% "cats-tagless-macros" % "0.5",
"org.typelevel" %% "cats-tagless-legacy-macros" % "0.5",
"org.typelevel" %% "cats-mtl-core" % "0.5.0",
)
)