
On Wednesday 06 October 2010 22:02:57, Conor McBride wrote:
M'luds,
There's probably a place to report this properly, but I thought if I mentioned it here, you could throw cabbages at me and tell me where to go.
http://hackage.haskell.org/trac/ghc/newticket?type=bug Component: libraries(other) Decide whether you regard it as a documentation bug or a wrong result at runtime. (Documentation bug seems more reasonable)
Exhibit A, from http://haskell.org/ghc/docs/6.12.2/html/libraries/random-1.0.0.2/System- Random.html
"In addition, read may be used to map an arbitrary string (not necessarily one produced by show) onto a value of type StdGen. In general, the read instance of StdGen has the
^^^^ Note that that should be uppercase, Read.
following properties:
* It guarantees to succeed on any string."
It does in the sense that reads foo :: [(StdGen,[Char])] /= [] for all foo. The way it's formulated invites wrong interpretations, though.
Exhibit B, from ghci
Prelude System.Random> read "00-00-00-00-00-00" :: StdGen Loading package old-locale-1.0.0.2 ... linking ... done. Loading package time-1.1.4 ... linking ... done. Loading package random-1.0.0.2 ... linking ... done. *** Exception: Prelude.read: no parse
The prosecution rests.
Conor