[commit: random] master: Added currently unworking test from ticket 4218. (5d805e7)
Ian Lynagh
igloo at earth.li
Fri Jul 8 18:47:45 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/random
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/5d805e7182798bd6d309649ed5648cb76ace667c
>---------------------------------------------------------------
commit 5d805e7182798bd6d309649ed5648cb76ace667c
Author: Ryan Newton <rrnewton at gmail.com>
Date: Tue Jun 28 13:44:56 2011 -0400
Added currently unworking test from ticket 4218.
>---------------------------------------------------------------
tests/TestRandomRs.hs | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/tests/TestRandomRs.hs b/tests/TestRandomRs.hs
new file mode 100644
index 0000000..74e319d
--- /dev/null
+++ b/tests/TestRandomRs.hs
@@ -0,0 +1,24 @@
+
+-- Test from ticket #4218:
+-- http://hackage.haskell.org/trac/ghc/ticket/4218
+
+module Main where
+
+import Control.Monad
+import System.Random
+import Data.List
+
+force = foldr (\x r -> x `seq` (x:r)) []
+
+-- Ten million random numbers:
+blowsTheHeap :: IO Integer
+blowsTheHeap = (last . take 10000000 . randomRs (0, 1000000)) `liftM` getStdGen
+
+works :: IO Integer
+works = (last . take 10000000 . force . randomRs (0, 1000000)) `liftM` getStdGen
+
+
+main =
+ do n <- blowsTheHeap
+ print n
+
More information about the Cvs-libraries
mailing list