There's a remark at the beginning of 7.2 that says:
delete, (\\), union and intersect preserve the invariant=20 that lists don't contain duplicates, provided that=20 their first argument contains no duplicates.
The same applies to unionBy etc. This design is one you might reasonably disagree with. I'd have thought it would be more sensible to have the invariant that *both* arguments to union and intersect are assumed to be sets (no dups).
That's partly what I was alluding to, but either way I'd have thought that there were clearer definitions, for example: unionBy eq xs ys = xs ++ [y | y <- nubBy eq ys, not (any (eq y) xs)] Jón -- Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk 31 Chalmers Road jf@cl.cam.ac.uk Cambridge CB1 3SZ +44 1223 570179 (after 14:00 only, please!)