Skip to content

Scala

Big picture: type classes are ad-hoc polymorphism with laws. The numbered notes climb the hierarchy those classes form. The Cats notes are the same ideas as read from the book.

Reading order

  1. Type classes: a trait that declares behavior, plus the laws that behavior must obey.
  2. Monoids and semigroups: combining values, with and without an identity.
  3. Functors: mapping over a structure without changing the structure.
  4. Monads: sequencing dependent computations.
  5. Semigroupal and applicative: combining independent computations.
  6. Foldable and traverse: folding a structure, and traversing it with an effect.
  7. Hierarchy: how the sequencing type classes sit inside each other.
  8. Higher kinds: kinds, the types of types. This is the machinery under functors and everything above them.
  9. Selections: variance, and which instance the compiler picks when more than one applies.

Cats

The same concepts, from Scala with Cats, in the order the ideas build.

  1. Type classes
  2. Ad-hoc polymorphism
  3. Implicits: how Scala finds the instance.
  4. Monoids