Add Monoid and Measured traits.
Remove explicit types and reformat test cases.