I expect the below code to produce a generator of lists of a of size 1, 2 or 3, with each element generated independently.
shortlist :: Arbitrary a => Gen [a]
shortlist = oneof $ map promote [[arbitrary],
[arbitrary, arbitrary],
[arbitrary, arbitrary, arbitrary]]
REPL:
sample (shortlist :: Gen [Char])
"\255\255\255"
"ii"
"FF"
"\236\236"
"FF"
"'''"
"8"
"HH"
"\160"
"\DEL\DEL\DEL"
"\246\246"
Each list contains 1, 2 or 3 instances of the same char. Why is arbitrary not behaving as expected?