diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-04-07 17:20:43 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-04-07 17:48:45 +0100 |
commit | eacda9244913709ed025767418468b4cfc878cf9 (patch) | |
tree | 2df7a41ae32ae810e601c1744d70990841279bab | |
parent | cf196400609d920e7f8189b9376833f4f5886360 (diff) | |
download | haskell-eacda9244913709ed025767418468b4cfc878cf9.tar.gz |
Test Trac #10148
-rw-r--r-- | testsuite/tests/stranal/should_run/T10148.hs | 28 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_run/T10148.stdout | 0 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_run/all.T | 1 |
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, ['']) |