A more useful Monoid instance for Data.Map

Daniel Peebles pumpkingod at gmail.com
Sat Apr 28 04:00:45 CEST 2012

Why not be explicit about the replacement strategy by injecting your values
into First/Last? My point is that in terms of functionality, using mappend
on the values is strictly more general than the current instance. It seems
unfortunate to be stuck with the current instance for historical reasons,
but I guess that's how a lot of this stuff works :/

On Fri, Apr 27, 2012 at 9:52 PM, Evan Laforge <qdunkan at gmail.com> wrote:

> > I realize that changing instances could break code, but I'd be curious to
> > see how many people even use the current monoid instance. Does anyone
> have
> > any system for testing hypotheses like this (by typechecking a large
> > randomized chunk of hackage or something)?
> I use both definitions.  I have some data types where new values
> should replace old ones, and some where the values themselves should
> be joined.  I do the latter with a utility function 'Map.mappend =
> Map.unionWith Monoid.mappend'.
> I think both definitions are useful and switching one for the other
> would just break a lot of code without a lot of benefit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20120427/d928bae2/attachment.htm>

More information about the Libraries mailing list