Northeast Scala Symposium
2023

Paul Thordarson

I am a veteran software engineer who fell in love with Scala while working at KAYAK and found a way onto the only team who was using it at the time. I eventually left KAYAK for a startup that uses functional Scala on their project backend. I'm now working in Scala full time where I am enjoying continually becoming more proficient in the language and sharing the love with newcomers.

Improving Java Library Ergonomics with Typeclasses

Abstract - Typeclasses are one of the distinguishing features of Scala. This talk breaks down a practical application of typeclasses through an example of taking a Java library one might use in a Scala project and builds up a more Scala-like interface for interacting with it in the rest of the project.

It is convenient that Scala projects can use popular Java libraries where needed, however the interface one works with is often not very Scala-like. This talk walks through making the interface to a Java library, in this case Typesafe (Lightbend) config and constructing an interface that is more idiomatically Scala. We start by defining the interface we would like, transforming methods like `Config::getString` and `Config::getDouble` into a single type parameterized `Config.get[T]` method. Next we will walk through the typeclass we need to do this, creating instances for primitives, before moving on to higher kinded types like `Option`, expanding the interface to eliminate `null` values, and encapsulate errors in the return type. After this talk, an attendee should feel more comfortable incorporating typeclasses into their day to day work, making more readable, idiomatic code. The examples will be given in Scala 3.