Challenge 3: A Recursive Tree With a Summing Function — Possible Solution ==================================================================== Main.hs: data Tree a = Leaf | Node (Tree a) a (Tree a) treeSum :: Tree Int -> Int treeSum Leaf = 0 -- base case treeSum (Node left value right) = treeSum left + value + treeSum right -- recursive case sampleTree :: Tree Int sampleTree = Node (Node Leaf 1 Leaf) 2 (Node (Node Leaf 3 Leaf) 4 Leaf) main :: IO () main = print (treeSum sampleTree) Output: 10 Explanation: Tree a is genuinely recursive -- a Node holds a value AND two more Trees (its left and right children), which can themselves be Nodes or Leafs. treeSum mirrors this shape exactly: the base case handles Leaf (an empty subtree contributes 0), and the recursive case handles Node by summing the left subtree, adding the node's own value, and adding the right subtree -- calling itself on both children. sampleTree contains four real values (1, 2, 3, 4), and treeSum correctly adds them all to 10, regardless of how deeply nested any particular value is. WHY THIS WORKS AS AN ANSWER ------------------------------ This defines the exact recursive Tree a shape the chapter introduces and writes a properly recursive treeSum function matching its own recursive structure, tested on a tree with genuine nesting (not just a flat list of children) to confirm the recursion actually traverses correctly.