<div dir="auto">I believe it's not that integers must wrap, but that Read behavior must match compiler behavior (and GHC's behavior is to wrap).</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sun, Aug 3, 2025, 12:17 PM Stefan Klinger <<a href="mailto:haskell@stefan-klinger.de">haskell@stefan-klinger.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Pierre Thierry (2025-Jul-21, excerpt):<br>
> Well, IIUC, it conforms to the Haskell 98 specification.<br>
<br>
Hm.  Maybe I keep missing something here.  After all it's beeing<br>
pointed out repeatedly by you guys (and yes, I do listen), but I fail<br>
to verify that claim.<br>
<br>
I don't think the Haskell Spec really *requires* the `read` function<br>
for a bounded integral type to wrap around.<br>
<br>
Jeff Clites via Haskell-Cafe (2025-Jul-21, excerpt):<br>
> I think you will find, though, that `read @Word8` is intended to<br>
> match the behavior of `(fromInteger @Word8) . (read @Integer)`. At<br>
> least, the `Int` case is specified in the Haskell Report (in the<br>
> Prelude implementation).<br>
<br>
Sorry, I cannot find this.  Would you have a URL and a line number for<br>
me?  I'm really sorry my google-foo seems to be insufficient.<br>
<br>
I have found in the 98 report [4], similar in 2010 [5]:<br>
<br>
    The results of exceptional conditions (such as overflow or<br>
    underflow) on the fixed-precision numeric types are undefined; an<br>
    implementation may choose error (_|_, semantically), a truncated<br>
    value, or a special value such as infinity, indefinite, etc.<br>
<br>
So, not violating the report, but the implementation might choose to<br>
do better.<br>
<br>
Cheers<br>
Stefan<br>
<br>
<br>
[1]: <a href="https://mail.haskell.org/pipermail/haskell-cafe/2025-July/137156.html" rel="noreferrer noreferrer" target="_blank">https://mail.haskell.org/pipermail/haskell-cafe/2025-July/137156.html</a><br>
[2]: <a href="https://mail.haskell.org/pipermail/haskell-cafe/2025-July/137155.html" rel="noreferrer noreferrer" target="_blank">https://mail.haskell.org/pipermail/haskell-cafe/2025-July/137155.html</a><br>
[3]: <a href="https://mail.haskell.org/pipermail/haskell-cafe/2025-July/137162.html" rel="noreferrer noreferrer" target="_blank">https://mail.haskell.org/pipermail/haskell-cafe/2025-July/137162.html</a><br>
[4]: <a href="https://www.haskell.org/onlinereport/basic.html#sect6.4" rel="noreferrer noreferrer" target="_blank">https://www.haskell.org/onlinereport/basic.html#sect6.4</a><br>
[5]: <a href="https://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1350006.4" rel="noreferrer noreferrer" target="_blank">https://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1350006.4</a><br>
<br>
<br>
--<br>
Stefan Klinger, Ph.D. -- computer scientist              o/X<br>
<a href="http://stefan-klinger.de" rel="noreferrer noreferrer" target="_blank">http://stefan-klinger.de</a>                                 /\/<br>
<a href="https://github.com/s5k6" rel="noreferrer noreferrer" target="_blank">https://github.com/s5k6</a>                                    \<br>
I prefer receiving plain text messages, not exceeding 32kB.<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>