String != [Char]

Brandon Allbery allbery.b at gmail.com
Sat Mar 24 22:31:48 CET 2012


On Sat, Mar 24, 2012 at 16:16, Ian Lynagh <igloo at earth.li> wrote:

> On Sat, Mar 24, 2012 at 11:50:10AM -0700, Johan Tibell wrote:
> > Using list-based operations on Strings are almost always wrong
>
> Data.Text seems to think that many of them are worth reimplementing for
> Text. It looks like someone's systematically gone through Data.List.
> And in fact, very few functions there /don't/ look like they are
> directly equivalent to list functions.
>

I was under the impression they have been very carefully designed to do the
right thing with characters represented by multiple codepoints, which is
something the String version *cannot* do.  It would help if Bryan were
involved with this discussion, though.  (I'm cc:ing him on this.)  Since
the whole point of Data.Text is to handle stuff like this properly I would
be surprised if your assertion that

>     upcase :: String -> String
> >     upcase = map toUpper
>
> This is no more incorrect than
>    upcase = Data.Text.map toUpper
>

is correct.

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-prime/attachments/20120324/7fb072d5/attachment-0001.htm>


More information about the Haskell-prime mailing list