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:
- Functional Interpreters and You (SkillsCast recorded in December 2018)
- Essential Effects | ScalaCon Workshop (Online Course on 25th - 28th October 2021)
- ScalaCon 2021: November Edition (Online Conference on 2nd - 5th November 2021)
- Journey to the Centre of the JVM (SkillsCast recorded in May 2021)
- Connecting the dots - building and structuring a functional application in Scala (SkillsCast recorded in May 2021)
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.