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 "åäö"
  [229,228,246]

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

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

  > chr . ord $ 'å'
  '\229'

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

/M

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

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

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to