[commit: ghc] wip/nfs-locking: Keep duplicates in the intersection. (2ec9f84)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:04:53 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/2ec9f84bce2ad28a16802b7ac901685495a6b4ff/ghc

>---------------------------------------------------------------

commit 2ec9f84bce2ad28a16802b7ac901685495a6b4ff
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sun Feb 21 01:27:24 2016 +0000

    Keep duplicates in the intersection.


>---------------------------------------------------------------

2ec9f84bce2ad28a16802b7ac901685495a6b4ff
 src/Base.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Base.hs b/src/Base.hs
index 324feb8..871cd3c 100644
--- a/src/Base.hs
+++ b/src/Base.hs
@@ -157,7 +157,7 @@ minusOrd (x:xs) (y:ys) = case compare x y of
     EQ ->     minusOrd xs ys
     GT ->     minusOrd (x:xs) ys
 
--- Explicit definition to avoid dependency on Data.List.Ordered
+-- Explicit definition to avoid dependency on Data.List.Ordered. TODO: add tests
 -- | Intersection of two ordered lists by a predicate.
 intersectOrd :: (a -> b -> Ordering) -> [a] -> [b] -> [a]
 intersectOrd cmp = loop
@@ -166,7 +166,7 @@ intersectOrd cmp = loop
     loop _ [] = []
     loop (x:xs) (y:ys) = case cmp x y of
         LT ->     loop xs (y:ys)
-        EQ -> x : loop xs ys
+        EQ -> x : loop xs (y:ys)
         GT ->     loop (x:xs) ys
 
 -- | Lookup all elements of a given sorted list in a given sorted dictionary.



More information about the ghc-commits mailing list