add `compare` module with comparators

Take two. The heap code will follow later.
I feel like this would look nicer as a method on `cmp`. Is there a particular reason it isn't?