[Haskell] duplicate elements in Data.Set

Jean-Philippe Bernardy jeanphilippe.bernardy at gmail.com
Sat Jan 21 18:15:04 EST 2006

I'd say your compare function isn't transitive.

If you can tell it's well behaved, and if you can send me even your
complicated example, I'll look into it.


On 1/21/06, Walter Moreira <gwallter at gmail.com> wrote:
> 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
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell

More information about the Libraries mailing list