21 Jul
2025
21 Jul
'25
1:42 p.m.
On Jul 21, 2025, at 8:43 AM, Stefan Klinger
wrote: Hallo, and thanks for the discussion!
You are welcome!
But there is a *different* read function
read :: String -> Word8
which is not used in the scenario above, and this is the buggy one (and all its bounded cousins).
I think you will find, though, that `read @Word8` is intended to match the behavior of `(fromInteger @Word8) . (read @Integer)`. At least, the `Int` case is specified in the Haskell Report (in the Prelude implementation). But I could be wrong about the intention in the other cases, you can always ask the relevant committee. (BTW the `read` functions have other quirks, like allowing leading whitespace.) Jeff Clites