Issue 2564 Checking that B.concat works: [Failed]

Title Checking that B.concat works: [Failed]
Priority Status resolved
Milestone Resolved in
Superseder Nosy List bf, gh
Assigned To

Created on 2018-02-12.18:52:43 by gh, last changed 2018-02-15.19:10:29 by gh.

msg19878 (view) Author: gh Date: 2018-02-12.18:52:42
I am consistently getting failures with this quickcheck property in
Darcs HEAD, typically after less than 10 tests so this bugs should
happen often?

(I am running Ubuntu 17.10).
msg19879 (view) Author: bf Date: 2018-02-14.22:01:55
For reference, this is the property:

propConcatPS :: [String] -> Bool
propConcatPS ss = concat ss == BC.unpack (B.concat $ map BC.pack ss)

This is wrong. We don't even have

propRoundtrip :: String -> Bool
propRoundtrip s = s == BC.unpack (BC.pack s)

It fails for any String that contains a codepoint outside the ASCII
range since BC.pack throws away the upper bits.

This was previously undetected since quickcheck's standard instance
arbitrary String  (or Char) did not produce non-ASCII characters. See
here. Quote from

	* Random strings and characters now include Unicode characters by
default. To generate only ASCII characters, use the new ASCIIString
modifier or arbitraryASCIIChar generator. The following modifiers and
generators also control the kind of strings generated: UnicodeString,
PrintableString, arbitraryUnicodeChar, arbitraryPrintableChar.
msg19880 (view) Author: bf Date: 2018-02-14.22:04:32
The quote is actually from the release notes for qc 2.10. We probably
did not select qc >= 2.10 because it requires (directly or indirectly)
Date User Action Args
2018-02-12 18:52:43ghcreate
2018-02-14 22:01:57bfsetmessages: + msg19879
2018-02-14 22:04:34bfsetmessages: + msg19880
2018-02-15 19:10:29ghsetstatus: unknown -> resolved