Why isn't there a QuickCheck
function similar to hedgehog
's success
? In particular I was wondering how one could translate a property like the following one:
prop_specialPair :: Property
prop_specialPair = property $ do
(_, xs) <- forAll specialPair
case xs of
x:_ -> x /== 3
_ -> success
In QuickCheck
if I use =/=
then I'm forced to return something of type Property
, and there seem to be no constant function to return a passing property.
So I either have to resort to the Bool
type:
prop_specialPair :: SpecialPair -> Bool
prop_specialPair SpecialPair { xs } =
case xs of
x:_ -> x == 3
_ -> True
Or use a very awkward encoding for success
, e.g.:
prop_specialPair :: SpecialPair -> Property
prop_specialPair SpecialPair { xs } =
case xs of
x:_ -> x =/= 3
_ -> True === True
Are there better ways to express the property above in QuickCheck
?