DData revision

Ketil Malde ketil+haskell at ii.uib.no
Tue Mar 16 14:20:39 EST 2004

JP Bernardy <jyp_7 at yahoo.com> writes:

> You argued that Eq is (nearly) always
> assumed to be defined by structural equality, so "Bag"
> would be just as good as "MultiSet".

I think you're saying we might need a bag to hold items where we want
to group things according to (equivalence on) some arbitrary key?
Perhaps we could have the bag datatype parametrised over a
user-supplied ordering, so that

        Set a  

would be equivalent to a

        Bag compare a (with compare :: a -> a -> Ordering)

The bag could then hold regular (Eq-based) Sets of items.

Would this make sense?  Would it be useful?

If I haven't seen further, it is by standing in the footprints of giants

More information about the Libraries mailing list