[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / compiler / utils / ListSetOps.lhs
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
3 %
4 \section[ListSetOps]{Set-like operations on lists}
5
6 \begin{code}
7 module ListSetOps (
8         unionLists,
9         --UNUSED: intersectLists,
10         minusList
11
12    ) where
13
14 #include "HsVersions.h"
15
16 import Util     ( isn'tIn )
17 import List     ( union )
18 \end{code}
19
20 \begin{code}
21 unionLists :: (Eq a) => [a] -> [a] -> [a]
22 unionLists = union
23 \end{code}
24
25 Everything in the first list that is not in the second list:
26 \begin{code}
27 minusList :: (Eq a) => [a] -> [a] -> [a]
28 minusList xs ys = [ x | x <- xs, x `not_elem` ys]
29   where
30     not_elem = isn'tIn "minusList"
31
32 \end{code}