Commit 8e812825 authored by Daniel Fischer's avatar Daniel Fischer

Make intersectBy lazier

Add shortcuts to intersectBy for empty list arguments.
In addition to being faster in that case, more inputs yield defined results.
Treats ticket #4323
parent 6cc96ac7
......@@ -410,6 +410,8 @@ intersect = intersectBy (==)
-- | The 'intersectBy' function is the non-overloaded version of 'intersect'.
intersectBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
intersectBy _ [] _ = []
intersectBy _ _ [] = []
intersectBy eq xs ys = [x | x <- xs, any (eq x) ys]
-- | The 'intersperse' function takes an element and a list and
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment