[Haskell-cafe] Re: System.Random StdGen read fails on some
strings? [also continues: Random/StdGen/read: there is
something unclear (or misunderstood!)]
simonpj at microsoft.com
Mon Mar 19 05:50:46 EDT 2007
Good point. It's a bit stupid that 'read' fails utterly on strings shorter than 6.
I don't thin StdRandom has an "owner" at the moment. There's a process for proposing library changes, described under "guidelines for developers" here
That's the way to get your change adopted.
However, in this case the bug is in your code. The function 'read' (which you use) fails unless it consumes its entire input. That is not what you want here. The right thing to do is to use 'reads' instead. The wrong thing to do is to make reading a StdGen read the entire input string!
More information about the Haskell-Cafe