Re: [Haskell-cafe] For class Monoid; better names than mempty & mappend might have been: mid (mident) & mbinop

So is the change taking effect?
We were approaching consensus for the addition of of: infixr 6 <>
(<>) :: Monoid m => m -> m -> m (<>) = mappend and a matching change for (<+>) in the pretty package.
It was also suggested to make (<>) a method of Monoid and insert the following default definitions: (<>) = mappend mappend = (<>)
And how about the following: (<<>>) = mconcat mconcat = (<<>>)
And "mempty" could be "id".
The problems with this are: - mconcat is not a binary operator, so using <<>> would bring little advantage. You'd always have to use it in its bracketed form, for example. - Changing mempty to id could break a lot of existing code (e.g. due to typeclass ambiguity). This is the main reason. It's also not clear to me that this is a better name (it's just shorter). The current naming of Monoid methods is modelled after list operations, because list is a (the?) free monoid. However, in many cases "zero" or "one" would be an equally good name. I think (<>) is fairly uncontroversial because: 1. It's short 2. It's abstract. i.e., no intended pronunciation and it looks like LaTeX's \diamond operator 3. Changing it would be compatible with most existing libraries. For this reason, I think a larger change would have to come with a larger library re-organization. Johan Tibell suggested something like that a while ago: instead of lots of little cuts (backwards incompatible changes), a working group of activists should redesign a whole new (incompatible) alternative set of core libraries.
On Sun, Jul 24, 2011 at 11:39 AM, Thomas Schilling
wrote: Yes, this has sort-of been agreed upon in a GHC ticket about a year ago: http://hackage.haskell.org/trac/ghc/ticket/3339
I had a patch in Darcs, but then came the switch to Git. I ported it to Git, but didn't iron out all the issues. That was quite a while ago so it's currently a bit bitrotten. I don't think it's enough time to get it into 7.2, but since that's largely an unstable release, it wouldn't hurt until 7.4. I'll probably work on it at CamHac in a few weeks.
-- -- Regards, KC
-- Push the envelope. Watch it bend.

Hi Café, Thomas> I think (<>) is fairly uncontroversial because: Thomas> (...) Thomas> 2. It's abstract. i.e., no intended pronunciation How can that be an advantage ? A text flow with unnamed (or unpronounceable) symbols makes reading, understanding and remembering harder, don't you think ? I really think any operator or symbol should be intended (and even designed !) for pronunciation. Some references state that the monoid binary operation is often named "dot" or "times" in english. That does not mean the operator must be `dot`, `times`, (<.>) or (<x>) but at least the doc should provide a single, consistent and pronounceable name for it, whatever its spelling. Thomas> For this reason, I think a larger change would have to come with Thomas> a larger library re-organization. Johan Tibell suggested Thomas> something like that a while ago: instead of lots of little cuts Thomas> (backwards incompatible changes), a working group of activists Thomas> should redesign a whole new (incompatible) alternative set of Thomas> core libraries. This would be a great initiative, really ! -- Paul

On 25 July 2011 08:22, Paul R
Hi Café,
Thomas> I think (<>) is fairly uncontroversial because: Thomas> (...) Thomas> 2. It's abstract. i.e., no intended pronunciation
How can that be an advantage ? A text flow with unnamed (or unpronounceable) symbols makes reading, understanding and remembering harder, don't you think ? I really think any operator or symbol should be intended (and even designed !) for pronunciation.
Some references state that the monoid binary operation is often named "dot" or "times" in english. That does not mean the operator must be `dot`, `times`, (<.>) or (<x>) but at least the doc should provide a single, consistent and pronounceable name for it, whatever its spelling.
Well, in this case I think it can be beneficial because the pronunciation depends on the underlying monoid. E.g., sometimes it would be "append" or "plus", other times "dot" or "times". It can, of course, be useful to also have a good name for the generic operator. In this case I'd call it "diamond". -- Push the envelope. Watch it bend.

On Mon, Jul 25, 2011 at 9:35 AM, Thomas Schilling
On 25 July 2011 08:22, Paul R
wrote: Hi Café,
Thomas> I think (<>) is fairly uncontroversial because: Thomas> (...) Thomas> 2. It's abstract. i.e., no intended pronunciation
How can that be an advantage ? A text flow with unnamed (or unpronounceable) symbols makes reading, understanding and remembering harder, don't you think ? I really think any operator or symbol should be intended (and even designed !) for pronunciation.
Some references state that the monoid binary operation is often named "dot" or "times" in english. That does not mean the operator must be `dot`, `times`, (<.>) or (<x>) but at least the doc should provide a single, consistent and pronounceable name for it, whatever its spelling.
Well, in this case I think it can be beneficial because the pronunciation depends on the underlying monoid. E.g., sometimes it would be "append" or "plus", other times "dot" or "times". It can, of course, be useful to also have a good name for the generic operator. In this case I'd call it "diamond".
After a big, backwards-incompatible library overhaul it would be nice if it ended up being (++) or (+).
-- Push the envelope. Watch it bend.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Work is punishment for failing to procrastinate effectively.

2011/7/25 Paul R
Some references state that the monoid binary operation is often named "dot" or "times" in english. That does not mean the operator must be `dot`, `times`, (<.>) or (<x>) but at least the doc should provide a single, consistent and pronounceable name for it, whatever its spelling.
That is the problem when changing a function into an operator: the pronunciation. There should be a page somewhere that sums up how to pronounce the most common operators.
= is "bind", ok, but how do you pronounce >> or <*>, for instance?

2011/7/25 Yves Parès
2011/7/25 Paul R
Some references state that the monoid binary operation is often named "dot" or "times" in english. That does not mean the operator must be `dot`, `times`, (<.>) or (<x>) but at least the doc should provide a single, consistent and pronounceable name for it, whatever its spelling.
That is the problem when changing a function into an operator: the pronunciation. There should be a page somewhere that sums up how to pronounce the most common operators.
= is "bind", ok, but how do you pronounce >> or <*>, for instance?
<*> is "apply", I believe. >> could perhaps be "then", though I haven't seen this anywhere.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Work is punishment for failing to procrastinate effectively.

I like to take a leaf out of Prince's book and refer to it as "the
function formerly known as mappend"
August Sodora
augsod@gmail.com
(201) 280-8138
On Mon, Jul 25, 2011 at 3:22 AM, Paul R
Hi Café,
Thomas> I think (<>) is fairly uncontroversial because: Thomas> (...) Thomas> 2. It's abstract. i.e., no intended pronunciation
How can that be an advantage ? A text flow with unnamed (or unpronounceable) symbols makes reading, understanding and remembering harder, don't you think ? I really think any operator or symbol should be intended (and even designed !) for pronunciation.
Some references state that the monoid binary operation is often named "dot" or "times" in english. That does not mean the operator must be `dot`, `times`, (<.>) or (<x>) but at least the doc should provide a single, consistent and pronounceable name for it, whatever its spelling.
Thomas> For this reason, I think a larger change would have to come with Thomas> a larger library re-organization. Johan Tibell suggested Thomas> something like that a while ago: instead of lots of little cuts Thomas> (backwards incompatible changes), a working group of activists Thomas> should redesign a whole new (incompatible) alternative set of Thomas> core libraries.
This would be a great initiative, really !
-- Paul
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (6)
-
August Sodora
-
Gábor Lehel
-
Paul R
-
Sebastian Fischer
-
Thomas Schilling
-
Yves Parès