Functortown continues
I am very pleased to announce the release of lesson 9 of the Applicative series.
Lesson 9
In this lesson, we write property tests for the Applicative laws using Hedgehog. This episode includes a refresher on how to combine Hedgehog generators, and along the way we get to see some fun stuff like ambiguous type signatures and rank-N types. We write properties for three of the four laws, leaving the interchange property as an exercise. At the end of the lesson, we have a Hedgehog property group that we will use in the next two lessons to give a thorough discussion of what the laws mean and examples of what it means to break them.
Coming next: 10 and 11
I’ve got to be honest: these lessons were really hard to write.
Most existing literature on the Applicative laws is either not rigorous enough to be convincing or too mathematically abstract to demonstrate relevance to the art of programming. Some authors explain the Applicative class by defining a different class that admits a more convenient statement of the laws and then proving that the two classes are equivalent. I find this approach clever but generally unsatisfying and of no practical value. Applicative
is the typeclass that I use every day, and I wanted to understand its laws in their own terms.
With considerable effort, I think we have achieved this, and I believe we have a truly novel approach that I can’t wait to share. Lessons 10 and 11 are nearly complete and will both be coming out later this week. This will conclude the Applicative section of Functortown.