
6 Jan
2013
6 Jan
'13
5:20 a.m.
* Herbert Valerio Riedel
Roman Cheplyaka
writes: But there's another problem... The "right" instance should really be based on Semigroup, not Monoid, but Semigroup is not currently in the base. And adding a dependency on semigroups to containers is hardly an option.
just to be clear, do you propose the instance to read
instance (Ord k, Semigroup v) => Monoid (Map k v)
or rather
instance (Ord k, Semigroup v) => Semigroup (Map k v)
The former, where mempty = Map.empty. (But the latter would also be present, since every monoid is (mathematically) a semigroup.) Roman