module Template_04(ite, find, polymorphicFind, suffixes, removeLast, height, flatten, isSearchTree, Tree(..)) where -- IMPORTANT ----------------------------- doNotModify anything above this line = True --------------------------------------------------- -- Exercise 1 ite :: Bool -> a -> a -> a ite True x y = x ite False x y = y find :: Char -> [(Char, b)] -> Either String b find = undefined -- Hint: You might need to slightly change the type of polymorphicFind. polymorphicFind :: a -> [(a,b)] -> Maybe b polymorphicFind = undefined suffixes :: [a] -> [[a]] suffixes = undefined removeLast :: [a] -> [a] removeLast = undefined -- Exercise 2 threeEqual x y z = undefined foo :: a -> a -> a foo = undefined bar :: a -> a -> a bar = undefined -- Exercise 3 data Tree a = Node a (Tree a) (Tree a) | Leaf a deriving (Show) exampleTree :: Tree Double exampleTree = Node 1 (Leaf 2) (Node 3 (Node 4 (Leaf 5) (Leaf 6)) (Leaf 7)) height :: Tree a -> Integer height = undefined flatten :: Tree a -> [a] flatten = undefined isSearchTree :: Ord a => Tree a -> Bool isSearchTree = undefined