String != [Char]

Christian Siefkes christian at siefkes.net
Mon Mar 26 12:08:31 CEST 2012


On 03/26/2012 02:39 AM, Gabriel Dos Reis wrote:
> True, but should the language definition default to a string type
> that is one the most unsuited for text processing in the 21st
> century where global multilingualism abounds?  Even C has qualms
> about that.
...
> I have no doubt believing that if all texts my students have to
> process are US ASCII, [Char] is more than sufficient.  So, I have
> sympathy for your position.  However,  I doubt [Char] would be
> adequate if I ask them to shared texts from their diverse cultures.

Uh, while a C char is (usually) just a byte (2^8 bits of information, like
Word8 in Haskell), a Haskell Char is a Unicode character (2^21 bits of
information). A single C char cannot contain arbitrary Unicode character,
while a Haskell Char can, and does. Hence [Char] is (efficiency issues
aside) perfectly adequate for dealing with texts written in arbitrary languages.

Best regards
	Christian

[I first accidentally send this just to Gabriel, sorry.]

-- 
|------- 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 --
A bug is a test case you haven't written yet.

-------------- 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/3edd319e/attachment.pgp>


More information about the Haskell-prime mailing list