On Fri, Jan 16, 2009 at 8:39 AM, Duncan Coutts
<duncan.cou...@worc.ox.ac.uk> wrote:

> 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 @newt...@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! :-)

A reference to the writer monad and to Data.Foldable might be helpful.
So far as I know they are the only uses of the Monoid abstraction in
the standard libraries.

It's probably a good idea to explicitly state the three monoid laws.

It would be nice to explain what operations have been chosen for the
Monoid instances of Prelude data types. (Maybe this belongs in the
Prelude documentation.)

I'd add a reminder that if you're defining a type with a Monoid
instance, your documentation should explain what the instance does.

-- 
Dave Menendez <d...@zednenem.com>
<http://www.eyrie.org/~zednenem/>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to