What's one of the most exciting things about Scala 3?
Type class derivation!
At Scala in the City Virtual Conference, Chris Birchall explained how library authors can use it to make life easier for their users.
Type class derivation in Scala 3
Type class derivation is one of the most exciting new features of Scala 3. In this talk I'll explain how library authors can use it to make life easier for their users.
I'll start with a quick recap of how type class derivation is typically achieved in Scala 2, and how it looks in other languages such as Haskell and Rust.
Then I'll live-code a `derived` method for the world's simplest type class, Show. Once we've seen how all the pieces fit together, we can move on to a more interesting example: deriving Functor for paramterized ADTs.
Finally I'll demonstrate how I'm planning to combine type class derivation with Scala 3's new macro framework to allow automatic gRPC server and client generation in Mu (https://higherkindness.io/mu-scala/), a microservices framework developed by 47 Degrees.