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

Andrew Coppin andrewcoppin at btinternet.com
Fri Nov 13 12:09:56 EST 2009

Magnus Therning wrote:
> On Fri, Nov 13, 2009 at 4:52 PM, Andrew Coppin
> <andrewcoppin at btinternet.com> wrote:
>> A class that represents "any possible thing that can technically
>> be considered a monoid" seems so absurdly general as to be almost useless.
>> If you don't know what an operator *does*, being able to abstract over it
>> isn't especially helpful...
> But can't you say exactly the same about Monads?

I know nothing about how mathematicians use monads. However, Haskell 
uses them in one specific way: for controlling (not necessarily 
_sequencing_) statement execution. This is a fairly rigidly-defined notion.

By contrast, Integer forms an infinite family of different monoids, yet 
it can have only a single Monoid instance...

I notice that there's a an Alternative class, which is isomorphic to 
Monoid, but rather than being some arbitrary monoid, it's a monoid with 
a specific meaning. This, I would argue, is far more useful.

More information about the Haskell-Cafe mailing list