**intersect**

The intersect function takes the list intersection of two lists. For example,
> [1,2,3,4] `intersect` [2,4,6,8] == [2,4]
If the first list contains duplicates, so will the result.
> [1,2,2,3,4] `intersect` [6,4,4,2] == [2,2,4]
It is a special case of intersectBy, which allows the programmer to supply their own equality test.
Combines two file modes into one that only contains modes that appear in both.

*O(n+m)*. The (left-biased) intersection of two maps (based on keys).
> intersection (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "a"

*O(n+m)*. The intersection of two sets.

*O(n+m)*. The intersection of two sets. The implementation uses an efficient *hedge* algorithm comparable with *hedge-union*. Elements of the result come from the first set, so for example
> import qualified Data.Set as S
> data AB = A | B deriving Show
> instance Ord AB
> instance Eq AB
> main = print (S.singleton A `S.intersection` S.singleton B,
> S.singleton B `S.intersection` S.singleton A)
prints (fromList [A],fromList [B]).

*O(n+m)*. Intersection of two maps. Return data in the first map for the keys existing in both maps. (intersection m1 m2 == intersectionWith const m1 m2). The implementation uses an efficient *hedge* algorithm comparable with *hedge-union*.
> intersection (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "a"
*O(n+m)*. The intersection with a combining function.
> intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA"

*O(n+m)*. Intersection with a combining function. The implementation uses an efficient *hedge* algorithm comparable with *hedge-union*.
> intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA"

*O(n+m)*. The intersection with a combining function.
> let f k al ar = (show k) ++ ":" ++ al ++ "|" ++ ar
> intersectionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "5:a|A"

*O(n+m)*. Intersection with a combining function. The implementation uses an efficient *hedge* algorithm comparable with *hedge-union*.
> let f k al ar = (show k) ++ ":" ++ al ++ "|" ++ ar
> intersectionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "5:a|A"