Re: Read instance of StdGen returns no parse

2008-02-02 Thread Denis Bueno
On Jan 26, 2008 7:01 PM, Yitzchak Gale [EMAIL PROTECTED] wrote: [snip explanation] The documentation in System.Random is a bit misleading. It says the read instance of StdGen has the following properties: It guarantees to succeed on any string... The word read should really be Read instead. It

Read instance of StdGen returns no parse

2008-01-26 Thread Denis Bueno
Hi all, According to http://haskell.org/ghc/docs/latest/html/libraries/random/System-Random.html#t%3AStdGen the Read StdGen instance should never fail. However, in GHC 6.8.2, it appears to: ghci GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ...

Re: Read instance of StdGen returns no parse

2008-01-26 Thread Yitzchak Gale
Denis Bueno wrote: the Read StdGen instance should never fail. However, in GHC 6.8.2, it appears to: It first fails for me on strings of length seven. You need to use fst . head . reads instead of read. The Read instance of StdGen only uses part of the string, and politely gives you back the