[Haskell-cafe] Comments from OCaml Hacker Brian Hurt

Ross Paterson ross at soi.city.ac.uk
Fri Jan 16 12:19:48 EST 2009

On Fri, Jan 16, 2009 at 12:00:40PM -0500, David Menendez wrote:
> 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.

I've added the 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.)

The right place for that is the instances, as soon as Haddock starts
showing instance comments (http://trac.haskell.org/haddock/ticket/29).
Then this information will be listed under both the type and the class.

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

When that Haddock enhancement is done, this will be general advice for
instances of all classes.

More information about the Haskell-Cafe mailing list