[Haskell-cafe] Has character changed in GHC 6.8?

Magnus Therning magnus at therning.org
Tue Jan 22 04:29:08 EST 2008

I vaguely remember that in GHC 6.6 code like this

  length $ map ord "a string"

being able able to generate a different answer than

  length "a string"

At the time I thought that the encoding (in my case UTF-8) was “leaking
through”.  After switching to GHC 6.8 the behaviour seems to have
changed, and mapping 'ord' on a string results in a list of ints
representing the Unicode code point rather than the encoding:

  > map ord "åäö"

Is this the case, or is there something strange going on with character

I was hoping that this would mean that 'chr . ord' would basically be a
no-op, but no such luck:

  > chr . ord $ 'å'

What would I have to do to get an 'å' from '229'?


Magnus Therning                             (OpenPGP: 0xAB4DFBA4)
magnus@therning.org             Jabber: magnus.therning@gmail.com

What if I don't want to obey the laws? Do they throw me in jail with
the other bad monads?
     -- Daveman

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080122/a16dd2a3/signature.bin

More information about the Haskell-Cafe mailing list