Correct parsers for bounded integral values
Stefan Klinger
haskell at stefan-klinger.de
Sun Jul 20 19:12:20 UTC 2025
Hello,
I'd like to bring to your attention a discussion that I have started
over at Haskell-cafe [1]. I was complaining about the silent overflow
of parsers for bounded integers:
> read "298" :: Word8
42
I find this unsatisfying, and I have demonstrated a solution [2] that
seems correct and performant.
To avoid cross posting, I'd rather point you to the discussion on the
Haskell-cafe mailing list [1].
I would like to help get this into GHC and also other parsing
libraries. Not all libraries suffer from this issue, but some do,
including GHC and its `base` package.
How can I attempt this? Should I file a bug report? Or try to follow
the instructions at ghc.dev [3] and submit a pull request? I would
start tinkering at [this point][4] as soon as I manage to compile GHC.
Would you want to share any advice beforehand? I'd really appreciate
to be stopped before wasting effort ;-) Also, I probably only can work
on this on weekends.
Cheers
Stefan
[1]: https://mail.haskell.org/pipermail/haskell-cafe/2025-July/137134.html
[2]: https://github.com/s5k6/robust-int
[3]: https://ghc.dev/
[4]: https://hackage.haskell.org/package/ghc-internal-9.1201.0/docs/src/GHC.Internal.Read.html#line-586
--
Stefan Klinger, Ph.D. -- computer scientist o/X
http://stefan-klinger.de /\/
https://github.com/s5k6 \
I prefer receiving plain text messages, not exceeding 32kB.
More information about the ghc-devs
mailing list