[Haskell-cafe] Comments from OCaml Hacker Brian Hurt

Andrew Coppin andrewcoppin at btinternet.com
Thu Jan 15 17:32:09 EST 2009


Duncan Coutts wrote:
> By making a type an instance of Monoid instead of exporting
> emptyFoo, joinFoo functions it makes the API clearer because it shows
> that we are re-using an existing familiar concept rather than inventing
> a new one. It also means the user already knows that joinFoo must be
> associative and have unit emptyFoo without having to read the
> documentation.
>   

I don't know about you, but rather than knowing that joinFoo is 
associative, I'd be *far* more interested in finding out what it 
actually _does_. Knowing that it's a monoid doesn't really tell me 
anything useful. A monoid can be almost anything.

As an aside, the integers form two different monoids. Haskell can't 
[easily] handle that. Does anybody know of a language that can?



More information about the Haskell-Cafe mailing list