Data.IntMap API

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Data.IntMap API

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.
-Iavor
PS: Isn't picking union for the monoid class a little arbitrary?
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Data.IntMap API

Jean-Philippe Bernardy
On 11/28/05, Iavor Diatchki <[hidden email]> wrote:
> 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.
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Data.IntMap API

Ross Paterson
In reply to this post by Iavor Diatchki
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.

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

RE: Data.IntMap API

Simon Marlow
In reply to this post by Iavor Diatchki
On 29 November 2005 14:00, Ross Paterson wrote:

> 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.

Done; docs for a nightly build will from now on be available from:

http://www.haskell.org/ghc/dist/current/docs/

for HEAD, and

http://www.haskell.org/ghc/dist/stable/docs/

for STABLE.

The HEAD docs now include the Building Guide, which currently isn't
linked from the main title page (I'll fix that):

http://www.haskell.org/ghc/dist/current/docs/building/

I've still to add some links from elsewhere in the GHC site.

Cheers,
        Simon
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries