Haskell Platform Proposal: add the 'text' library

Ross Paterson ross at soi.city.ac.uk
Tue Oct 19 19:59:40 EDT 2010

On Wed, Oct 20, 2010 at 12:35:33AM +0100, Duncan Coutts wrote:
> On 19 October 2010 22:08, Roman Leshchinskiy <rl at cse.unsw.edu.au> wrote:
> > On 19/10/2010, at 15:22, John Lato wrote:
> >> I think there's a significant difference between vector and text, namely a Vector is conceptually the same as a list/1D array, while a Text is not.  I think this difference is enough to warrant a break from the list API.
> >
> > Are you sure? From its interface Text looks exactly like a list of Chars to me.
> Right, that's a very common misunderstanding of Unicode. A Unicode
> code point (type Char) does not correspond 1:1 with the human notion
> of a character. It would be nice if it did, but unfortunately it is
> not something we can ignore. Because of this it is better not to think
> of operations on individual Chars but on short sequences of Chars. In
> any case, when processing text (even ASCII where Chars do match
> characters) many of the most common operations that you want are
> substring not element based.

I believe Roman is referring to the Text API, which does indeed look a lot
like the list API specialized to Char, with relatively few exceptions.
The above would be an argument against including any of the functions
with Char parameters, but a high proportion of them do.

More information about the Libraries mailing list