The Scalaz library

Scala is a functional programming language and as such it supports design patterns based on concepts such as monoids, monads, and others. We already saw these in Chapter 10, Functional Design Patterns – The Deep Theory, and we know the rules they follow and the structure they have. We wrote everything ourselves, but a library already exists that does this for us—Scalaz ( This library is used when we need purely functional data structures.

We have already encountered Scalaz in the previous chapter when we talked about lenses. In the following subsections, we will look at the library from the point of view of monoids, functors, and monads.

Monoids in Scalaz

One of the concepts we looked at in Chapter ...

Get Scala Design Patterns now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.