# filter -package:base -package:text -package:bytestring

O(n). Filter all values that satisfy some predicate.
```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
```
O(n). Filter all elements that satisfy some predicate.
O(n). Filter all values that satisfy the predicate.
```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
```
The filter function takes a predicate p and a sequence xs and returns a sequence of those elements which satisfy the predicate.
O(n). Filter all elements that satisfy the predicate.
O(n) Drop all elements that do not satisfy the predicate.
Drop elements which do not satisfy the predicate
Drop elements which do not satisfy the predicate
O(n) Drop all elements that do not satisfy the predicate.
O(n) Drop all elements that do not satisfy the predicate.
O(n) Drop all elements that do not satisfy the predicate.
O(n) Drop all elements that do not satisfy the predicate.
Filter this map by retaining only elements which values satisfy a predicate.
Filter this set by retaining only elements satisfying a predicate.
filter, applied to a predicate and a list, returns the list of those elements that satisfy the predicate; i.e.,
```filter p xs = [ x | x <- xs, p x]
```
```>>> filter odd [1, 2, 3]
[1,3]
```
Filter the entries whose keys are missing from the other map using some Applicative action.
```filterAMissing f = Merge.Lazy.traverseMaybeMissing \$
\k x -> (\b -> guard b *> Just x) <\$> f k x
```
but this should be a little faster.
Filter the entries whose keys are missing from the other map.
```filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing x x
```
```filterMissing f = Merge.Lazy.mapMaybeMissing \$ \k x -> guard (f k x) *> Just x
```
but this should be a little faster.
O(n). Filter all keys/values that satisfy some predicate.
```filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
```
Filter the entries whose keys are missing from the other map using some Applicative action.
```filterAMissing f = Merge.Lazy.traverseMaybeMissing \$
k x -> (b -> guard b *> Just x) \$ f k x
```
but this should be a little faster.
Filter the entries whose keys are missing from the other map.
```filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing k x x
```
```filterMissing f = Merge.Lazy.mapMaybeMissing \$ \k x -> guard (f k x) *> Just x
```
but this should be a little faster.
O(n). Filter all keys/values that satisfy the predicate.
```filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a"
```
O(n) Drop all elements that do not satisfy the monadic predicate.