#2470: read for StdGen fails for arbitrary string
------------------------------+---------------------------------------------
 Reporter:  guest             |          Owner:         
     Type:  bug               |         Status:  closed 
 Priority:  normal            |      Milestone:         
Component:  libraries/random  |        Version:  6.8.3  
 Severity:  normal            |     Resolution:  invalid
 Keywords:  StdGen read       |     Difficulty:  Unknown
 Testcase:                    |   Architecture:  x86    
       Os:  Windows           |  
------------------------------+---------------------------------------------
Comment (by Isaac Dupree):

 The Haskell 98 report is buggy; that behavior is unimplementable when
 applying (`read::String->StdGen`) to an infinite list.  Actually, no,
 that's not quite right.  (`readsPrec::Int->ReadS StdGen`) ==
 (`readsPrec::Int->String->[(StdGen,String)]`).  So readsPrec could be
 defined to read only a finite amount of the string, and unconditionally
 return `[(result,"")]` so that "read" always succeeded.  But that breaks
 the read/show identities (e.g. `(read.show)::[StdGen]->[StdGen]` would
 break), and in general breaks the expected behavior for the `reads`
 functions, so I don't think it's worth it to pretend the standard isn't
 broken there.

 -Isaac

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2470#comment:6>
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

Reply via email to