Proposal: Remove Semigroup and Monoid instances for Data.Map, Data.IntMap, Data.HashMap

Mario Blažević mblazevic at stilo.com
Wed Feb 14 14:47:55 UTC 2018


On 2018-02-14 04:08 AM, Evan Laforge wrote:
> On Wed, Feb 14, 2018 at 12:49 AM, Akio Takano <tkn.akio at gmail.com> wrote:
>> I'm against this proposal because I think the improvement is, if not
>> negative, too small to justify breaking existing code.
> 
> I agree for the same reasons.
> 
> I also find that unions is the most common.  In my code, I have many
> uses of (<>) with the union meaning... it's hard to grep for, but I
> guess in the 40-80 range.  Meanwhile, I have a Util.Map.mappend that
> also mappends the values, and it's used in 2 places (out of around
> 140k lines).  It wouldn't be so bad to have to convert them all to
> Map.union, but doesn't seem worth the bother either.

	I understand it's hard to grep, but can you guess how many of those 
40-80 uses of (<>) with the union meaning actually depend on the 
left-biased semantics? I've looked at my code, and it turns out that 
wherever this operation appears, the two maps are guaranteed to have 
distinct keys.

	There is actually one use I'm not sure about, I'll have to make sure 
there's no bug hiding there. That is one reason I'm supporting the 
proposal, by the way: the existing behaviour that silently drops values 
is much more likely to cause bugs.


More information about the Libraries mailing list