span package:rio

span p xs breaks the ByteString into two segments. It is equivalent to (takeWhile p xs, dropWhile p xs)
span, applied to a predicate p and a list xs, returns a tuple where first element is longest prefix (possibly empty) of xs of elements that satisfy p and second element is the remainder of the list:
span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4])
span (< 9) [1,2,3] == ([1,2,3],[])
span (< 0) [1,2,3] == ([],[1,2,3])
span p xs is equivalent to (takeWhile p xs, dropWhile p xs)
span p xs returns the longest prefix of xs that satisfies p, together with the remainder of the stream.
'span' p xs == ('takeWhile' p xs, 'dropWhile' p xs)
xs == ys ++ zs where (ys, zs) = 'span' p xs
O(n) span, applied to a predicate p and text t, returns a pair whose first element is the longest prefix (possibly empty) of t of elements that satisfy p, and whose second is the remainder of the list.
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.
O(n) Split the vector into the longest prefix of elements that satisfy the predicate and the rest without copying.
spanEnd behaves like span but from the end of the ByteString. We have
spanEnd (not.isSpace) "x y z" == ("x y ","z")
and
spanEnd (not . isSpace) ps
==
let (x,y) = span (not.isSpace) (reverse ps) in (reverse y, reverse x)
O(log n). Divide a map at the point where a predicate on the keys stops holding. The user is responsible for ensuring that for all keys j and k in the map, j < k ==> p j >= p k.
spanAntitone p xs = (takeWhileAntitone p xs, dropWhileAntitone p xs)
spanAntitone p xs = partitionWithKey (k _ -> p k) xs
Note: if p is not actually antitone, then spanAntitone will split the map at some unspecified point where the predicate switches from holding to not holding (where the predicate is seen to hold before the first key and to fail after the last key).
where <math> is the prefix length. spanl, applied to a predicate p and a sequence xs, returns a pair whose first element is the longest prefix (possibly empty) of xs of elements that satisfy p and the second element is the remainder of the sequence.
where <math> is the suffix length. spanr, applied to a predicate p and a sequence xs, returns a pair whose first element is the longest suffix (possibly empty) of xs of elements that satisfy p and the second element is the remainder of the sequence.
O(log n). Divide a set at the point where a predicate on the elements stops holding. The user is responsible for ensuring that for all elements j and k in the set, j < k ==> p j >= p k.
spanAntitone p xs = (takeWhileAntitone p xs, dropWhileAntitone p xs)
spanAntitone p xs = partition p xs
Note: if p is not actually antitone, then spanAntitone will split the set at some unspecified point where the predicate switches from holding to not holding (where the predicate is seen to hold before the first element and to fail after the last element).