Make tree an instance of Functor.

Simplify treeFromList.