String != [Char]

Christian Siefkes christian at siefkes.net
Mon Mar 26 19:12:35 CEST 2012


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

> I agree on the second part. As someone pointed out earlier, we should
> be careful in using the word character as the Unicode code point
> doesn't correspond well to the commonly used concept of a character.

Indeed, as Thomas pointed out, the term "Unicode character" is not
well-defined, hence we should prefer the term "Unicode code point" which
seems to come closest. What else should length return, if not the number of
code points in a string (possibly after normalization)? What else should
head or take x return, if not the first (x) code point(s) of a string
(possibly after normalization)?

Best regards
	Christian

-- 
|------- Dr. Christian Siefkes ------- christian at siefkes.net -------
| Homepage: http://www.siefkes.net/ | Blog: http://www.keimform.de/
|    Peer Production Everywhere:       http://peerconomy.org/wiki/
|---------------------------------- OpenPGP Key ID: 0x346452D8 --
What everybody echoes or in silence passes by as true today
may turn out to be falsehood tomorrow.
        -- Henry D. Thoreau, Walden

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://www.haskell.org/pipermail/haskell-prime/attachments/20120326/ffcbee89/attachment.pgp>


More information about the Haskell-prime mailing list