Monoid wants a (++) equivalent

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 - 3 - 4 | Next >

Re: Monoid wants a (++) equivalent

by ajb-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

G'day all.

Quoting John Meacham <john@...>:

> (+>) seems to imply to me that the operator is non-associative. Something
> like (<>) or (<+>) would be better.

I tend to agree.  Moreover, and I realise this may be a losing battle,
I want (++) to be the generic operator.

I understand the argument.  I even agreed with it at the time.  In 1998,
academic use of Haskell (both for research and education) was the most
important imperative.

Today, Haskell is officially cool, so the good names and operators should
not be stolen by operations that are distinguished only by being less
useful (e.g. by working on lists alone).

Cheers,
Andrew Bromage
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by ajb-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

G'day all.

On Tue, Jun 30, 2009 at 08:02:48PM -0400, Daniel Peebles wrote:

> But we don't want to imply it's commutative either. Having something
> "bidirectional" like <> or <+> feels more commutative than associative
> to me.

Quoting John Meacham <john@...>:

> Not really, think of '++', which doesn't commute but is visually
> symmetric, or Data.Sequence.<>, or the common use of <> to mean
> concatination in pretty printers.

Other good examples are && and ||.

Cheers,
Andrew Bromage
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Ketil Malde-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


You know, this might be the right time to start expanding our
vocabulary beyond seven bits.  Since we're likely to keep mappend
around as an alias for some time, people would have a grace period to
adjust.

How about U+2295 (circle with plus inside it)?

Or, if we would like to stick to the 8-bit subset to keep those 8859-1
users happy, how about ¤ (funny circle over an x, U+00A4)

-k
--
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Alex Dunlap :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jun 30, 2009 at 11:24 PM, Ketil Malde<ketil@...> wrote:

>
> You know, this might be the right time to start expanding our
> vocabulary beyond seven bits.  Since we're likely to keep mappend
> around as an alias for some time, people would have a grace period to
> adjust.
>
> How about U+2295 (circle with plus inside it)?
>
> Or, if we would like to stick to the 8-bit subset to keep those 8859-1
> users happy, how about ¤ (funny circle over an x, U+00A4)
>
> -k
> --
> If I haven't seen further, it is by standing in the footprints of giants
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@...
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

The major disadvantage of that is that those symbols are not on my
keyboard and thus are more of a pain to type, especially on the Linux
console where compose key is not available...

Alex
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Jochem Berndsen-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ajb@... wrote:
> G'day all.
>
> Quoting John Meacham <john@...>:
>
>> (+>) seems to imply to me that the operator is non-associative. Something
>> like (<>) or (<+>) would be better.
>
> I tend to agree.  Moreover, and I realise this may be a losing battle,
> I want (++) to be the generic operator.

I totally agree. (+>) is too asymmetric for my taste, like (>>=) and
(*>) it suggests asymmetry between the arguments. (++) is symmetric and
suggests an associative operator to me.

--
Jochem Berndsen | jochem@...
GPG: 0xE6FABFAB
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by david48 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 1, 2009 at 9:34 AM, Jochem Berndsen<jochem@...> wrote:
> ajb@... wrote:

>> I tend to agree.  Moreover, and I realise this may be a losing battle,
>> I want (++) to be the generic operator.

> I totally agree.

So do I.

David.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Duncan Coutts :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-06-30 at 18:31 -0700, John Meacham wrote:
> On Tue, Jun 30, 2009 at 08:02:48PM -0400, Daniel Peebles wrote:
> > But we don't want to imply it's commutative either. Having something
> > "bidirectional" like <> or <+> feels more commutative than associative
> > to me.

Of course in Text.PrettyPrint, both <> and <+> are associative but not
commutative (with identity empty).

> Not really, think of '++', which doesn't commute but is visually
> symmetric, or Data.Sequence.<>, or the common use of <> to mean
> concatination in pretty printers. I think there is a fair amount of
> precedence for using '<>' actually. As it appears when it is used, it
> is also the natural mappend operator for the Monoid instance.

I agree, if we can't use ++ then <> is the next best thing. As John says
it's already a monoid operator for Data.Sequence and Text.PrettyPrint.

Duncan

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Jules Bean :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Duncan Coutts wrote:
> I agree, if we can't use ++ then <> is the next best thing. As John says
> it's already a monoid operator for Data.Sequence and Text.PrettyPrint.
>

