Exercise solution: Property testing the birds
In the GHCi session directly above the exercise description, we experimented to see if the choice between
(<*) mattered when the two functions are
allAlpha and the length-checking function. Intuitively, we’d like to say it doesn’t ever matter for these two functions because they don’t alter their input, and the effect-preserving aspect of these operators means that a failure on either side propagates that failure to the final result – no matter which way the bird is pointing.
But it’s always nice when we can use computers to verify our intuitions. Let’s write a little property test to see if it holds even when the computer is throwing random inputs at it.