Re: Correct parsers for bounded integral values
Jeff Clites via Haskell-Cafe <[email protected]> Mon, 21 Jul 2025 10:42:09 -0700
| Newsgroups | gmane.comp.lang.haskell.cafe |
|---|---|
| Message-ID | <[email protected]> |
> On Jul 21, 2025, at 8:43 AM, Stefan Klinger <[email protected]> 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 _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.