Haskell Platform Proposal: add the 'text' library

Roman Leshchinskiy rl at cse.unsw.edu.au
Sun Oct 17 16:56:04 EDT 2010


On 17/10/2010, at 21:25, Bryan O'Sullivan wrote:

> On Mon, Oct 11, 2010 at 1:12 PM, Malcolm Wallace <malcolm.wallace at me.com> wrote:
> 
> The breakSubstring functionality is semantically:
>    breakSubstring x = break (==x)
> although there may be a more efficient implementation.
> Proposal: rename Text.break to Text.breakSubstring, and Text.breakBy to Text.break.
> 
> So far, I've been proceeding on the basis that I'd like naming to be consistent and descriptive, and to have more commonly used functions get shorter names than their less commonly used (but possibly more general) cousins. For instance, breakSubstring is descriptive, and it's consistent with bytestring, but it's much longer than break, even though breaking on a fixed string is more common. In this case, length and frequency of use trump the other considerations in my mind.

FWIW, I take almost exactly the opposite approach with vector. I try to follow the list/array interface as closely as possible even in the presence of more frequently used but subtly different operations. My rationale is that typing a few extra characters is vastly preferable to having to search through the docs to find out what this particular library calls this particular function.

I also think breakSubstring would be an unfortunate name because (a) it's too long and (b) other collection-oriented libraries can't use this name for this operation if they don't operate on strings. How about breakSub or breakOn or something like that.

Roman




More information about the Libraries mailing list