Lesson 27. The Functor type class

After reading lesson 27, you’ll be able to

  • Use the Functor type class
  • Solve problems with fmap and <$>
  • Understand kinds for Functors

So far in this book, you’ve seen quite a few parameterized types (types that take another type as an argument). You’ve looked at types that represent containers, such as List and Map. You’ve also seen parameterized types that represent a context, such as Maybe for missing values and IO for values that come from the complex world of I/O. In this lesson, you’ll explore the powerful Functor type class. The Functor type class provides a generic interface for applying functions to values in a container or context. To get a sense of this, suppose you have the following types:

Get Get Programming with Haskell now with O’Reilly online learning.

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