# 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 and the `Functor`

typeclass. From there, we’ll explore monoidal functors, bifunctors, contravariant functors, and profunctors in depth, discussing the laws and the mathematical basis for these structures along the way.

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;
- the laws and how to property test your instances using the
`hedgehog`

testing library.

Prerequisites:

- 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`

- Motivation, higher-kinded types and
`fmap`

- Some product type functors, more examples of
`fmap`

usage - The functor of functions and some functors that are not
`Functor`

s - The
`Functor`

laws and property tests

Part II: `Bifunctor`

Part III: `Applicative`

- Introduction: what and why
- Applicatives are monoidal!
- Other operators in the
`Applicative`

class - List and
`ZipList`

- The function applicative and
`Reader`

- 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
`Reader`

newtype - The
`Monad`

laws and property tests - Transformers

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