[Haskell-cafe] Why is there no "splitSeperator" function in Data.List
gwern0 at gmail.com
Sat Feb 12 17:21:37 CET 2011
On Sat, Feb 12, 2011 at 11:00 AM, Robert Clausecker <fuzxxl at gmail.com> wrote:
> Is there any reason, that one can't find a function that splits a list
> at a seperator in the standard library? I imagined something like this:
> splitSeperator :: Eq a => a -> [a] -> [[a]]
> splitSeperator ',' "foo,bar,baz"
> --> ["foo","bar","baz"]
> Or something similar? This is needed so often, even if I can implement
> it in one line, is there any reason why it's not in the libs?
The reason it's not in Data.List is because there are a bazillion
different splits one might want (when I was pondering the issue before
Brent released it, I had collected something like 8 different proposed
splits), so no agreement could ever be reached.
More information about the Haskell-Cafe