shapeless: generic programming for Scala
shapeless is a type class and dependent type based generic programming library for Scala. It had its origins in several talks by Miles Sabin (@milessabin), given over the course of 2011, on implementing scrap your boilerplate and higher rank polymorphism in Scala. Since then it has evolved from being a resolutely experimental project into library which, while still testing the limits of what's possible in Scala, is being used widely in production systems wherever there are arities to be abstracted over and boilerplate to be scrapped.
Projects which use shapeless
There is a wide variety of projects which use shapeless in one way or another ... see the incomplete list of projects for ideas and inspiration. If you are using shapeless and your project isn't listed yet, please add it.
Finding out more about the project
A full feature overview of shapeless-2.2.0+ is in preparation. In the meantime, please refer to the release notes and the feature overview for shapeless-2.0.0 which can be found here. If you are upgrading from shapeless-2.0.0 you will find the migration guide useful.
shapeless is part of the Typelevel family of projects. It is an Open Source project under the Apache License v2, hosted on github. Binary artefacts are published to the Sonatype OSS Repository Hosting service and synced to Maven Central.
Most discussion of shapeless and generic programming in Scala happens on the shapeless Gitter channel. There is also a mailing list and IRC channel, but these are largely dormant now that most activity has moved to Gitter. Questions about shapeless are often asked and answered under the shapeless tag on StackOverflow. Some articles on the implementation techniques can be found on Miles's blog, and Olivera, Moors and Odersky, Type Classes as Object and Implicits is useful background material.
Whilst shapeless is a somewhat "advanced" Scala library, it is a lot more approachable than many people think. Contributors are usually available to field questions, give advice and discuss ideas on the Gitter channel, and for people wanting to take their first steps at contributing we have a selection of open issues flagged up as being good candidates to take on. No contribution is too small, and guidance is always available.
Binary release artefacts are published to the Sonatype OSS Repository Hosting service and synced to Maven Central. Snapshots of the master and scala-2.10.x branches are built using Travis CI and automatically published to the Sonatype OSS Snapshot repository. To include the Sonatype repositories in your SBT build you should add,
resolvers ++= Seq( Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("snapshots") )
Please be aware that SBT 0.13.6 has an issue 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, 0.13.8) SBT version or disable name hashing by adding,
incOptions := incOptions.value.withNameHashing(false)
to your settings.
Builds are available for Scala 2.11.x and for Scala 2.10.x. The main line of development for shapeless 2.2.5 is Scala 2.11.7 with Scala 2.10.x supported via the macro paradise compiler plugin.
scalaVersion := "2.11.7" libraryDependencies ++= Seq( "com.chuusai" %% "shapeless" % "2.2.5" )
If you are using Scala 2.10.x, note that unlike earlier versions, it is no longer necessary to provide an explicit Scala version suffix for your shapeless dependency. You must however ensure that you are using Scala version 2.10.2 or greater, with Scala 2.10.6 (or switching to 2.11.x) strongly recommended. You should also add the macro paradise plugin to your build,
scalaVersion := "2.10.6" libraryDependencies ++= Seq( "com.chuusai" %% "shapeless" % "2.2.5", compilerPlugin("org.scalamacros" % "paradise" % "2.0.1" cross CrossVersion.full) )
The shapeless-2.2.1 release accidentally broke binary compatability with shapeless-2.2.0 and has been deprecated. Please use shapeless-2.2.5 instead.
Please use a current release if possible. If unavoidable, you can find usage information for older releases on the shapeless wiki.
shapeless is built with SBT 0.13.8 or later, and its master branch is built with Scala 2.11.7 by default. To build with Scala 2.10.x you should check out the scala-2.10.x branch. As a general rule all new features and bugfixes are made against master and Scala 2.11.7 and merged into the scala-2.10.x branch with only the minimal changes needed for forwards compatibility.
- Alessandro Lacava firstname.lastname@example.org @lambdista
- Alexander Konovalov email@example.com @alexknvl
- Alexandre Archambault firstname.lastname@example.org @alxarchambault
- Alistair Johnson email@example.com
- Alois Cochard firstname.lastname@example.org @aloiscochard
- Andreas Koestler email@example.com @AndreasKostler
- Andrew Brett firstname.lastname@example.org @Ephemerix
- Ben Hutchison email@example.com @ben_hutchison
- Ben James firstname.lastname@example.org @bmjames
- Brian McKenna email@example.com @puffnfresh
- Bryn Keller firstname.lastname@example.org @brynkeller
- Chris Hodapp email@example.com @clhodapp
- Cody Allen firstname.lastname@example.org @fourierstrick
- Dale Wijnand email@example.com @dwijnand
- Dario Rexin firstname.lastname@example.org @evonox
- David Barri email@example.com @japgolly
- Denis Mikhaylov firstname.lastname@example.org @notxcain
- Eugene Burmako email@example.com @xeno_by
- Filipe Nepomuceno firstname.lastname@example.org
- Frank S. Thomas email@example.com @fst9000
- George Leontiev firstname.lastname@example.org @folone
- Howard Branch email@example.com @purestgreen
- Huw Giddens firstname.lastname@example.org
- Jason Zaugg email@example.com @retronym
- Jean-Remi Desjardins firstname.lastname@example.org @jrdesjardins
- Johannes Rudolph email@example.com @virtualvoid
- Johnny Everson firstname.lastname@example.org @johnny_everson
- Joni Freeman email@example.com @jonifreeman
- Julien Tournay firstname.lastname@example.org @skaalf
- Jules Gosnell email@example.com
- Kevin Wright firstname.lastname@example.org @thecoda
- Lars Hupel email@example.com @larsr_h
- Mario Pastorelli firstname.lastname@example.org @mapastr
- Mathias Doenitz email@example.com @sirthias
- Michael Donaghy firstname.lastname@example.org
- Michael Pilquist email@example.com @mpilquist
- Miles Sabin firstname.lastname@example.org @milessabin
- Nikolas Evangelopoulos email@example.com
- Oleg Aleshko firstname.lastname@example.org @OlegYch
- Owein Reese email@example.com @OweinReese
- Paolo G. Giarrusso firstname.lastname@example.org @blaisorblade
- Pascal Voitot email@example.com @mandubian
- Peter Schmitz firstname.lastname@example.org @peterschmitz_
- Renato Cavalcanti email@example.com @renatocaval
- Sam Halliday firstname.lastname@example.org @fommil
- Sarah Gerweck email@example.com @SGerweck
- Sébastien Doeraene firstname.lastname@example.org @sjrdoeraene
- Simon Hafner email@example.com @reactormonk
- Stacy Curl firstname.lastname@example.org @stacycurl
- Stephen Compall email@example.com @S11001001
- Tom Switzer firstname.lastname@example.org @tixxit
- Travis Brown email@example.com @travisbrown
- Vladimir Matveev firstname.lastname@example.org @netvlm