takeWhile -package:base
Similar to
takeWhile, returns the longest (possibly empty)
prefix of elements satisfying the predicate.
takeWhile, applied to a predicate
p and a ByteString
xs, returns the longest prefix (possibly empty) of
xs of elements that satisfy
p.
Similar to
takeWhile, returns the longest (possibly empty)
prefix of elements satisfying the predicate.
O(n) takeWhile, applied to a predicate
p and a
Text, returns the longest prefix (possibly empty) of elements
that satisfy
p.
O(n) Yield the longest prefix of elements satisfying the
predicate. The current implementation is not copy-free, unless the
result vector is fused away.
Longest prefix of elements that satisfy the predicate
Longest prefix of elements that satisfy the predicate
O(n) Yield the longest prefix of elements satisfying the
predicate. The current implementation is not copy-free, unless the
result vector is fused away.
O(n) Yield the longest prefix of elements satisfying the
predicate. The current implementation is not copy-free, unless the
result vector is fused away.
O(n) Yield the longest prefix of elements satisfying the
predicate. The current implementation is not copy-free, unless the
result vector is fused away.
O(n) Yield the longest prefix of elements satisfying the
predicate. The current implementation is not copy-free, unless the
result vector is fused away.
Consume input as long as the predicate returns
True, and return
the consumed input.
This parser does not fail. It will return an empty string if the
predicate returns
False on the first byte of input.
Note: Because this parser does not fail, do not use it with
combinators such as
many, because such parsers loop until a
failure occurs. Careless use will thus result in an infinite loop.
Consume input as long as the predicate returns
True, and return
the consumed input.
This parser does not fail. It will return an empty string if the
predicate returns
False on the first byte of input.
Note: Because this parser does not fail, do not use it with
combinators such as
many, because such parsers loop until a
failure occurs. Careless use will thus result in an infinite loop.
Consume input as long as the predicate returns
True, and return
the consumed input.
This parser does not fail. It will return an empty string if the
predicate returns
False on the first character of input.
Note: Because this parser does not fail, do not use it with
combinators such as
many, because such parsers loop until a
failure occurs. Careless use will thus result in an infinite loop.
Consume input while the predicate returns
True.
Stream all values downstream that match the given predicate.
Same caveats regarding downstream termination apply as with
take.
takeWhile, applied to a predicate
p and a list
xs, returns the longest prefix (possibly empty) of
xs of elements that satisfy
p.
>>> takeWhile (< 3) [1,2,3,4,1,2,3,4]
[1,2]
>>> takeWhile (< 9) [1,2,3]
[1,2,3]
>>> takeWhile (< 0) [1,2,3]
[]
Take bytes while the @predicate hold from the current position in the
stream
Return all bytes while the predicate returns True.
Since 0.3.0
(takeWhile p) allows values to pass downstream so long as
they satisfy the predicate
p.
takeWhile (pure True) = cat
takeWhile (liftA2 (&&) p1 p2) = takeWhile p1 >-> takeWhile p2
takeWhile p xs returns the longest prefix of the
stream
xs for which the predicate
p holds.