sample is a QuickCheck operation for inspecting a generator’s output across a progression of sizes. Rather than showing values from one fixed size, it runs sizes from 0 through 20, making changes in generated shape or magnitude visible quickly. section 9.4.1
Use it while designing a generator, especially one whose output should scale with size. Generators can read the current size with getSize; that size propagates into nested generators, while resize deliberately overrides it when a different bound is needed. section 9.4.1
Inspecting a size-sensitive generator
For a generator that chooses an alphabet, an offset, and a character from that alphabet, use sample to check how its values evolve as size rises. Keep the generator size-aware: derive the offset range from getSize, restrict alphabets to nonempty values, and select the character from the chosen alphabet. section 9.4.1
This inspection is complementary to property testing. After checking that generated cases look plausible, pass the generator to forAll so a property is tested against explicitly controlled test data. section 9.4.1
