#2470: read for StdGen fails for arbitrary string
---------------------------------+------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: libraries/random | Version: 6.8.3
Severity: normal | Resolution:
Keywords: StdGen read | Testcase:
Architecture: x86 | Os: Windows
---------------------------------+------------------------------------------
Comment (by guest):
With further thought, I wonder if I misunderstand the specification. From
reading the code, it looks like the read instance is using the first 6
characters to construct the StdGen result. However, because the rest of
the string is "left over" and unprocessed, the read call fails whenever
there are more than 6 characters in the passed string.
Two notes: (1) The number 6 is undocumented, making the behavior of read
incompehensible without examining the code; (2) it's unclear how this
specification interacts with compound structures, like the derived
instance of read :: String -> (StdGen,StdGen). What would we expect read
"(longword,longerword,longestword)" :: (StdGen,StdGen) to do? How do we
know which commas mean what?
If whoever looks at this decides this is an enhancement rather than a bug,
I won't be too terribly hurt. Again, you can contact me at
[EMAIL PROTECTED] Exposing stdFromString (perhaps with a different
name) might make everything cleaner.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2470#comment:1>
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