#4375: read :: String -> StdGen behaves oddly with respect to documentation.
---------------------------------+------------------------------------------
Reporter: ConorMcBride | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries (other)
Version: 6.12.3 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: Documentation bug
---------------------------------+------------------------------------------
Says the documentation:
"read may be used to map an arbitrary string (not necessarily one produced
by show) onto a value of type StdGen"
but this is manifestly not the case, as
read "more than 6 characters"
causes a "no parse" failure.
In fact, the *reads* implementation takes at most 6 characters from the
string, rather than consuming all the input, so reads works but read
fails.
It is certainly possible to work around this issue by substituting (read .
take 6) for the offending read uses, but the documentation might perhaps
be updated to reflect the truth.
Or perhaps the truth might be updated to reflect the documentation? I
suppose it's a question of serialization versus generation. I certainly
think it would be handy to generate StdGen seeds from arbitrary strings,
but that should perhaps not be the function of the Read instance.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4375>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs