A more useful Monoid instance for Data.Map

Henning Thielemann lemming at henning-thielemann.de
Sat Apr 28 20:31:36 CEST 2012

On Sat, 28 Apr 2012, Evan Laforge wrote:

> On Fri, Apr 27, 2012 at 7:00 PM, Daniel Peebles <pumpkingod at gmail.com> wrote:
>> 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 :/
> Yeah, I suppose it would be a bit more regular that way.  I'm always
> reluctant to map newtypes over things other than lists because I don't
> trust there to be a RULES that will eliminate it, but I suppose for
> Map there must be.  I guess I wouldn't mind updating my code if the
> definition changed.  It's hard to change a general purpose method
> though, simply because searching for it in your code will turn up so
> many false positives.

The version containers-0.6 may not have a Monoid Map instance at all, such 
that all people have to note the change and then containers-0.7 should 
contain the new instance. :-)

More information about the Libraries mailing list