implemented functor instance for ITree.