Closed isovector closed 4 years ago
This PR adds a withPrintStyle signature that changes how laws are presented. Given this signature:
withPrintStyle
main :: IO () main = quickSpec [ withPrintStyle ForQuickCheck , con "+" ((+) :: Int -> Int -> Int) ]
its output becomes:
== Functions == (+) :: Int -> Int -> Int == Laws == quickspec_laws :: [(String, Property)] quickspec_laws = [ ( "x + y = y + x" , property $ \ (x :: Int) (y :: Int) -> (x + y) === (y + x)) , ( "(x + y) + z = x + (y + z)" , property $ \ (x :: Int) (y :: Int) (z :: Int) -> ((x + y) + z) === (x + (y + z))) ]
Laws that require use of the Observe typeclass have their properties emitted using the new (=~=) :: (Show test, Show outcome, Observe test outcome a) => a -> a -> Property operator.
Observe
(=~=) :: (Show test, Show outcome, Observe test outcome a) => a -> a -> Property
Fixes #43
Thanks a lot!
This PR adds a
withPrintStyle
signature that changes how laws are presented. Given this signature:its output becomes:
Laws that require use of the
Observe
typeclass have their properties emitted using the new(=~=) :: (Show test, Show outcome, Observe test outcome a) => a -> a -> Property
operator.Fixes #43