Lesson 5: Two maps in one

Contents
  • Incrementable
  • Bifunctors
  • Covariance
  • Coming up

We spent the previous four lessons on understanding the Functor typeclass as well as type constructors and functors more generally; we also discussed the laws of the Functor class and how (and why) to check them with the hedgehog testing library. fmap is a useful tool, but with some types, such as those constructed by Either and (,), we may want the ability to fmap over either side, or both sides. This lesson introduces a typeclass called Bifunctor for just those times.

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