- Generating products and sums
- Figuring out the type
- Type ambiguity
- Eq and Show
- Integers, and lifted integers
- Function-like types
- Ambiguities abound
- Generating functions
- Working out three types
- Lifting generators, generally
- A type of a higher rank
- The miscellaneous constraints
- Putting it all together
We had a short introduction to one of the
Applicative class laws in the previous lesson. But the
Applicative class has quite a few laws, so there is still a lot to cover here.
Applicative laws are stated as follows:
This lesson is dedicated to the testing machinery and how to transcribe the laws into code. At the end we will have a function that, given a generator for Applicative-lifted values, will tell us whether each of the four laws is satisfied. Once we have the testing set up, the next lesson will experiment with them and further explore what the properties mean.
We’ll be using the property testing library
hedgehog to ensure we write good, useful, law-abiding
Applicative instances. There are some new things that will make this a bit more difficult than the other Hedgehog properties we’ve written so far. There are more laws and more types of generators required than before. A new challenge in this lesson is that some of these laws ask us to generate functions.