String != [Char]

David Menendez dave at zednenem.com
Mon Mar 26 22:24:20 CEST 2012


On Mon, Mar 26, 2012 at 1:12 PM, Christian Siefkes
<christian at siefkes.net> wrote:
> On 03/26/2012 06:58 PM, Johan Tibell wrote:
>> On Mon, Mar 26, 2012 at 9:42 AM, Christian Siefkes
>> <christian at siefkes.net> wrote:
>>> On 03/26/2012 05:50 PM, Johan Tibell wrote:
>>>> Normalization isn't quite enough unfortunately, as it does solve e.g.
>>>>
>>>>     upcase = map toUppper
>>>>
>>>> You need all-at-once functions on strings (which we could add.) I'm
>>>> just pointing out that most (all?) list functions do the wrong thing
>>>> when used on Strings.
>>>
>>> Hm, do you have any other examples besides toUpper/toLower?
>>
>> length, cons, head, tail, filter, folds, anything that works on an
>> element-by-element basis.
>
> Hm, but aren't these all matters of Unicode normalization? Your argument
> seems to go in circles, since above you wrote: "Normalization isn't quite
> enough unfortunately".

Unicode contains a set of precomposed characters, like ö, that can be
normalized to a single code point, but this is not true of every
combination of characters.

Prelude> "ā́"
"a\772\769"

As far as I know, there is no representation of ā́ which uses a single
code point.

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>



More information about the Haskell-prime mailing list