檢查單個屬性

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):                  
[()]