spanl package:nonempty-containers

where <math> is the prefix length. spanl, applied to a predicate p and a sequence xs, returns a These based on the point where the predicate fails:
  • This ys means that the predicate was true for all items, and ys is the entire original sequence.
  • That zs means that the predicate failed on the first item, and zs is the entire original sequence.
  • These ys zs gives ys (the prefix of elements that satisfy the predicae) and zs (the remainder of the sequence)