:: [a] -> [a] -> [[a]] package:vector-split

Split on the given sublist. Equivalent to split . dropDelims . onSublist. For example:
>>> splitOn (BV.fromList "..") (BV.fromList "a..b...c....d..")
["a","b",".c","","d",""]
In some parsing combinator frameworks this is also known as sepBy. Note that this is the right inverse of the intercalate function from Data.List, that is,
> \xs -> (intercalate xs . splitOn xs) === id
splitOn x . intercalate x is the identity on certain lists, but it is tricky to state the precise conditions under which this holds. (For example, it is not enough to say that x does not occur in any elements of the input list. Working out why is left as an exercise for the reader.)
Split on any of the given elements. Equivalent to split . dropDelims . oneOf. For example:
>>> splitOneOf (BV.fromList ";.,") (BV.fromList "foo,bar;baz.glurk")
["foo","bar","baz","glurk"]
Split into chunks terminated by the given subsequence. Equivalent to split . dropFinalBlank . dropDelims . onSublist. For example:
>>> endBy (BV.fromList ";") (BV.fromList "foo;bar;baz;")
["foo","bar","baz"]
Note also that the lines function from Data.List is equivalent to endBy "n".
Split into chunks terminated by one of the given elements. Equivalent to split . dropFinalBlank . dropDelims . oneOf. For example:
>>> endByOneOf (BV.fromList ";,") (BV.fromList "foo;bar,baz;")
["foo","bar","baz"]