[containers] Proposal: Change to the Data.Map Monoid

Andreas Abel abela at chalmers.se
Tue May 20 22:23:44 UTC 2014


On 21.05.2014 00:10, Joachim Breitner wrote:
> Am Dienstag, den 20.05.2014, 17:47 -0400 schrieb Edward Kmett:
>> -1 from me as well, though it is a much softer -1 than on the just breaking everyone silently by changing it.
>>
>> _Lots_ of users initialize empty maps with mempty

Well, this is another issue, empty should be overloaded via

class Empty a where
   empty :: a

but Edward does not like classes without laws.

> no problem, let’s replace it with
>
> instance (Ord k) => Monoid (Map k v) where
>       mempty  = empty
>       mappend = error "do not use Monoid (Map k v), it is ambiguous"

That should be a compile-time error, please!

;-)

> Greetings,
> Joachim
>
> PS: No, I’m not serious.


-- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Department of Computer Science and Engineering
Chalmers and Gothenburg University, Sweden

andreas.abel at gu.se
http://www2.tcs.ifi.lmu.de/~abel/


More information about the Libraries mailing list