Skip to content

WIP: Add octet overflow warning for ByteStrings

Oleg Grenrus requested to merge phadej/ghc:overflow-bytestring into master

This is a solution to settle https://github.com/haskell/bytestring/issues/140

The truncation of characters to octets might be surprising, yet using a blessed (UTF8 or any other) encoding is not optimal. Then one couldn't represent all ByteStrings with literal.

This patch makes GHC warn about "byte overflow" in the same way as it already warns about numeric literal overflows.

Which means that we don't need to change anything in bytestring library. Unfortunately, as we don't now for sure the Name of ByteString types, we have to be slightly fuzzy. Yet, the test should catch issues if bytestring library is reorganised.


I think CLC should weigh on this. This is just a solution to IsString ByteString problem.

Edited by Ben Gamari

Merge request reports