Haskell Platform Proposal: add the 'text' library

Daniel Fischer daniel.is.fischer at web.de
Sun Oct 17 17:05:05 EDT 2010

On Sunday 17 October 2010 22:56:04, Roman Leshchinskiy wrote:
> 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.

Good reasons for both approaches.
Altogether, I find the reasons for following existing examples stronger, 
but not so much as to try hard to make text pursue that approach.

> 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.

I called it breakOn in stringsearch.

> Roman

More information about the Libraries mailing list