Home

Awesome

Scala Typeclassopedia

A direct "translation" of Brent Yorgey's Typeclassopedia as if it were written for Scala.

Brent Yorgey's Typeclassopedia is a document thoroughly describing a hierarchy of commonly used typeclasses in the Haskell standard libraries. It is standard learning material for becoming comfortable with more advanced Haskell idioms and has been very successful in that role.

As third-party libraries for Scala have adopted more and more of the typeclass machinery developed in the Haskell community, it's popular to suggest someone reads the Typeclassopedia while learning Scala as well. Unfortunately, this involves learning a new syntax and manually figuring out how to map Haskell concepts into Scala.

I am translating the Typeclassopedia to Scala in order to reduce this friction and make recommending the Typeclassopedia to students of Scala easy. My hope is that this document can provide similar benefit that the original version of the Typeclassopedia has to Haskell learners since 2009.

Note on libraries

My goal with this document is to make a direct translation of the Typeclassopedia for Scala-the-language. This is not straightforward since Scala-the-language does not include most of these typeclasses! I could choose to use a particular library as an example, but the information here is not dependent on a library so I will not.

Instead, each description will have a "See also" section which notes implementations of this typeclass in Scala.

Table of Contents