add `compare` module with comparators

Take two. The heap code will follow later.
lolwut that was fun to read.

(no change required here)