summaryrefslogtreecommitdiff
path: root/libraries/base/tests
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-08-24 11:47:40 -0400
committerBen Gamari <ben@smart-cactus.org>2017-08-25 17:23:48 -0400
commita67b66e663d159c219750a5044ccf553c4b21bdb (patch)
tree8a28a36ec984750206374f8045be08b8020a294a /libraries/base/tests
parentdd89a1387aef5280152c03cf7e2a98b8e73216f0 (diff)
downloadhaskell-a67b66e663d159c219750a5044ccf553c4b21bdb.tar.gz
Add strict variant of iterate
Summary: This closes the nearly-eight-year-old #3474. Test Plan: Validate Reviewers: RyanGlScott, austin, hvr Subscribers: rwbarton, thomie GHC Trac Issues: #3474 Differential Revision: https://phabricator.haskell.org/D3870
Diffstat (limited to 'libraries/base/tests')
-rw-r--r--libraries/base/tests/T3474.hs5
-rw-r--r--libraries/base/tests/T3474.stdout1
-rw-r--r--libraries/base/tests/all.T4
3 files changed, 10 insertions, 0 deletions
diff --git a/libraries/base/tests/T3474.hs b/libraries/base/tests/T3474.hs
new file mode 100644
index 0000000000..dbd59011b4
--- /dev/null
+++ b/libraries/base/tests/T3474.hs
@@ -0,0 +1,5 @@
+import Data.List
+
+-- this should evaluate in constant space
+main :: IO ()
+main = print $ iterate' (+1) 1 !! 100000000
diff --git a/libraries/base/tests/T3474.stdout b/libraries/base/tests/T3474.stdout
new file mode 100644
index 0000000000..2e8da1af1b
--- /dev/null
+++ b/libraries/base/tests/T3474.stdout
@@ -0,0 +1 @@
+100000001 \ No newline at end of file
diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index 970fb7e454..9055bd5b45 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -217,3 +217,7 @@ test('T13191',
test('T13525', when(opsys('mingw32'), skip), compile_and_run, [''])
test('T13097', normal, compile_and_run, [''])
test('functorOperators', normal, compile_and_run, [''])
+test('T3474',
+ [stats_num_field('max_bytes_used', [ (wordsize(64), 44504, 5) ]),
+ only_ways(['normal'])],
+ compile_and_run, ['-O'])