1{-# LANGUAGE ScopedTypeVariables, TemplateHaskell #-} 2module Main where 3 4-------------------------------------------------------------------------- 5-- imports 6 7import Test.QuickCheck 8 9-------------------------------------------------------------------------- 10-- example 1 11 12allEqual x y z = x == y && y == z 13allEqual' x y z = 2*x == y + z 14 15prop_SimonThompson x y (z :: Int) = 16 allEqual x y z == allEqual' x y z 17 18-------------------------------------------------------------------------- 19-- example 2 20 21prop_ReverseReverse :: Eq a => [a] -> Bool 22prop_ReverseReverse xs = 23 reverse (reverse xs) == xs 24 25prop_Reverse xs = 26 reverse xs == xs 27 28-------------------------------------------------------------------------- 29-- example 3 30 31prop_Error (x,y) = 32 2*x <= 5*y 33 34-------------------------------------------------------------------------- 35-- main 36 37return [] 38prop_conj = counterexample "Simon Thompson" $(monomorphic 'prop_SimonThompson) .&&. 39 counterexample "reverse" $(monomorphic 'prop_Reverse) 40prop_disj = counterexample "reverse" $(monomorphic 'prop_Reverse) .||. 41 counterexample "Simon Thompson" $(monomorphic 'prop_SimonThompson) 42return [] 43main = $quickCheckAll 44 45-------------------------------------------------------------------------- 46-- the end. 47