Re: Correct parsers for bounded integral values

Pierre Thierry <[email protected]> Mon, 04 Aug 2025 03:23:54 +0200
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <[email protected]>
On August 3, 2025 9:17:20 PM GMT+02:00, Stefan Klinger <[email protected]> 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

_______________________________________________
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.