-- Code from Section 1.1; it won't work since join is left unimplemented! module BinaryHeapTrees where data Ord a => Tree a = Null | Fork a (Tree a) (Tree a) isEmpty :: Ord a => Tree a -> Bool isEmpty Null = True isEmpty (Fork x a b) = False minElem :: Ord a => Tree a -> a minElem (Fork x a b) = x deleteMin :: Ord a => Tree a -> Tree a deleteMin (Fork x a b) = merge a b insert :: Ord a => a -> Tree a -> Tree a insert x a = merge (Fork x Null Null) a merge :: Ord a => Tree a -> Tree a -> Tree a merge a Null = a merge Null b = b merge a b | minElem a <= minElem b = join a b | otherwise = join b a join (Fork x a b) c = Fork x undefined undefined