generate runs a QuickCheck Gen to produce a random value inside an IO action. The expected type determines which arbitrary generator is used, so a type annotation can select the result type. section 9.4.1
Generate values in GHCi
Try expressions such as generate arbitrary :: IO Int or generate arbitrary :: IO [Bool]. Repeating generate produces different values, making it useful for inspecting and experimenting with generators.
Use generate with generators built from QuickCheck combinators:
- Combine arbitrary, choose, elements, suchThat, and other helpers to describe test data. section 9.4.1
