Lesson 8: Mapping a Maybe function

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

So far in this course, we’ve worked through two functorial typeclasses, Functor and Bifunctor and gained an appreciation for what functors can do. Everything that we have done, and everything we will do for the rest of this course, starts from understanding fmap. 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 pattern.

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