
Hi Edward On 18 Jul 2009, at 14:23, Edward Kmett wrote:
Yeah, the Monoid instance for Maybe is somewhat unfortunate.
I can see where they were going as Maybe does provide the natural extension of a semigroup into a monoid by adding a unit element, but it doesn't have a Semigroup class to build on, and so has to require Monoid and in the end you get a definition that conflicts with the MonadPlus/Alternative instances for Maybe, and only really helps if you have broken Monoid instances around that are secretly just Semigroups.
Exactly. Types should mean more than mere data representations. The current Monoid instance is inconsistent with the broad interpretation of Maybe as a monad for exceptional computations. An isomorphic data representation can and should be used to attach a unit element to a semigroup, Data structures are data with structure. All the best Conor