Back To Schedule
Thursday, November 12 • 8:45am - 9:15am
Materialize Typeclasses with Magnolia

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
Magnolia is the modern way of materializing Typeclasses for any datatypes composed with product(case class) and co-product(trait). Magnolia is a simpler yet powerful and performant library. Highly functional programming libraries like cats and algebirds heavily depend on type classes. Most of the time, developing a scala library requires to write library-specific Typeclasses, and library users need to implement their domain-specific instances of these Typeclasses. This step could be automated with Magnolia. In Spotify, we use Magnolia to compile-time Typeclass generations for many storage types(Avro, Protobuf, Bigquery, etc.) to Scala case classes and use with Scio. This reduces a lot of boilerplate code, which otherwise users have to handcraft. This code is open source and available under spotify/magnolify github repository. Let's get our hand dirty and implement a case class diffing library that outputs the difference of any given case classes. Here we will use Magnolia to derive the type classes for any given datatype(product or coproduct). Let's talk about the limitations of the Magnolia library and how to work around some of it.

avatar for Shameera Rathnayaka

Shameera Rathnayaka

Senior Engineer, Spotify
I am a Senior Data Infrastructure Engineer in Spotify and a member of the Scio(Idiomatic Scala wrapper to Apache Beam) development team. Open source enthusiastic, a contributor to many open-source projects, and an Apache PMC member. A couple of years ago, I started to work with Scala... Read More →

Thursday November 12, 2020 8:45am - 9:15am PST