Value comparators

See #738.
This pull request depends on #741.

I did a quick test with a simple reduce on tuples of value types. Once #744 is done I will integrate further tests.