1 2 3 4 5 6
data ITree a = Leaf (Int -> a) | Node [ITree a] instance Functor ITree where fmap f (Node x) = Node (fmap (fmap f) x) fmap f (Leaf x) = Leaf (f.x)