[Haskell-cafe] For class Monoid; better names than mempty & mappend might have been: mid (mident) & mbinop

Alexander Solla alex.solla at gmail.com
Mon Aug 8 23:09:23 CEST 2011


On Mon, Aug 8, 2011 at 1:56 AM, Henning Thielemann <
schlepptop at henning-thielemann.de> wrote:

> On 24.07.2011 22:20, Antoine Latter wrote:
>
>> On Sat, Jul 23, 2011 at 1:41 PM, KC<kc1956 at gmail.com>  wrote:
>>
>>> It would be easier for beginners to "grok".
>>>
>>>
>> I think that assumes that all beginners have a strong foundation in
>> algebra. Although it does have the advantage that the names are as
>> abstract as the class.
>>
>
> As pointed out earlier in this list, the name of the class and the methods
> are inconsistent. Monoid refers to a general algebraic structure, whereas
> mempty and mappend refer to certain instances like lists.


I don't know what the intention for the names was, but I read them as
"syntactic" empty and append, as in the monoid constructs of algebra.  In
other words, we construct "words" by "appending" (or "concatenating")
elements of a monoid.  And we have an "empty" word.

This usage is common enough in mathematics.

After all, if we use the Monoid class interface for a type, we are
explicitly using the monoid operations, and not the type's underlying
interpretation for appending words in the type.  Why should the generic
monoid operator names reflect the underlying usage?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110808/970b92a7/attachment.htm>


More information about the Haskell-Cafe mailing list