Parameterize the tallying algorithm and datastructre with a custom order.
The tallying algorithm is put in a functor and parameterized by custom ordering for type variables.
The tallying algorithm is put in a functor and parameterized by custom ordering for type variables.