Type classes are one of the most important programming patterns in Scala. However, they come with a cost in terms of boilerplate. In this talk we'll discuss eliminating that boilerplate using shapeless.
The verbosity of type classes stems from the proliferation of the instances we have to define for every type in our business model. The code for these instances tends to be simple and mechanical in structure... wouldn't it be great if we could abstract over them and eliminate a whole load of redundant/unnecessary code?
Enter shapeless, openening up a new world of generic programming. Shapeless gives us a boilerplate-free way of abstracting over algebraic data types (case classes and sealed traits). This allows us to write a small kernel of type class instances to support a huge variety of types, including a large portion of most business models.
This talk is aimed at intermediate Scala developers. You don't need to know what a type class is, or what shapeless is. However, you should have a familiarity with Scala syntax and know about things like Options and flatMapping.
If you aren't able to attend the talk or you'd like to know more, check out Dave's free eBook, The Type Astronaut's Guide to Shapeless.
YOU MAY ALSO LIKE:
- Scala eXchange London 2019 (in London on 12th - 13th December 2019)
- Scalax2gether Community Day 2019 (in London on 14th December 2019)
- Functional Interpreters and You (SkillsCast recorded in December 2018)
- Lightbend Akka for Scala - Professional (in London on 11th - 12th November 2019)
- Modern development with Java (in London on 9th - 11th December 2019)
- Don’t keep it to yourself - openness and honesty in the workplace (in London on 30th October 2019)
- Keynote by Naoki Takezoe on Revisit Dependency Injection in Scala and Introduction to Airframe (in London on 25th November 2019)
- Higher-Order Type-Level Programming (SkillsCast recorded in October 2019)
- Stick to Simple Haskell (SkillsCast recorded in October 2019)
Type Classes + Shapeless = Leaner, Cleaner Code
Dave is a developer, trainer, and partner at underscore.io. He has spent over a decade programming, speaking at conferences, and writing books on functional programming.