From 4299243f0470c1892d7472edcd41cd56f41114ce Mon Sep 17 00:00:00 2001
From: sof <unknown>
Date: Tue, 21 Oct 1997 20:31:47 +0000
Subject: [PATCH] [project @ 1997-10-21 20:31:47 by sof] unionBy: remove
 duplicates in second argument (required for the following invariant to hold:
 if the first list argument contain no duplicates, then the result of applying
 unionBy doesn't either)

---
 ghc/lib/required/List.lhs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ghc/lib/required/List.lhs b/ghc/lib/required/List.lhs
index 444b2e90bc2c..d48c5bf9ddf4 100644
--- a/ghc/lib/required/List.lhs
+++ b/ghc/lib/required/List.lhs
@@ -8,7 +8,7 @@
 module List ( 
     {- 
       This list follows the type signatures for the
-      standard List interface.
+      standard List interface.  -- 8/97 
     -}
     elemIndex, elemIndices,
     find, findIndex, findIndices,
@@ -16,10 +16,10 @@ module List (
     delete, deleteBy, (\\), deleteFirstsBy,
     union, unionBy, 
     intersect, intersectBy,
+    intersperse, transpose, partition, 
     group, groupBy,
     inits, tails,
     isPrefixOf, isSuffixOf,
-    intersperse, transpose, partition, 
     mapAccumL, mapAccumR,
     sort, sortBy, 
     insertBy, 
@@ -117,7 +117,7 @@ union			:: (Eq a) => [a] -> [a] -> [a]
 union 			= unionBy (==)
 
 unionBy                 :: (a -> a -> Bool) -> [a] -> [a] -> [a]
-unionBy eq xs ys        =  xs ++ foldl (flip (deleteBy eq)) ys xs
+unionBy eq xs ys        =  xs ++ foldl (flip (deleteBy eq)) (nubBy eq ys) xs
 
 intersect               :: (Eq a) => [a] -> [a] -> [a]
 intersect               =  intersectBy (==)
-- 
GitLab