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:
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.