
On Thu, 2009-01-22 at 11:32 -0600, Jeremy Shaw wrote:
Hello,
Just some minor suggestions and comments:
The description might read better as two sentences:
A class for monoids with various general-purpose instances. Monoids are types with an associative binary operation that has an identity.
One thing that I think is a bit unclear from that description is the fact that it does not matter *what* the binary operation does, as long as the laws are followed. That is the whole point of the monoid class -- you use it when you only care about the laws, not the specific operation...
For the laws, it would be nice to label each rule, something like
* mappend mempty x = x -- Left Identity * mappend x empty = x -- Right Identity * mappend x (mappend y z) = mappend (mappend x y) z -- Associative
* mconcat = foldr mappend mempty -- Not sure what to call this. Perhaps it an axiom?
This is just a definition, both actually and nominally.