summaryrefslogtreecommitdiff
path: root/testsuite/tests/array/should_run/arr019.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/array/should_run/arr019.hs')
-rw-r--r--testsuite/tests/array/should_run/arr019.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/array/should_run/arr019.hs b/testsuite/tests/array/should_run/arr019.hs
new file mode 100644
index 0000000000..9992dd2315
--- /dev/null
+++ b/testsuite/tests/array/should_run/arr019.hs
@@ -0,0 +1,27 @@
+
+-- Test for trac #2158
+
+import Data.Array
+
+data Pos = Pos Integer Integer
+ deriving (Show, Eq, Ord, Ix)
+
+myBounds :: (Pos, Pos)
+myBounds = (Pos 0 0, Pos 2 3)
+
+main :: IO ()
+main = do print $ range myBounds
+ print $ index myBounds (Pos 0 0)
+ print $ index myBounds (Pos 0 1)
+ print $ index myBounds (Pos 0 2)
+ print $ index myBounds (Pos 0 3)
+ print $ index myBounds (Pos 1 0)
+ print $ index myBounds (Pos 1 1)
+ print $ index myBounds (Pos 1 2)
+ print $ index myBounds (Pos 1 3)
+ print $ index myBounds (Pos 2 0)
+ print $ index myBounds (Pos 2 1)
+ print $ index myBounds (Pos 2 2)
+ print $ index myBounds (Pos 2 3)
+ print $ listArray myBounds [(123 :: Integer) ..]
+