If you wanted to filter the elements that match a pattern, you could use a pattern on the left hand side of the <-
, e.g.
... = [package x | x@(_, ("A", _)) <- xs] : ...
This will throw away anything that doesn't match the pattern.
Filtering elements that don't match a pattern isn't quite as nice. You could do it using a case
expression as a guard, but it gets kind of ugly.
... = [package x | x <- xs, case x of (_,("A", _)) -> False; _ -> True] : ...
A prettier alternative is to move the pattern match into a function.
... = [package x | x <- xs, want x] : ...
where want (_,("A", _)) = False
want _ = True