use TreeMap monoid from util