Is there a way to falsify this (wrong) property:
prop :: Eq a => [a] -> Bool
prop xs = reverse xs == xs
When i Use QuickCheck and later VerboseCheck it gives 100 different forms of:
[(),(),(),(),(),(),(),(),(),(),(),(),(),(),()]
Passed:
and the final result is:
+++ OK, passed 100 tests.
It just so happens that
Eq a
to use, and with the ExtendedDefaultRules
extension normally enabled in GHCi, it chooses ()
.()
, because it has only one (non-bottom) value, the proposition is actually true.The simplest fix is to choose (almost) any other type by providing a type annotation:
Prelude Test.QuickCheck> quickCheck (prop :: [Int] -> Bool)
*** Failed! Falsifiable (after 4 tests and 3 shrinks):
[0,1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With