Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added currently unworking test from ticket 4218.

  • Loading branch information...
commit 5d805e7182798bd6d309649ed5648cb76ace667c 1 parent 0ec16d3
Ryan Newton rrnewton authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 tests/TestRandomRs.hs
24 tests/TestRandomRs.hs
View
@@ -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
+
Please sign in to comment.
Something went wrong with that request. Please try again.