Functors
Prev: Simple Algebraic Data Types Next: Functoriality
Prev: Simple Algebraic Data Types Next: Functoriality
Exercises
- Can we turn the
Maybetype constructor into a functor by defining:
fmap _ _ = Nothingwhich ignores both of its arguments? (Hint: Check the functor laws.)
- Prove functor laws for the reader functor. Hint: it’s really simple.
- Implement the reader functor in your second favorite language (the first being Haskell, of course).
- Prove the functor laws for the list functor. Assume that the laws are true for the tail part of the list you’re applying it to (in other words, use induction).