filter -package:base -is:exact -package:Cabal -package:hedgehog -is:exact -package:aeson -package:containers
O(n) filter, applied to a predicate and a ByteString,
returns a ByteString containing those characters that satisfy the
predicate.
O(n) filter, applied to a predicate and a ByteString,
returns a ByteString containing those characters that satisfy the
predicate.
O(n) filter, applied to a predicate and a
ShortByteString, returns a ShortByteString containing those characters
that satisfy the predicate.
O(n) filter, applied to a predicate and a
Text,
returns a
Text containing those characters that satisfy the
predicate.
O(n) filter, applied to a predicate and a stream,
returns a stream containing those characters that satisfy the
predicate.
Properties
unstream . filter p . stream = filter p
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.
Keep only values in the stream passing a given predicate.
Subject to fusion
Keep only values in the stream passing a given predicate.
Subject to fusion
Since 0.3.0
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 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
Filter all elements that satisfy some predicate.
(filter predicate) only forwards values that satisfy the
predicate.
filter (pure True) = cat
filter (liftA2 (&&) p1 p2) = filter p1 >-> filter p2
filter f = mapMaybe (\a -> a <$ guard (f a))