Lesson 1: Mapping a Maybe function

  • Sorting user data
  • Applying a Maybe function
  • There’s a typeclass for that
  • Exercises
  • Coming up

In the previous series, we worked through two functorial typeclasses, Functor and Bifunctor and gained an appreciation for what functors can do. Understanding fmap is the key to understanding all functors in Haskell, so we will refer to that first series often throughout the rest of our exploration of functors. Sometimes fmap isn’t enough, sometimes it needs some extra machinery to do its work, but it’s always there lurking in every functor, the way carbon is part of every living thing no matter how complex.

Today we’re going to introduce a new, slightly more interesting, problem and write the functions that will help us solve it. Then we’ll meet the typeclass that generalizes that solution.

Sign up for access to the full page, plus the complete archive and all the latest content.