import Test.QuickCheck ------------------------------------------------------------------ -- A binary tree structure: data Tree a = Leaf a | Node (Tree a) (Tree a) tree123 :: Tree Int tree123 = Node (Leaf 1) (Node (Leaf 2) (Leaf 3)) -- Returns the height of a binary tree: height :: Tree a -> Int height (Leaf x) = 0 height (Node t1 t2) = 1 + max (height t1) (height t2) prop_height_nonnegative :: Tree Int -> Bool prop_height_nonnegative t = height t >= 0 -- Tests with polymorphic operations: prop_append_commutative :: [Int] -> [Int] -> Bool prop_append_commutative xs ys = xs ++ ys == ys ++ xs