shortest :: (Num a, Ord a) => Tree a -> a shortest (Leaf x) = x shortest (Node x xs) = x + (minimum $ map shortest xs)