
Hello, Data.IntMap (distributed with GHC 6.4.1) contains the following instance: Ord a => Monoid (IntMap a) The instance is defined with mempty = empty, and mappend = union, neither of which requires the Ord instances on the values in the map, so the 'Ord a' constraint appears unneccessary. -Iavor PS: Isn't picking union for the monoid class a little arbitrary?

On 11/28/05, Iavor Diatchki
Hello, Data.IntMap (distributed with GHC 6.4.1) contains the following instance: Ord a => Monoid (IntMap a) The instance is defined with mempty = empty, and mappend = union, neither of which requires the Ord instances on the values in the map, so the 'Ord a' constraint appears unneccessary.
You're right, I seem to be guilty of careless cut and paste from the corresponding code in Data.Map. I will fix that.
-Iavor PS: Isn't picking union for the monoid class a little arbitrary?
Indeed. The problem is that Monoid is very general and classes have global scope. Union seemed like a reasonable definition... If it doesn't fit the algorithm at hand, one can resort to "explicit dictionnary passing" for emulating local instances. Cheers, JP.

It would be useful if one of the nightlies could put up web-browsable documentation for the HEAD libraries. That would make it easier for people who don't follow CVS to spot problems and contribute text between GHC releases.
participants (3)
-
Iavor Diatchki
-
Jean-Philippe Bernardy
-
Ross Paterson