The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

294119 (38) [Avatar] Offline
#1
The author is intending to limit the Int -> Char to Chars between 0 and 255 in the following intToChar function:

intToChar :: Int -> Char
intToChar int = toEnum safeInt
where safeInt = int `mod`255


Shouldn't safeInt = int `mod` 256 to allow the possibility of the Char corresponding to 255?

If it should be 256, the discussion text preceeding the Listing should also be updated.