[Haskell-cafe] Could someone teach me why we use Data.Monoid?

Reid Barton rwbarton at math.harvard.edu
Fri Nov 13 13:38:31 EST 2009


On Fri, Nov 13, 2009 at 08:37:57PM +0300, Eugene Kirpichov wrote:
> For every monoid (M, *, u), the dual to it is the monoid (Dual M, \x y
> -> y * x, u)

The entirely standard name for this is the opposite monoid.  The only
places I have seen the name "dual monoid" used to mean opposite monoid
are in Data.Monoid and subsequently by some Haskellers.

A very good reason not to use the name "dual monoid" is that the basic
point of duality is contravariance.  The prototypical example of
duality is the dual V^* of a finite-dimensional vector space V,
defined as the vector space of all linear maps from V to the ground
field.  If f : V -> W is a linear map, then we get an induced linear
map f^* : W^* -> V^* by precomposing with f.  Note that f^* "goes in
the other direction"; the functor -^* is contravariant.

Perhaps a more familiar example is from classical Boolean algebra.  If
P is a proposition, it's sensible to call not-P the dual of P, since
an implication P -> Q yields an implication not-Q -> not-P.  (This is
closely related to the previous example, since not-P is the statement
P -> false.)

The notion of opposite monoids is not an example of duality.  Given a
monoid homomorphism f : M -> N, there is an induced opposite
homomorphism f^op : M^op -> N^op, which is the same as f on elements.
It goes the same direction as f; -^op is a covariant functor.

If you're not convinced by these arguments, try googling for "opposite
monoid" and "dual monoid" to see the standard usage for yourself.
There is no standard meaning for the phrase "dual monoid", but I would
venture that it is never used to mean "opposite monoid" in the
mathematical literature.

(Sorry for the rant.)

Regards,
Reid Barton



More information about the Haskell-Cafe mailing list