检查单个属性

quickCheck 函数在 100 个随机输入上测试属性。

ghci> quickCheck prop_reverseDoesNotChangeLength
+++ OK, passed 100 tests.

如果某个输入属性失败,quickCheck 会打印出一个反例。

prop_reverseIsAlwaysEmpty xs = reverse xs == []  -- plainly not true for all xs

ghci> quickCheck prop_reverseIsAlwaysEmpty
*** Failed! Falsifiable (after 2 tests):                  
[()]