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 2018 Opening - Welcome to Day 1! (SkillsCast recorded in December 2018)
- Scala Days 2023 (Online Conference on 1st - 30th December 2023)
- How to teach IntelliJ IDEA to your juniors (Online Meetup on 2nd February 2023)
- An Introduction to Functional Reactive Programming and Yampa (in Zürich on 2nd February 2023)
- Super-heroes: Monoid, Foldable and Traversable (SkillsCast recorded in December 2022)
- What Logic can Teach Us, Scala Programmers (SkillsCast recorded in October 2022)
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.