[Haskell] duplicate elements in Data.Set

Walter Moreira gwallter at gmail.com
Sat Jan 21 17:32:09 EST 2006


Hello list. Are there situations where a set can contain duplicate
elements?

I have a newtype and it is an instance of 'Eq' via the 'compare' method,
and it is also an instance of 'Ord'. After some Data.Set operations
with sets of that type I get a set which contains two elements which
compare equal. What am I doing wrong?

The function 'Set.valid' returns 'False' when applied to the set. I
use the function 'Set.fromList' sometimes. Is it supposed to always
yield a valid set? or it may depend on the order or equality?

Sorry the question is a little vague. When I try to construct small
examples the problem disappear.

Thanks,
Walter


More information about the Haskell mailing list