hooray for higher-order unification! figures out the type parameters for treeMap