Proposal #3339: Add (+>) as a synonym for mappend

Sebastian Fischer fischer at nii.ac.jp
Mon Aug 15 16:43:01 CEST 2011


Hi Yitzchak,

On Mon, Aug 15, 2011 at 7:14 PM, Yitzchak Gale <gale at sefer.org> wrote:

> Edward Kmett wrote:
> > if (<>) is just a method exported by the module then the packages I have
> > that import just Monoid(..) from Data.Monoid won't change.
>
> Hmm, why not? If two different functions named <> are imported
> via Monoid(..) and Semigroup(..), I don't think the compiler
> will find that humorous.


The proposal is not to replace 'mappend' in the Monoid class with <>. The
proposal is to add the top-level definition

    (<>) = mappend

to Data.Monoid. Importing Monoid(..) does not import the new <> and people
who import (or define) another definition of <> can hide the new operator
from Data.Monoid.

I am also facing days of tedious work to dig out of this.
> I would love to find automation opportunities, but I don't understand
> how what you are suggesting can help.


If you already use explicit imports, then you don't need to change anything.
If you don't, you can replace

    import Data.Monoid

with

    import Data.Monoid hiding ((<>))

or, for backwards compatibility, with an import statement that imports
explicitly what you use.

Sorry, if that was obvious to you..

Best regards,
Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110815/d4843e77/attachment-0001.htm>


More information about the Libraries mailing list