QuickCheck: why isn't there a function to pass a test and what to use instead?
You can use the property
function from the Testable
class, and various Testable
instances to create a Property
with whatever characteristics you need.
For example, property ()
always succeeds. For another example, property (b :: Bool)
succeeds iff b == True
.
So you could do this for example:
prop_specialPair :: SpecialPair -> Property
prop_specialPair SpecialPair { xs } =
case xs of
x:_ -> x =/= 3
_ -> property ()
Or you can make it more explicit by using the Testable Result
instance and the value succeeded :: Result
:
prop_specialPair :: SpecialPair -> Property
prop_specialPair SpecialPair { xs } =
case xs of
x:_ -> x =/= 3
_ -> property succeeded