filter p xs = [ x | x <- xs, p x]
>>> filter odd [1, 2, 3] [1,3]
>>> filter (\l -> length l > 3) ["Hello", ", ", "World", "!"] ["Hello","World"]
>>> filter (/= 3) [1, 2, 3, 4, 3, 2, 1] [1,2,4,2,1]
filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b" filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty
filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b" filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty
filter p xs = [ x | x <- xs, p x]
>>> filter odd [1, 2, 3] [1,3]
filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b" filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty