Summary and call for discussion on text proposal

John Millikin jmillikin at gmail.com
Mon Nov 8 00:00:34 EST 2010


On Sun, Nov 7, 2010 at 06:36, Duncan Coutts
<duncan.coutts at googlemail.com> wrote:
> Option 1 (current Text lib design)
> ----------------------------------
>
> break   :: Text           -> Text -> (Text, Text)
> breakBy :: (Char -> Bool) -> Text -> (Text, Text)
>
> This gives the short name 'break' to the substring version, and the
> longer name 'breakBy' to the character predicate version.
>
> The argument for doing this is that the substring version should be
> the common encouraged one and so it should get the nice name.
>
> The argument against is that this is inconsistent with the List
> library which gives the name 'break' to the element predicate version:
>
> break :: (a -> Bool) -> [a] -> ([a], [a])

+1

IMO, the signatures/names of 'break' and 'breakBy' for text ought to
remain as they are, because they are they are short and accurate
descriptions of the functions behavior. Data.List.break should have
been named 'breakBy'; merely because a older API is poorly designed is
no reason to mangle new libraries out of misplaced nostalgia.

On Sun, Nov 7, 2010 at 08:56, Malcolm Wallace <malcolm.wallace at me.com> wrote:
>> Option 1 (current Text lib design)
>> ----------------------------------
>>
>> break   :: Text           -> Text -> (Text, Text)
>> breakBy :: (Char -> Bool) -> Text -> (Text, Text)
>>
>> This gives the short name 'break' to the substring version, and the
>> longer name 'breakBy' to the character predicate version.
>
> I very much dislike this option, for the reasons already rehearsed.  And Ian
> presented some evidence that there are no (or very few) usages of the short
> name versions in client libraries on hackage.  But this raw data does not
> give us enough context to know how to interpret it.  Are there simply very
> few clients of the Text package at all so far?  Are there many clients but
> they use other parts of the API?  How many usages of the long name versions
> appear?  And that does not address the idea that perhaps the clients indeed
> ought to be using the substring versions, but for whatever reason have not
> done so.

If a count of client packages is of value, my packages make up over a
quarter of text's clients[1]. Besides the packages uploaded to
Hackage, I have also written various scripts and special-purpose libs
which use a broader set of text's API (including both 'break' and
'breakBy'). At no point have I felt requiring an extra two characters
for the more special-purpose case to be an imposition or annoyance.

'breakStr' and 'breakChr' are the worst of all choices -- longer than
*both* current names, with gratuitous abbreviation to boot.

[1] According to the reverse-dependency-enabled Hackage,
<http://bifunctor.homelinux.net/~roel/cgi-bin/hackage-scripts/package/text>


More information about the Libraries mailing list