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 10th - 13th May 2021)
- Akka Streams for Scala | ScalaCon Workshop (Online Course on 10th - 12th May 2021)
- ScalaCon 2021 (Online Conference on 18th - 22nd May 2021)
- An Introduction to Cats Effect with Adam Rosien (Online Meetup on 22nd April 2021)
- Type Me If You Can: Writing Safe Communication Protocols with F# (SkillsCast recorded in October 2020)
- Keynote: (Programming Languages) in Agda = Programming (Languages in Agda) (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.