Template Haskell is a GHC extension for compile-time metaprogramming: it manipulates Haskell abstract syntax and generates functions that would otherwise require manual construction. section 9.5.3
A practical testing pattern uses Template Haskell to:
- Collect properties whose names use the prop_ suffix. section 9.5.3
- Generate a test-running action with quickCheckAll. section 9.5.3
- Enable the TemplateHaskell language extension and invoke generated code with the $ syntax. section 9.5.3
Generated QuickCheck suites
A suite defines prop_true and prop_false, then exposes runTests = $quickCheckAll. A separate main module runs several suites and fails when any generated check fails.
