Adding split/split' to Data.List, and redefining words/lines
with it; also, adding replace/replaceBy
Gwern Branwen
gwern0 at gmail.com
Sat Jul 12 16:59:09 EDT 2008
On Thu, Jul 10, 2008 at 9:18 PM, David Roundy <droundy at darcs.net> wrote:
> On Fri, Jul 11, 2008 at 12:11:15AM +0100, Neil Mitchell wrote:
>> Hi
>>
>> > What do people think of adding these?
>>
>> split is sorely lacking, and definately needs to be included. However,
>> my version is different to yours:
>
> I would suggest that when everyone defines a different version of a
> function, then it isn't actually such a good function to put into the
> standard libraries.
>
> David
Personally, I disagree. The way I see, the proliferation of splits is
a cry for help, pointing to a need for some sort of centralization and
cleanup. As it is, there are something like 5 or 6 splits floating
around out there (split, split´/splitNeil, splitTwanvl,
splitBytestring, splitHSH, and a few others I have not really looked
at*).
Each one is defined a little differently, and looks different - even
if they turn out to be the exact same thing like with
split´/splitNeil; so each time a Haskeller needs this they have to
roll their own or use someone else´s roll, and of course each one has
subtly different edge cases, so there´s no guarantee you actually
understand a given split implementation. I would regard having a few
well-documented, tested splits in Data.List as an enormous improvement
on the status quo - and I would still regard it as so even if it
turned out that one needs to add, say, 4 splits.
The situation makes me a little queasy. Tons of people like dons or
Simon Marlowe or so on agree that a basic list processing function is
needed, and we´ve been agreed on that point for two years, but somehow
nothing improves, and I go on rewriting split in scripts every so
often.
* http://www.haskell.org/pipermail/haskell-cafe/2006-July/016574.html
--
gwern
More information about the Libraries
mailing list