Book Review: "Scala with Cats"

October 2, 2023

Scala with Cats is a book about the Cats library, which provides abstractions for functional programming in the Scala programming language. The book provides an introduction not only to the Cats library but also to some category theory structures. It’s divided in two major sections: “Theory” and “Case Studies”. The “Theory” section starts with a chapter dedicated to the way Cats is designed around type classes and how type classes are encoded in the Scala programming language. The section follows with dedicated chapters for different algebraic data structures, some functional programming constructs and how they are implemented in Cats: Monoids, Semigroups, Functors, Monads, Monad Transformers, Semigroupal, Applicative, Foldable and Traverse. The “Case Studies” section ties it all up with 4 practical applications of the previously introduced structures and constructs: testing asynchronous code, map reduce, data validation and CRDTs.

I worked through the book in March and April this year and found it engaging and with a fast pace. Laws are presented and explained in terms of Scala code. The exercises complement the content of the book well, particularly the ones in the “Case Studies” section, which showcase the applications of everything that was introduced in the “Theory” section.

I would recommend the book to anyone with moderate knowledge of the Scala programming language who wants to learn more about typed functional programming in general and about the Cats library in particular.

If you’re interested in my solutions to the book’s exercises, they are available in the following posts:

March 25, 2023
Solutions to "Scala with Cats": Chapter 1
April 3, 2023
Solutions to "Scala with Cats": Chapter 2
April 3, 2023
Solutions to "Scala with Cats": Chapter 3
April 4, 2023
Solutions to "Scala with Cats": Chapter 4
April 5, 2023
Solutions to "Scala with Cats": Chapter 5
April 5, 2023
Solutions to "Scala with Cats": Chapter 6
April 5, 2023
Solutions to "Scala with Cats": Chapter 7
April 7, 2023
Solutions to "Scala with Cats": Chapter 8
April 7, 2023
Solutions to "Scala with Cats": Chapter 9
April 8, 2023
Solutions to "Scala with Cats": Chapter 10
April 8, 2023
Solutions to "Scala with Cats": Chapter 11