Haskell Platform Proposal: add the 'text' library

Johan Tibell johan.tibell at gmail.com
Wed Oct 20 12:52:48 EDT 2010


On Wed, Oct 20, 2010 at 5:59 PM, Ian Lynagh <igloo at earth.li> wrote:
> On Wed, Oct 20, 2010 at 05:28:15PM +0200, Johan Tibell wrote:
>>
>> If you process a string code point by code point you might mistakenly
>> confuse a plain "a" (A) with a "å" (A-RING *or* A + COMBINING RING).
>
> But isn't that what text does here?:
>
> Data.Text Data.Text.IO> let t = pack "z\x0061\x030A\x0061z"
> Data.Text Data.Text.IO> putStrLn t
> zåaz
> Data.Text Data.Text.IO> putStrLn (replace (pack "a") (pack "y") t)
> zẙyz

I think the right thing to do here is to perform normalization first
but I'm not sure. Some Unicode expert should chime in about what the
right semantics of 'replace' is.

Johan


More information about the Libraries mailing list