data Tree a = Nil | Node a (Tree a) (Tree a) deriving (Eq, Ord, Show, Read) depth :: Tree a -> Int depth Nil = 0 depth (Node n t1 t2) = 1 + max (depth t1) (depth t2)