
31 May
2004
31 May
'04
6:19 a.m.
Kwanghoon Choi
As the following script shows, hexa-decimal digits cannot be recognized by 'Prelude.read'. It seems to be a bug. main = putStrLn (show (chr (read "0x2B" :: Int)))
Actually, it is conformant Haskell'98 behaviour. The Prelude defines instance Read Int where readsPrec p = readSigned readDec (or a very near equivalent), that is, it uses readDec for decimal notation, rather than using readOct or readHex for octal or hexadecimal respectively. Arguably, this is a bug in the Haskell'98 definition, but both nhc98 and Hugs follow the definition exactly in this case. Regards, Malcolm