A more useful Monoid instance for Data.Map

John Lato jwlato at gmail.com
Wed Mar 13 01:28:52 CET 2013

-1, I'm against breaking the current Monoid also.

I like Gabriel's solutions, and particularly I'd like to have:

instance (Ord k, Semigroup v) => Monoid (WrappedMap k v) where
    mempty            = empty
    mappend map0 map1 = unionWith <> map0 map1
    mconcat maps      = foldr (unionWith <>) empty maps

but even a Monoid constraint would be useful.

John L.

On Wed, Mar 13, 2013 at 12:59 AM, Gabriel Gonzalez <gabriel439 at gmail.com>wrote:

> -1 on breaking the existing Monoid instance.  I'd prefer either:
> a) A newtype for the additional Monoid instance, or
> b) providing an associative operator equivalent to the new Monoid instance
> I'm not convinced that the replacement instance is more useful, let alone
> useful enough to break everything depending on containers.  A lot of
> packages both on and off Hackage depend on Edward's code, almost all of
> which would break as a result of this change.
> ______________________________**_________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/**mailman/listinfo/libraries<http://www.haskell.org/mailman/listinfo/libraries>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130313/d5b38dcc/attachment.htm>

More information about the Libraries mailing list