:: (a -> Bool) -> [a] -> [[a]] package:split

Split on elements satisfying the given predicate. Equivalent to split . dropDelims . whenElt.
>>> splitWhen (<0) [1,3,-4,5,7,-9,0,2]
[[1,3],[5,7],[0,2]]
>>> splitWhen (<0) [1,-2,3,4,-5,-6,7,8,-9]
[[1],[3,4],[],[7,8],[]]
Split into "words", with word boundaries indicated by the given predicate. Satisfies words === wordsBy isSpace; equivalent to split . dropBlanks . dropDelims . whenElt.
>>> wordsBy (`elem` ",;.?! ") "Hello there, world! How?"
["Hello","there","world","How"]
>>> wordsBy (=='x') "dogxxxcatxbirdxx"
["dog","cat","bird"]
Split into "lines", with line boundaries indicated by the given predicate. Satisfies lines === linesBy (=='n'); equivalent to split . dropFinalBlank . dropDelims . whenElt.
>>> linesBy (==';') "foo;bar;;baz;"
["foo","bar","","baz"]
>>> linesBy (=='x') "dogxxxcatxbirdxx"
["dog","","","cat","bird",""]