Monuses and Heaps
Summary
A dense technical exploration of monus algebra and its use in heaps and phase-based computations. The post introduces the monus concept as a partial subtraction in an ordered monoid, demonstrates how storing weights as differences can optimize heap-based algorithms, and shows how to implement pairing heaps and Phases (an applicative transformer) in Haskell. It then extends to stability concerns and introduces a Key monus for maintaining original order when keys collide, culminating in a stable, efficient approach for phase-controlled computations.