span

span, applied to a predicate p and a list xs, returns a tuple 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 breaks the ByteString into two segments. It is equivalent to (takeWhile p xs, dropWhile 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.
span p xs breaks the ByteString into two segments. It is equivalent to (takeWhile p xs, dropWhile p xs)
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)
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(i) 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.
O(i) 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.