Commit 27e2c4bb authored by Ian Lynagh's avatar Ian Lynagh

Add a test for trac #2158

parent abb9e342
......@@ -22,3 +22,4 @@ test('arr015', skip_if_fast, compile_and_run, [''])
test('arr016', normal, compile_and_run, ['-fglasgow-exts'])
test('arr017', skip_if_fast, compile_and_run, [''])
test('arr018', skip_if_fast, compile_and_run, [''])
test('arr019', normal, compile_and_run, [''])
-- 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) ..]
[Pos 0 0,Pos 0 1,Pos 0 2,Pos 0 3,Pos 1 0,Pos 1 1,Pos 1 2,Pos 1 3,Pos 2 0,Pos 2 1,Pos 2 2,Pos 2 3]
0
1
2
3
4
5
6
7
8
9
10
11
array (Pos 0 0,Pos 2 3) [(Pos 0 0,123),(Pos 0 1,124),(Pos 0 2,125),(Pos 0 3,126),(Pos 1 0,127),(Pos 1 1,128),(Pos 1 2,129),(Pos 1 3,130),(Pos 2 0,131),(Pos 2 1,132),(Pos 2 2,133),(Pos 2 3,134)]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment