filter -package:Cabal -package:unordered-containers -package:base -package:vector -is:exact -package:regex-tdfa -package:hedgehog -package:base-compat -package:pipes
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
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 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.
Filter all elements that satisfy the predicate.
Filter all keys/values that satisfy some 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.
Drops chunks from an input stream if they fail to match a given filter
predicate. See
filter.
Items pushed back to the returned stream are propagated back upstream.
Example:
ghci> Streams.fromList ["the", "quick", "brown", "fox"] >>=
Streams.filter (/= "brown") >>= Streams.toList
["the","quick","fox"]
Skip elements of a stream that fail a predicate
Filter this map by retaining only elements which values
satisfy a predicate.
Filter this set by retaining only elements satisfying a
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
filter p xs removes any elements from
xs that
do not satisfy
p.