I agree, if we can't use +> and <+ then <> is the next best thing.

;)

Jules
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by david48 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 1, 2009 at 2:18 PM, Jules Bean<jules@...> wrote:

> Duncan Coutts wrote:

>> I agree, if we can't use ++ then <> is the next best thing. As John says
>> it's already a monoid operator for Data.Sequence and Text.PrettyPrint.

> I agree, if we can't use +> and <+ then <> is the next best thing.

> ;)

I see what you did there :-P
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Brent Yorgey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 01, 2009 at 12:00:50AM -0400, ajb@... wrote:

> G'day all.
>
> On Tue, Jun 30, 2009 at 08:02:48PM -0400, Daniel Peebles wrote:
>
>> But we don't want to imply it's commutative either. Having something
>> "bidirectional" like <> or <+> feels more commutative than associative
>> to me.
>
> Quoting John Meacham <john@...>:
>
>> Not really, think of '++', which doesn't commute but is visually
>> symmetric, or Data.Sequence.<>, or the common use of <> to mean
>> concatination in pretty printers.
>
> Other good examples are && and ||.

..wha?  But those ARE commutative.  Unless you mean with respect to
strictness?

-Brent
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by edwardk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm rather fond of the (<>) suggestion, but would be happy with anything better than mappend! ;)
 
-Ed

On Wed, Jul 1, 2009 at 8:56 AM, Brent Yorgey <byorgey@...> wrote:
On Wed, Jul 01, 2009 at 12:00:50AM -0400, ajb@... wrote:
> G'day all.
>
> On Tue, Jun 30, 2009 at 08:02:48PM -0400, Daniel Peebles wrote:
>
>> But we don't want to imply it's commutative either. Having something
>> "bidirectional" like <> or <+> feels more commutative than associative
>> to me.
>
> Quoting John Meacham <john@...>:
>
>> Not really, think of '++', which doesn't commute but is visually
>> symmetric, or Data.Sequence.<>, or the common use of <> to mean
>> concatination in pretty printers.
>
> Other good examples are && and ||.

..wha?  But those ARE commutative.  Unless you mean with respect to
strictness?

-Brent
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Thomas Davie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 1 Jul 2009, at 16:46, Edward Kmett wrote:

> I'm rather fond of the (<>) suggestion, but would be happy with  
> anything better than mappend! ;)

I find it rather ugly, it has a lot of connotations of "does not  
equals" from other languages.  Personally I'm in favor of <+>, simply  
because it looks most like a circle with a plus in it.

Bob
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Jason Dagit-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Wed, Jul 1, 2009 at 7:53 AM, Thomas Davie <tom.davie@...> wrote:

On 1 Jul 2009, at 16:46, Edward Kmett wrote:

I'm rather fond of the (<>) suggestion, but would be happy with anything better than mappend! ;)

I find it rather ugly, it has a lot of connotations of "does not equals" from other languages.  Personally I'm in favor of <+>, simply because it looks most like a circle with a plus in it.

This is my favorite of the suggestions as well.  Then again, I don't mind typing mappend.  Yay for bikesheds :)

Jason

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Martijn van Steenbergen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I suggest you all add your name and vote here:

    http://doodle.com/4yrfd7qaw5man3rm

Perhaps we'll find one of the options is clearly in favor.

Martijn.


Bryan O'Sullivan wrote:

> I've thought for a while that it would be very nice indeed if the Monoid
> class had a more concise operator for infix appending than "a `mappend`
> b". I wonder if other people are of a similar opinion, and if so,
> whether this is worth submitting a libraries@ proposal over.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@...
> http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Robert Greayer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm sure there's some important historical reason... but why isn't '&'
used in something more prominent than the fgl package?  I understand
why it's not used for bitwise AND in Data.Bits (I assume because the
corresponding bitwise '|' operator isn't available), but all the other
single-character operators** (in the ASCII range) are used in some
core library (if not the Prelude itself).  But not '&'.  Why?  It
makes sense (to me) as a Monoid 'append'.

** - according to Hoogle

On Wed, Jul 1, 2009 at 10:46 AM, Edward Kmett<ekmett@...> wrote:

