commonize compareTo methods to reduce copy/paste in type system