# Pastebin nqt2N6lQ Im trying to obtain the min element in a tree using the following definition: data Tree a = Tip | Bin (Tree a) a (Tree a) deriving (Show, Eq) foldTree :: (b -> a -> b -> b) -> b -> Tree a -> b foldTree f z Tip = z foldTree f z (Bin l x r) = f (foldTree f z l) x (foldTree f z r) minTree :: (Ord a) => Tree a -> Maybe a minTree = foldTree f z where f l x r = minimum [l, Just x, r] z = Nothing However not quite sure how to obtain something other than Nothing as an output? Anyone have suggestions?