Haskell Language QuickCheck Checking a single property

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

The quickCheck function tests a property on 100 random inputs.

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

If a property fails for some input, quickCheck prints out a counterexample.

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

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


Got any Haskell Language Question?