shapeless 2.2.0 released!

shapeless-2.2.0 is out at last!

For the first time it’s available for Scala 2.11.x and 2.10.x for both the JVM and for Scala.js, and with full support for systems like Spark which use Java serialization. Many thanks to Alistair Johnson, Ben Hutchison, David Barri, Sébastien Doeraene and Adelbert Chang for their assistance with this.

This was originally intended to be a fairly minor, hence rapid, release following on from shapeless-2.1.0, primarily showcasing support for derivation of type classes for higher-kinded types (see, eg., the example derivation of Functor instances here). However, one thing led to another, and various additions found their way onto the agenda: porting shapeless-contrib to shapeless-2.2.0 turned out to require some changes to the way that derived orphan type class instances were handled (I’ll post an article about this in the near future) and the increasing interest in Scala.js and Spark made first class support for those two projects a great deal more urgent.

My “one branch per platform” policy seems to be paying off: managing the differences between Scala 2.11.x and Scala 2.10.x for each of the JVM and Scala.js by branching and merging (as opposed to managing platform variations within a single branch) is working out very smoothly. It means that releases have to be made from four branches simultaneously, a chore which Johnny Everson has automated with a multi-branch release script … it’s been a real time saver.

Many thanks to everyone who contributed … release notes follow …


This is the final release of shapeless-2.2.0. These release notes provide a summary of changes since shapeless 2.1.0. shapeless 2.2.0 should be source and binary compatible with shapeless 2.1.0, and for migration from shapeless 2.0.0 the earlier migration guide from shapeless 2.0.0 to 2.1.0 is still applicable and is available on the shapeless wiki.

Contributors for shapeless 2.2.0 are,

Many thanks to all of you and everyone else who has contributed ideas, enthusiasm and encouragement.

There are a large number of new features, refactorings and bug fixes in shapeless 2.2.0. The most significant of these are,

  • Scala.js is now officially supported. Many thanks to Alistair Johnson, Ben Hutchison, David Barri and Sébastien Doeraene for their assistance with this.

  • Support for Spark (and other libraries and systems which use Java serialization) has been improved by having all the major types and type classes extend Serializable.

  • Added support for derivation of type classes for higher-kinded types. See in particular the new example illustrating the application of this to the automatic derivation of Functor type class instances for ADTs.

  • Generic derivation for coproducts now correctly handles cases where the type parameters of constructors is a subset and/or permutation of the type parameters of the data type. This allows correct type class derivation for types like Cat’s Xor and Ior, and Scalaz’s disjunction.

  • Added support for Generic representation of types with repeated (ie. vararg) constructor arguments.

  • There are now Generic instances for ADTs with constructors which are included via multiple inheritance paths.

  • The test for “case-class-likeness” has been tightened to exclude some unexpected types (notably arrays).

  • A mechanism providing greater control over the implicit priority of derived orphan type class instances has been added. This finally allows shapeless-contrib to be updated to use shapeless-2.2.0.

  • A mechanism allowing expensive implicit definitions to be cached simply has been added.

  • Witness instances are now available for the singleton types of stable values.

  • A mechanism to replace Scala’s now deprecated auto-tupling has been added via the ProductArgs and SingletonProductArgs traits. This supports some new examples illustrating a generic solution to the common problem of functional update of a family of case classes through their common supertype.

  • A Max type class has been added for Nat types.

  • A fields method has been added to records and unions.

  • Added a useful toString to instances of the Typeable type class.

  • Added a useful toString to Sized containers.

  • Improved the CSV serialization example.

  • Added an example of merging instances of one case class into another.

  • With the addition of Scala.js support there are now four branches to release from simultaneously. Many thanks to Johnny Everson for his contribution of a script to automate this process.

  • A number of tests have been made more portable so that they don’t fail when run under Scala.js due to spurious platform-specifics.

  • If you are using Scala 2.10.x it is no longer necessary to provide an explicit Scala version suffix for your shapeless dependency. You must still ensure that you are using Scala version 2.10.2 or greater, with Scala 2.10.5 (or switching to 2.11.x) strongly recommended.

  • Reorganized the SBT project modules. The “shapeless-“ prefix has been dropped from all the module names and it is now possible to drop into the Scala REPL with shapeless on the classpath using just the “console” command.

shapeless is an exploration of type class and dependent type based generic programming in Scala.

Find the project online,

Some articles on the techniques used have appeared here

shapeless is an Open Source project under the Apache License v2.