Keep in touch and up-to-date with the latest shapeless news here:
https://gitter.im/milessabin/shapeless
The shapeless codebase is on Miles' Github:
https://github.com/milessabin/shapeless
The demo codebase we used in the workshop is here:
https://github.com/milessabin/shapeless-type-class-derivation-2015-demo
The slides Miles used at the beginning are here:
https://github.com/milessabin/shapeless-type-class-derivation-2015
The font used in the code in the slides is available here ;)
http://dejavu-fonts.org/wiki/Main_Page
Finally, here are some notes I made at Miles' previous shapeless workshop at Scala Exchange 2014.
That workshop focused more on the inner workings of the code and introduced some of the
non-type-class-related utilities like Nats
and Polys
:
https://github.com/davegurnell/shapeless-workshop-scalax-2014/blob/master/README.md
Here's Team Arbitrary's code from the workshop:
https://github.com/bsadeh/shapeless-type-class-derivation-2015-demo
Here's a link to Alexandre Archambault's Scalacheck Shapeless library that does similar things for Scalacheck, including generating Arbitrary
instances to generate values and Shrink
instances to reduce failing tests to simple inputs. This makes similar use of the Length
typeclass to produce unbiased distributions across Coproducts
:
https://github.com/alexarchambault/scalacheck-shapeless
Here's Team Reader/Writer's code from the workshop:
https://gist.github.com/rcavalcanti/60e492abfcff2e2e7860
Here are some good examples of readers and writers written using shapeless. Alexandre's Shapeless Argonaut codebase, in particular, is short, focused, and very readable. Note the use of LabelledGeneric
in situations where the library needs access to the type and field names in Coproducts
and HLists
:
- Argonaut - https://github.com/alexarchambault/argonaut-shapeless
- Spray JSON - https://github.com/fommil/ensime-server/blob/jerk/spray-json-shapeless/src/main/scala/org/ensime/json/FamilyFormats.scala
- S-Expressions (Lisp FTW!) - https://github.com/milessabin/shapeless/blob/master/examples/src/main/scala/shapeless/examples/sexp.scala