[Haskell] Re: RFC: DData in hierarchical libraries

JP Bernardy jyp_7 at yahoo.com
Wed Mar 10 15:40:15 EST 2004


--- Christian Maeder <maeder at tzi.de> wrote:
> Simon Marlow wrote:
> > Why are there IntBags but no Bags?
> 
> As I've said before, rename MultiSet to Bag.

Daan's remark about the difference between bags and
multisets is:

"
A multi set differs from a /bag/ in the sense that it
is represented as a map from elements to occurrence
counts instead of retaining all elements. This means
that equality on elements should be defined as a
/structural/ equality instead of an equivalence
relation.   If this is not the  case, operations that
observe the elements, like 'filter' and 'fold', 
should be used with care.
"

Yet it can be argued that Eq is (nearly) always
assumed to be defined by structural equality, so "Bag"
would be just as good as "MultiSet".
Since a true "Bag" type may be added later, I did not
bother to change the name.

> > Internal functions like DData.Set.valid should not
> be visible.
> 
> "valid" may be useful for debugging purposes if
> certain (for efficiency 
> reasons unsafe) functions like "fromDistinctAscList"
> may produce invalid 
> representations (if the argument is not strictly
> ascending). But I don't 
> know if this is the case.

Indeed. Maybe the best is just to rename the function
to a name less likely to clash.

Cheers,
JP.

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com


More information about the Haskell mailing list