Sunday, March 25, 2012

Generating generators

This week Adam started looking at QuickCheck-style property-based testing. He has been focusing on understanding how to create generators "from scratch" as well as how to use combinators to create new generators from existing ones.
One problem which Adam faced was how to create a generator for a nested data structure. Perhaps unsurprisingly, the solution was to use recursion in the comprehension which constructs the generator.