Functortown: A Map of the Territory

This course will be a full tour of the functors. We will start by examining the motivation for functors, the mathematical basis of functors, and the Functor typeclass. From there, we’ll explore monoidal functors, bifunctors, contravariant functors, and profunctors in depth.

Topics covered in this course:

  • Functor, Bifunctor, Applicative, Traversable, Monad, Contravariant, and Profunctor typeclasses;
  • type constructors and higher kindedness;
  • representative instances and uses of each;
  • and the laws of each and how to property test your instances using the hedgehog testing library.


  • knowledge of several basic types, especially Maybe, Either, tuples, and the function type;
  • basic understanding of typeclasses and their relationship with types; and
  • some facility with Haskell syntax.

Lesson plan

Part I: Functor

  • Introduction: why do we want this
  • Higher-kinded types and fmap
  • Some product type functors
  • More examples of fmap usage
  • The Functor laws and property tests

Part II: Bifunctor

  • Introduction: what and why
  • Types that are bifunctors, and a type that is not
  • Examples of bimap usage
  • The Bifunctor laws and property tests

Part III: Applicative

  • Introduction: what and why
  • Applicatives are functors!
  • What makes applicative special
  • Examples of <*> usage
  • The Applicative laws and property tests

Part IV: Traversable

  • Introduction: what and why
  • Instances
  • Connection to Applicative
  • Examples of traverse usage
  • The Traversable laws and property tests

Part V: Monad

  • Introduction: what and why
  • Instances
  • Relationship to Functor and Applicative
  • Examples of >>= usage
  • The Kleisli fish
  • The Monad laws and property tests

Part VI: Contravariant

  • Introduction: what and why
  • What kinds of types are contravariant
  • Relationship to an earlier functor
  • Examples of contramap usage
  • The Contravariant laws and property tests

Part VII: Profunctor

  • Introduction: what and why
  • Breaking down dimap
  • What kinds of types are profunctors
  • Examples, from basic to complex
  • The Profunctor laws and property tests

This course will be starting next week.

Type Classes offers courses and projects to get you started and make you an expert in FP with Haskell. For $29/month, you get access to the complete archive and all the latest content.