typelevel/kind-projector

Not sure the installation instructions work for 2.13, or maybe I need clarity.

Closed this issue · 2 comments

I tried the installation instructions on the README.md. Some observations and correct me if I am wrong. These instructions have a few conditionals and aren't meant for the user to just copy and paste entirely. Perhaps to avoid some confusion, breaking out into separate clauses would read a little easier?

addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.11.0" cross CrossVersion.full)

// if your project uses multiple Scala versions, use this for cross building
addCompilerPlugin("org.typelevel" % "kind-projector" % "0.11.0" cross CrossVersion.full)

// if your project uses both 2.10 and polymorphic lambdas
libraryDependencies ++= (scalaBinaryVersion.value match {
  case "2.10" =>
    compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full) :: Nil
  case _ =>
    Nil
})

In my configuration, which is just a small application, this is what I ended up using the following. Note that I am not using addCompilerPlugin at all, I am just feed that directly to the dependency. Is this right or wrong?

name := "cats-study"

version := "1.0-SNAPSHOT"

scalaVersion := "2.13.3"

scalacOptions ++= Seq(
  "-Xfatal-warnings",
  "-feature",
  "-deprecation"
)

val kindProjectorVersion = "0.11.0"

fork := true
//autoCompilerPlugins := true

libraryDependencies := Seq(
  "org.scalatest" %% "scalatest" % "3.0.8" % "test",
  "org.scalameta" %% "munit" % "0.7.10" % Test,
  compilerPlugin(("org.typelevel" %% "kind-projector" % kindProjectorVersion).cross(CrossVersion.full)),
  ("org.typelevel" %% "cats-core" % "2.0.0").withSources().withJavadoc(),
  ("org.typelevel" %% "cats-effect" % "2.0.0").withSources().withJavadoc(),
  ("org.typelevel" %% "cats-free" % "2.0.0").withSources().withJavadoc()
)

// Use %%% for non-JVM projects.
testFrameworks += new TestFramework("munit.Framework")

addCompilerPlugin is just sugar for libraryDependencies += compilerPlugin(...)

from the sbt source code:

  /** Adds `dependency` to `libraryDependencies` in the auto-compiler plugin configuration. */
  def addCompilerPlugin(dependency: ModuleID): Setting[Seq[ModuleID]] =
    libraryDependencies += compilerPlugin(dependency)

closing for lack of activity