SGen represents a size-aware generator as a function from an integer size to a Gen of arbitrary test values. The generator knows how to produce a value at a requested size, while the property runner chooses which sizes to try. section 8.2
SGen separates value generation from test scheduling:
- Convert an ordinary Gen into an SGen by ignoring the supplied size. section 8.2
- Reuse Gen operations through SGen convenience functions. section 8.2
- Generate structures such as lists from the requested size rather than from an explicit combinator argument. section 8.2
Sized property testing
A sized forAll supplies Prop with a maximum size. Prop distributes test cases across sizes from zero through that maximum, runs the resulting properties, and can search for the smallest failing test case. section 8.2
opaque type SGen[+A] = Int => Gen[A]
The compact type definition makes the size dependency explicit: SGen[A] maps an Int size to Gen[A]. section 8.2
