[Haskell-cafe] Comments from OCaml Hacker Brian Hurt

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Jan 16 08:39:10 EST 2009


On Fri, 2009-01-16 at 14:16 +0100, david48 wrote:

> Upon reading this thread, I asked myself : what's a monoid ? I had no
> idea. I read some posts, then google "haskell monoid".
> 
> The first link leads me to Data.Monoid which starts with
> 
> <<
> Description
> The Monoid class with various general-purpose instances.
> 
> Inspired by the paper /Functional Programming with Overloading and
> Higher-Order Polymorphism/, Mark P Jones
> (http://citeseer.ist.psu.edu/jones95functional.html) Advanced School
> of Functional Programming, 1995.
> >>

Ross just updated the documentation for the Monoid module. Here is how
it reads now:

The module header now reads simply:

        A class for monoids (types with an associative binary operation
        that has an identity) with various general-purpose instances.

Note, no links to papers.

And the Monoid class has:

        The class of monoids (types with an associative binary operation
        that has an identity).  The method names refer to the monoid of
        lists, but there are many other instances.
        
        Minimal complete definition: 'mempty' and 'mappend'.
        
        Some types can be viewed as a monoid in more than one way, e.g.
        both addition and multiplication on numbers. In such cases we
        often define @newtype at s and make those instances of 'Monoid',
        e.g. 'Sum' and 'Product'.
        
If you or anyone else has further concrete suggestions / improvements
then post them here now! :-)


Duncan



More information about the Haskell-Cafe mailing list