> I'm rather fond of the (<>) suggestion, but would be happy with anything
> better than mappend! ;)
>
> -Ed
>
> On Wed, Jul 1, 2009 at 8:56 AM, Brent Yorgey <byorgey@...> wrote:
>>
>> On Wed, Jul 01, 2009 at 12:00:50AM -0400, ajb@... wrote:
>> > G'day all.
>>
>> >
>> > On Tue, Jun 30, 2009 at 08:02:48PM -0400, Daniel Peebles wrote:
>> >
>> >> But we don't want to imply it's commutative either. Having something
>> >> "bidirectional" like <> or <+> feels more commutative than associative
>> >> to me.
>> >
>> > Quoting John Meacham <john@...>:
>> >
>> >> Not really, think of '++', which doesn't commute but is visually
>> >> symmetric, or Data.Sequence.<>, or the common use of <> to mean
>> >> concatination in pretty printers.
>> >
>> > Other good examples are && and ||.
>>
>> ..wha?  But those ARE commutative.  Unless you mean with respect to
>> strictness?
>>
>> -Brent
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe@...
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@...
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Ross Paterson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 01, 2009 at 04:53:05PM +0200, Thomas Davie wrote:
>
> On 1 Jul 2009, at 16:46, Edward Kmett wrote:
>
>> I'm rather fond of the (<>) suggestion, but would be happy with  
>> anything better than mappend! ;)
>
> I find it rather ugly, it has a lot of connotations of "does not equals"
> from other languages.

Forget Pascal: think of it as a diamond.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by David Leimbach :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Wed, Jul 1, 2009 at 5:18 AM, Jules Bean <jules@...> wrote:
Duncan Coutts wrote:
I agree, if we can't use ++ then <> is the next best thing. As John says
it's already a monoid operator for Data.Sequence and Text.PrettyPrint.


I agree, if we can't use +> and <+ then <> is the next best thing.

;)

Jules
I like this thinking as well.  I kind of wish Haskell didn't overload operators to begin with but oh well :-)

Just because the compiler can figure out what I mean because it has a great type system, I might not be able to figure out what I mean a year from now if I see ++ everywhere.

In some sense, I prefer misleading function names to overly overloaded operators.

Dave
 

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Bryan O'Sullivan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 1, 2009 at 3:38 AM, Duncan Coutts <duncan.coutts@...> wrote:

I agree, if we can't use ++ then <> is the next best thing.

Okay, here's a tentative plan that will help to figure out the answer. I'll build a fiddled base package that rewires the Monoid class to have (++) be the binary operator, and mappend as a synonym for it. I'll import the Monoid (++) into the Prelude. I'll see how much breaks. If that much builds smoothly, I'll see how much of the rest of Hackage builds, both with and without this custom base package. I'll follow up here with the results, along with a suggestion of how acceptable I think the observed level of breakage is.

Seem reasonable?

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by David Leimbach :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Wed, Jul 1, 2009 at 10:55 AM, Bryan O'Sullivan <bos@...> wrote:
On Wed, Jul 1, 2009 at 3:38 AM, Duncan Coutts <duncan.coutts@...> wrote:

I agree, if we can't use ++ then <> is the next best thing.

Okay, here's a tentative plan that will help to figure out the answer. I'll build a fiddled base package that rewires the Monoid class to have (++) be the binary operator, and mappend as a synonym for it. I'll import the Monoid (++) into the Prelude. I'll see how much breaks. If that much builds smoothly, I'll see how much of the rest of Hackage builds, both with and without this custom base package. I'll follow up here with the results, along with a suggestion of how acceptable I think the observed level of breakage is.

Seem reasonable?

It's more reasonable than sitting around waxing philosophical on the notation I suppose :-)
 


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Monoid wants a (++) equivalent

by Ross Paterson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 01, 2009 at 10:55:39AM -0700, Bryan O'Sullivan wrote:
> Okay, here's a tentative plan that will help to figure out the answer. I'll
> build a fiddled base package that rewires the Monoid class to have (++) be the
> binary operator, and mappend as a synonym for it. I'll import the Monoid (++)
> into the Prelude. I'll see how much breaks. If that much builds smoothly, I'll
> see how much of the rest of Hackage builds, both with and without this custom
> base package. I'll follow up here with the results, along with a suggestion of
> how acceptable I think the observed level of breakage is.

Generalizing (++) will break some Haskell 98 code, e.g.

  append = (++)

I think that's a show-stopper.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe
< Prev | 1 - 2 - 3 - 4 | Next >