Skip to content

Using shapeless: older releases

Miles Sabin edited this page May 26, 2015 · 4 revisions

Unless absolutely necessary, please use a current release current release of shapeless.

Binary artefacts of older shapeless released available on Maven Central.

Please be aware that SBT 0.13.6 has an [issue][namehashing] related to its new name hashing feature which when compiling with shapeless might cause SBT to loop indefinitely consuming all heap. Workarounds are to move to an earlier (0.13.5) or later (0.13.7) SBT version or disable name hashing by adding,

incOptions := incOptions.value.withNameHashing(false)

to your settings.

shapeless-2.1.0

Builds are available for Scala 2.11.x and for Scala 2.10.4 and 2.10.5. The main line of development for shapeless 2.1.0 is Scala 2.11.6 with Scala 2.10.x supported via the macro paradise compiler plugin.

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
  "com.chuusai" %% "shapeless" % "2.1.0"
)

Note that for Scala 2.10.x you must provide an explicit Scala version suffix to your shapeless dependency, and it is recommended to add the macro paradise plugin to your build, for some macros provided by shapeless to work smoothly,

scalaVersion := "2.10.5"

libraryDependencies ++= Seq(
  "com.chuusai" % "shapeless_2.10.5" % "2.1.0",
  compilerPlugin("org.scalamacros" % "paradise_2.10.5" % "2.0.1")
)

shapeless-2.0.0

Builds are available for Scala 2.11.x and for Scala 2.10.4.

// For Scala 2.11.x
scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
  "com.chuusai" %% "shapeless" % "2.0.0"
)

For Scala 2.10.x you must specify a Scala version of at least 2.10.2, and add either cross CrossVersion.full or provide an explicit Scala version suffix to your shapeless dependency,

// For Scala 2.10.x >= 2.10.2
scalaVersion := "2.10.4"

libraryDependencies ++= Seq(
  "com.chuusai" % "shapeless_2.10.4" % "2.0.0"
  // "com.chuusai" % "shapeless" % "2.0.0" cross CrossVersion.full  // Alternatively ...
)

Note that Scala 2.10.x releases are compatible with each other starting from 2.10.2, so a mismatch in minor versions above would be fine.

If your project is built with Scala 2.10.4 and Scala 2.11.0 and later, then you will need to add the following,

val shapeless = Def setting (
    CrossVersion partialVersion scalaVersion.value match {
    case Some((2, scalaMajor)) if scalaMajor >= 11 => 
      "com.chuusai" %% "shapeless" % "2.0.0"
    case Some((2, 10)) => 
      "com.chuusai" %  "shapeless" % "2.0.0" cross CrossVersion.full
  }
)

libraryDependencies ++= Seq(
  shapeless.value
)

This is needed because the shapeless binaries for Scala 2.10 includes the Scala bug fix digit. There specific binaries for 2.10.4 and 2.10.5, while in the Scala 2.11 series the bug fix digit is omitted.

"com.chuusai" %  "shapeless_2.10.4" % "2.0.0"

"com.chuusai" %  "shapeless_2.10.5" % "2.0.0"

"com.chuusai" %  "shapeless_2.11" % "2.0.0"

shapeless-1.2.4

Builds are available for Scala 2.9, 2.10 and 2.11. If you are working with Scala 2.10.2 or later you should use shapeless-2.1.0 instead.

If your project is built with Scala 2.9.3 or earlier, then you will need to specify the -Ydependent-method-types compiler flag,

scalaVersion := "2.9.3"

scalacOptions += "-Ydependent-method-types"

libraryDependencies ++= Seq(
  "com.chuusai" %% "shapeless" % "1.2.4"
)

This option isn't necessary or supported in Scala 2.10 and later, so you should omit it if you are building with Scala 2.10.2 or later,

scalaVersion := "2.10.4"

libraryDependencies ++= Seq(
  "com.chuusai" %% "shapeless" % "1.2.4"
)

If you want to be able to support building relative to both 2.9.3 and 2.10 and later then you should use the 2.10.4 configuration above and add the following,

scalacOptions <++= scalaVersion map { version =>
  val Some((major, minor)) = CrossVersion.partialVersion(version)
  if (major < 2 || (major == 2 && minor < 10)) 
    Seq("-Ydependent-method-types")
  else Nil
}

which will set the -Ydependent-method-types compiler flag conditionally on the actual Scala version in use.