|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 - 3 - 4 | Next > |
|
|
Monoid wants a (++) equivalentI'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 |
|
|
Re: Monoid wants a (++) equivalentI love the idea, but its tricky to come up with one that is good that won't break a lot of user code that imports Data.Monoid unqualified.
-Edward Kmett
On Tue, Jun 30, 2009 at 12:45 PM, Bryan O'Sullivan <bos@...> 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 |
|
|
|
|
|
Re: Monoid wants a (++) equivalentIsn't "++" itself the perfect Monoid operator? Lambdabot seems to think so.
On Tue, Jun 30, 2009 at 13:04, Edward Kmett<ekmett@...> wrote: > I love the idea, but its tricky to come up with one that is good that won't > break a lot of user code that imports Data.Monoid unqualified. > -Edward Kmett > > On Tue, Jun 30, 2009 at 12:45 PM, Bryan O'Sullivan <bos@...> > 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 |
|
|
Re: Monoid wants a (++) equivalentOn Tue, Jun 30, 2009 at 10:04 AM, Bryan O'Sullivan <bos@...> wrote:
Yeah the textual name doesn't help one bit. Much like "return" confuses folks in Monads. However, I think most people learn Haskell in stages where ++ is introduced as an append operation *before* they even come across the term "Monoid". I feel that though this may have a lesser degenerative impact on the newbie's ability to learn Monoids, that it still contributes to the confusion a bit.
Then again, anyone who's had to deal with overloaded operators in any language should learn never to assume anything about overloaded operators... Dave
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentExcept that in this case the operator is associative :P
On Tue, Jun 30, 2009 at 2:42 PM, David Leimbach<leimy2k@...> wrote: > > > On Tue, Jun 30, 2009 at 10:04 AM, Bryan O'Sullivan <bos@...> > wrote: >> >> On Tue, Jun 30, 2009 at 9:50 AM, David Leimbach <leimy2k@...> wrote: >>> >>> I actually worry that this will make people think, more incorrectly, that >>> Monoids are about appending stuff only. >> >> I think that adding a graphical operator as a synonym for mappend would >> actually help to address that, since the magic word "append" would no longer >> be nearly as common in source code, and that textual name certainly is >> (unhelpfully) suggestive of a specific semantics. > > Yeah the textual name doesn't help one bit. Much like "return" confuses > folks in Monads. However, I think most people learn Haskell in stages where > ++ is introduced as an append operation *before* they even > come across the term "Monoid". I feel that though this may have a lesser degenerative impact on the newbie's ability to learn Monoids, that it still contributes to the confusion a bit. > Then again, anyone who's had to deal with overloaded operators in any language should learn never to assume anything about 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 (++) equivalentOn Tue, Jun 30, 2009 at 09:45:45AM -0700, 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. +1. IIRC Jules Bean has proposed using (+>) for this purpose, which I like. It has the advantages of (a) not clashing with any other (common) operators, (b) making more obvious the fact that mappend is not necessarily commutative, and (c) providing the obvious (<+) for 'flip mappend' which is sometimes useful. -Brent _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentOn Tue, Jun 30, 2009 at 11:54 AM, Brent Yorgey <byorgey@...> wrote:
I actually think this proposal is pretty excellent.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentAm Dienstag 30 Juni 2009 20:56:10 schrieb David Leimbach:
> On Tue, Jun 30, 2009 at 11:54 AM, Brent Yorgey <byorgey@...>wrote: > > On Tue, Jun 30, 2009 at 09:45:45AM -0700, 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. > > > > +1. > > > > IIRC Jules Bean has proposed using (+>) for this purpose, which I > > like. It has the advantages of (a) not clashing with any other > > (common) operators, (b) making more obvious the fact that mappend is > > not necessarily commutative, and (c) providing the obvious (<+) for > > 'flip mappend' which is sometimes useful. > > I actually think this proposal is pretty excellent. I actually think your assessment of the proposal is correct. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentOn 30 Jun 2009, at 22:19, Daniel Fischer wrote: > Am Dienstag 30 Juni 2009 20:56:10 schrieb David Leimbach: >> On Tue, Jun 30, 2009 at 11:54 AM, Brent Yorgey <byorgey@... >> >wrote: >>> On Tue, Jun 30, 2009 at 09:45:45AM -0700, 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. >>> >>> +1. >>> >>> IIRC Jules Bean has proposed using (+>) for this purpose, which I >>> like. It has the advantages of (a) not clashing with any other >>> (common) operators, (b) making more obvious the fact that mappend is >>> not necessarily commutative, and (c) providing the obvious (<+) for >>> 'flip mappend' which is sometimes useful. >> >> I actually think this proposal is pretty excellent. > > I actually think your assessment of the proposal is correct. I excellently think your proposal is a correct assessment. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentOn Tue, Jun 30, 2009 at 1:33 PM, Thomas Davie <tom.davie@...> wrote:
I excellently think your proposal is a correct assessment. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentOn Tue, Jun 30, 2009 at 02:54:38PM -0400, Brent Yorgey wrote:
> On Tue, Jun 30, 2009 at 09:45:45AM -0700, 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. > > +1. > > IIRC Jules Bean has proposed using (+>) for this purpose, which I > like. It has the advantages of (a) not clashing with any other > (common) operators, (b) making more obvious the fact that mappend is > not necessarily commutative, and (c) providing the obvious (<+) for > 'flip mappend' which is sometimes useful. (+>) seems to imply to me that the operator is non-associative. Something like (<>) or (<+>) would be better. John -- John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentOn Tue, Jun 30, 2009 at 11:39 PM, John Meacham<john@...> wrote:
> > (+>) seems to imply to me that the operator is non-associative. Something > like (<>) or (<+>) would be better. > It's too similar to the applicative (*>), and implies all sorts of things like different types of the two arguments and so on. D -- Dougal Stanton dougal@... // http://www.dougalstanton.net _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentOn Tue, Jun 30, 2009 at 3:50 PM, Dougal Stanton <ithika@...> wrote:
If you have comments like the above, please add them to the Trac ticket. Speaking for myself, I'll be happiest to give weight to comments that suggest alternative operators. Thanks, Bryan. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentOn Tue, Jun 30, 2009 at 03:39:39PM -0700, John Meacham wrote:
> (+>) seems to imply to me that the operator is non-associative. It does seem to imply some asymmetry between the arguments. > Something like (<>) or (<+>) would be better. (<+>) is used in Control.Arrow. (<>) is used in Data.Sequence, but as the mappend for Seq a; it could be stolen and generalized. (So could empty, for that matter.) _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentOn Tue, Jun 30, 2009 at 3:56 PM, Ross Paterson <ross@...> wrote:
Well, the canonical instance of Monoid is to mappend over lists, where it doesn't commute, so I think that the pointiness of the operator makes a reasonable kind of sense. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentDavid Leimbach wrote: > > > On Tue, Jun 30, 2009 at 11:54 AM, Brent Yorgey <byorgey@... > <mailto:byorgey@...>> wrote: > > On Tue, Jun 30, 2009 at 09:45:45AM -0700, 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. > > +1. > > IIRC Jules Bean has proposed using (+>) for this purpose, which I > like. It has the advantages of (a) not clashing with any other > (common) operators, (b) making more obvious the fact that mappend is > not necessarily commutative, and (c) providing the obvious (<+) for > 'flip mappend' which is sometimes useful. > > > I actually think this proposal is pretty excellent. -- Tony Morris http://tmorris.net/ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentBut we don't want to imply it's commutative either. Having something
"bidirectional" like <> or <+> feels more commutative than associative to me. On Tue, Jun 30, 2009 at 6:39 PM, John Meacham<john@...> wrote: > On Tue, Jun 30, 2009 at 02:54:38PM -0400, Brent Yorgey wrote: >> On Tue, Jun 30, 2009 at 09:45:45AM -0700, 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. >> >> +1. >> >> IIRC Jules Bean has proposed using (+>) for this purpose, which I >> like. It has the advantages of (a) not clashing with any other >> (common) operators, (b) making more obvious the fact that mappend is >> not necessarily commutative, and (c) providing the obvious (<+) for >> 'flip mappend' which is sometimes useful. > > (+>) seems to imply to me that the operator is non-associative. Something > like (<>) or (<+>) would be better. > > > John > > -- > John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/ > _______________________________________________ > 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 (++) equivalentOn 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. 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. John -- John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Monoid wants a (++) equivalentOk. When nobody can agree on a graphical operator can it be
shortened to "mop" and "munit"? (Personally I'm for (++). (Yeah, I know.)) -ljr 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. > > On Tue, Jun 30, 2009 at 6:39 PM, John Meacham<john@...> wrote: >> On Tue, Jun 30, 2009 at 02:54:38PM -0400, Brent Yorgey wrote: >>> On Tue, Jun 30, 2009 at 09:45:45AM -0700, 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. >>> +1. >>> >>> IIRC Jules Bean has proposed using (+>) for this purpose, which I >>> like.  It has the advantages of (a) not clashing with any other >>> (common) operators, (b) making more obvious the fact that mappend is >>> not necessarily commutative, and (c) providing the obvious (<+) for >>> 'flip mappend' which is sometimes useful. >> (+>) seems to imply to me that the operator is non-associative. Something >> like (<>) or (<+>) would be better. >> >> >>     John >> >> -- >> John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/ >> _______________________________________________ >> 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 |
| < Prev | 1 - 2 - 3 - 4 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |