sort by batch if monoid is commutative