Tagless Final: Purity And Performance In Scala


The workshop is made up of practical exercises that introduce the tagless final style, and demonstrate how this style can be used in real world use cases.

The workshop is in two parts. The first is a practical introduction to the concept of “Tagless Final Interpreters” with a simple first order language that can express integer arithmetic. Attendees will implement a simple evaluator for this language in the “tagless final” style, and show that the final and initial encodings are equivalent.

The second part consists of several exercises that build out a simple reading list application, that allows the storage of users, books and reading lists for each user, using the tagless final style.

The exercises will demonstrate;

  • The use of tagless final encoding
  • Composing tagless final algebras

Using typeclass constraints to abstract over what capabilities are needed in different scenarios. Including, sequential computations with cats.Monad, error handling with cats.MonadError and parallelism with cats.Parallel

I have run a similar workshop internally at my company. The resources are available here

The workshop should take 90-120 minutes

Eli Jordan

Eli Jordan

Elias Jordan, Senior Software Engineer at Tapad, is a Scala developer with 9 years of experience, and a passion for functional programming. Before moving from Sydney, Australia to Oslo, Norway to join the Tapad team, Elias spent 7 years at IBM working as a Lead Developer. In addition to his extensive experience writing in Scala, Elias has also specialized in using programming languages, Haskell and Java. Elias graduated from the University of New South Wales in 2011 with a degree in Computer Science and Mechanical Engineering.