A more useful Monoid instance for Data.Map

Herbert Valerio Riedel hvr at gnu.org
Sun Jan 6 11:15:46 CET 2013


Roman Cheplyaka <roma at ro-che.info> 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)

?

cheers,
  hvr



More information about the Libraries mailing list