liveBook · Manning

getSize

As explained in Learn Haskell by Example

getSize is a QuickCheck generator operation that retrieves the generator's current size parameter.

getSize retrieves the current internal size parameter of a QuickCheck generator. That size influences generated values, such as the magnitude of Int values or the maximum length of lists. section 9.4.1

Use getSize inside custom generators when generated values should scale with QuickCheck's settings. The size propagates through nested generators; resize changes it explicitly when external control is needed. section 9.4.1

Bound a rotation amount

A generator for alphabet-rotation tests reads the size, then chooses n between -size and size while generating the alphabet and character:

How Learn Haskell by Example covers it

How deep it goes
Explains the internal size parameter, propagation, defaults, and resize, then applies it in a complete generator.
Examples
Demonstrates size-bounded alphabet rotations and sampled Int values under several resize settings.
What it assumes
Assumes familiarity with QuickCheck generators and do notation while explaining generator size behavior from its practical effects.
What you can do after
Apply it via QuickCheck to build generators whose value ranges scale with propagated test sizes.
How it connects
Connects getSize with QuickCheck generators, arbitrary, choose, resize, listOf, and property-based testing.

This explainer was generated by Manning's knowledge graph from the text of Learn Haskell by Example. The section links point to the parts of the book it draws on.