Prelude function suggestions

Peter Simons simons at cryp.to
Thu Jul 29 06:32:19 EDT 2004


Simon Marlow writes:

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

 > tokens :: (a -> Bool) -> [a] -> [[a]]

Unfortunately, neither function would help me solve my
\r\n-line-ending case. I need separators that are longer
than one "character". I also think the idea of being able to
use the full "current prefix" for the decision is important.
I can't use these function, because they would, for example,
erroneously split the string "abc\ndef".

So far, I like the breakWhere function Ketil proposed best.

Peter



More information about the Libraries mailing list