[Haskell-cafe] Comments from OCaml Hacker Brian Hurt
Henning Thielemann
lemming at henning-thielemann.de
Tue Jan 20 17:41:54 EST 2009
On Thu, 15 Jan 2009, John Goerzen wrote:
> One thing that does annoy me about Haskell- naming. Say you've
> noticed a common pattern, a lot of data structures are similar to
> the difference list I described above, in that they have an empty
> state and the ability to append things onto the end. Now, for
> various reasons, you want to give this pattern a name using on
> Haskell's tools for expressing common idioms as general patterns
> (type classes, in this case). What name do you give it? I'd be
> inclined to call it something like "Appendable". But no, Haskell
> calls this pattern a "Monoid".
I risk to repeat someones point, since I have not read the entire thread
... What I don't like about the Monoid class is, that its members are
named "mempty" and "mappend". It may be either (also respecting
qualified import)
Monoid(identity, op)
or
Appendable(empty, append)
where only the first one seems reasonable, since the Sum monoid and its
friends do not append anything.
More information about the Haskell-Cafe
mailing list