
Am 22.10.2018 um 11:59 schrieb arjenvanweelden@gmail.com:
I think that this is possible by simply using QuickCheck's === and ==> (if you have Show and Eq instances for :>):
prop_recommute :: Commute p => (p :> p) wA wB -> Bool prop_recommute (x:>y) = isJust commuted ==> commute commuted === Just (x:>y) where commuted = commute (x:>y)
See https://hackage.haskell.org/package/QuickCheck-2.11.3/docs/Test-QuickCheck-P... for information on ==> and ===.
This is more readable and quite similar to your example above. It would print both left and right side of === when a counter-example is found.
Thanks for the hint wrt (===) which I wasn't aware of. In the example I posted this would work, but not in more complex ones. There are properties that get more patches as input and require many combinations of e.g. commute to succeed. Any one of them can fail and the rest can only be performed if the previous ones have succeeded. Cheers Ben