liveBook · Manning

SimpleCheck

As explained in Learn Haskell by Example

SimpleCheck is the book's simplified Haskell property-testing framework used to reimplement and experiment with QuickCheck functionality.

SimpleCheck is a small Haskell property-testing framework organized as Test.SimpleCheck. It runs properties against randomly generated values, providing a practical base for testing program specifications. section 9.2

Testing ROT13 symmetry

A property test can assert that applying ROT13 twice returns the original string: s == rot13 (rot13 s). With asciiString and 100 generated cases, the test checks symmetry across human-readable ASCII characters rather than only letters. section 9.2

SimpleCheck supports the essential workflow of randomized property testing:

  • Define a property as a function over generated input. section 9.2
  • Choose a random generator suited to the property, such as asciiString. section 9.2

SimpleCheck also exposes the trade-offs that motivate QuickCheck: generator construction is laborious, properties are difficult to compose, test data is hard to inspect, preconditions are unavailable, and failures are not minimized. section 9.3

How Learn Haskell by Example covers it

How deep it goes
Builds a working framework around generators, properties, and propertyTest, but stops short of composition, inspection, preconditions, and shrinking.
Examples
Demonstrates ROT13 symmetry and alphabet-rotation closedness using ASCII strings, generated alphabets, integers, and characters.
What it assumes
Builds on random value generators and property definitions, while introducing their use within a testing framework.
What you can do after
Apply it via propertyTest to express specifications, generate inputs, and check randomized cases in Haskell projects.
How it connects
Connects property testing with random value generators, test specifications, ROT13, and QuickCheck.

Related concepts

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.