collecting requirements for FDs

Jean-Philippe Bernardy jeanphilippe.bernardy at gmail.com
Wed Apr 12 04:43:41 EDT 2006


Hello,

I just moved the documentation (still accessible from the below wiki
page) to here:

http://users.skynet.be/jyp/html/collections/Data.Collections.html
the source being:
http://darcs.haskell.org/packages/collections/Data/Collections.hs

And, since you asked for it, there is something I think would be nice to have.

As you may have found out by reading the above documentation, I've
been trying to put Sets and Maps into the same class-framework. (Or,
to put differently, unify collections and associative collections).
The result of this, as Jim said, is I get two range parameters:

class Map m k a | m -> k a where ...

The value type for sets being ().

instance Map IntSet Int () where ...

This is all very well, except that it complexifies some type contexts,
and is also a bit restrictive in some respects: intersectionWith must
have type (a -> a -> a) -> m -> m -> m, instead of (a -> b -> c) -> m
a -> m b -> m c, if Map was (partially) a constructor class.

One way to reconcile both approaches would be to have both classes:

class Map m k a | m -> k a where ...
class Map_ m k | m -> k where ...

In order to avoid redundancy though, I'd wish to relate the classes like this:

class Map (m a) k a => Map_ m k | m -> k where ...

This is rejected by GHC, and I suspect every current haskell
implementation. Before you ask, I haven't worked out the implications
in terms of confluence. But I thought I might just as well express my
wish. :)

Cheers,
JP.

On 4/11/06, Jim Apple <jbapple+haskell-prime at gmail.com> wrote:
> On 4/10/06, Ross Paterson <ross at soi.city.ac.uk> wrote:
> > What other libraries should Haskell' support, and what are their
> > requirements?
>
> http://hackage.haskell.org/trac/ghc/wiki/CollectionClassFramework
>
> There are two "range arguments" here, IIUC.
>
> Jim
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at haskell.org
> http://haskell.org/mailman/listinfo/haskell-prime
>


More information about the Haskell-prime mailing list