summaryrefslogtreecommitdiff
path: root/testsuite/tests/stranal
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-04-07 17:20:43 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2015-04-07 17:48:45 +0100
commiteacda9244913709ed025767418468b4cfc878cf9 (patch)
tree2df7a41ae32ae810e601c1744d70990841279bab /testsuite/tests/stranal
parentcf196400609d920e7f8189b9376833f4f5886360 (diff)
downloadhaskell-eacda9244913709ed025767418468b4cfc878cf9.tar.gz
Test Trac #10148
Diffstat (limited to 'testsuite/tests/stranal')
-rw-r--r--testsuite/tests/stranal/should_run/T10148.hs28
-rw-r--r--testsuite/tests/stranal/should_run/T10148.stdout0
-rw-r--r--testsuite/tests/stranal/should_run/all.T1
3 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/stranal/should_run/T10148.hs b/testsuite/tests/stranal/should_run/T10148.hs
new file mode 100644
index 0000000000..cba925e57f
--- /dev/null
+++ b/testsuite/tests/stranal/should_run/T10148.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE BangPatterns #-}
+module Main where
+
+import Debug.Trace
+
+data Machine = Machine (Int -> Machine) Int
+
+main :: IO ()
+main = (go 7 $ Machine (gstep (Array 99)) 8) `seq` return ()
+ where
+ go :: Int -> Machine -> Int
+ go 0 (Machine _ done) = done
+ go nq (Machine step _) = go (nq-1) $ step 0
+
+gstep :: Array Int -> Int -> Machine
+gstep m x = Machine (gstep m') (mindexA m)
+ where
+ !m' = adjustA x m
+
+data Array a = Array a
+
+adjustA :: (Show a) => Int -> Array a -> Array a
+adjustA i (Array t)
+ | i < 0 = undefined i -- not just undefined!
+ | otherwise = Array $ trace ("adj " ++ show t) $ t
+
+mindexA :: Array a -> a
+mindexA (Array v) = v
diff --git a/testsuite/tests/stranal/should_run/T10148.stdout b/testsuite/tests/stranal/should_run/T10148.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/stranal/should_run/T10148.stdout
diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T
index 2ca65b5110..7f64f85a11 100644
--- a/testsuite/tests/stranal/should_run/all.T
+++ b/testsuite/tests/stranal/should_run/all.T
@@ -8,3 +8,4 @@ test('strun004', normal, compile_and_run, [''])
test('T2756b', normal, compile_and_run, [''])
test('T7649', normal, compile_and_run, [''])
test('T9254', normal, compile_and_run, [''])
+test('T10148', normal, compile_and_run, [''])