#4218: System.Random is way too lazy
---------------------------------+------------------------------------------
Reporter: EyalLotem | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.12.3 | Keywords: random stack overflow
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
randomRs is too lazy, generates lists of large lazy-state thunks, rather
than lists of strict values.
Test program is attached.
Also, randomIO is too lazy, and builds up huge thunks. Using (randomIO >>=
evaluate) is fine, however.
Fails with stack overflow:
rs <- replicateM 1000000 evaluate :: IO [Int]
print $ last rs
Works:
rs <- replicateM 1000000 (evaluate =<< randomIO) :: IO [Int]
print $ last rs
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4218>
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