Lesson 4: Breaking the laws!
- Why typeclasses have laws
- The Functor Laws
- A backward pair
- Coming up
In this lesson, we’ll be talking about the laws of the
Functor typeclass, why they exist, and how to enforce them. We’ll be using some variations of instances we’ve written in previous lessons, particularly of the
Pair type and a
Maybe-like type to illustrate both law-abiding instances and what it means to break the laws. We’ll use the property-testing library called
hedgehog to ensure instances are well-behaved.