12 Applicative and traversable functors

This chapter covers

  • Introducing applicative functors
  • Introducing traversable functors
  • Defining semigroups

In the previous chapter on monads, we saw how many of the functions we’ve been writing for different combinator libraries can be expressed in terms of a single interface: Monad. Monads provide a powerful interface, as evidenced by the fact that we can use flatMap to essentially write imperative programs in a purely functional way.

In this chapter, we’ll learn about a type of related abstractions, applicative functors, which are less powerful than monads but more general (and hence more common). The process of arriving at applicative functors will also provide some insight into how to discover such ...

Get Functional Programming in Scala, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.