[Haskell-cafe] Correct parsers for bounded integral values
Pierre Thierry
pierre at nothos.net
Mon Aug 4 01:23:54 UTC 2025
On August 3, 2025 9:17:20 PM GMT+02:00, Stefan Klinger <haskell at stefan-klinger.de> wrote:
>> Well, IIUC, it conforms to the Haskell 98 specification.
>I don't think the Haskell Spec really *requires* the `read` function
>for a bounded integral type to wrap around.
The Haskell 98 report says that reading numerical literals is defined as applying `fromInteger` in section 6.4.1 and section 6.4 says an implementation may choose to use a truncated value on overflow (or may choose anything else, it's undefined). Truncating an unbounded integer to a fixed sized would produce wrapping around.
<https://www.haskell.org/onlinereport/basic.html#sect6.4.1>
Curiously,
Pierre Thierry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20250804/7349ecf6/attachment.html>
More information about the Haskell-Cafe
mailing list