[project @ 1997-03-14 07:52:06 by simonpj]
[ghc-hetmet.git] / ghc / lib / tests / Array / arr003 / Main.hs
1 -- Array creation, (index,value) list with out of bound index.
2 -- 
3 -- Haskell library report 1.3 (and earlier) specifies
4 -- that `array' values created with lists containing out-of-bounds indices,
5 -- are undefined ( _|_ ).
6 --
7 -- GHC implementation of `array' catches this (or, rather, 
8 -- `index' does) - the argument list to `array' is defined
9 -- to have its spine be evaluated - so the indexing below
10 -- should cause a failure.
11 --
12 import Array
13
14 main =
15  let a1 = array (1,3) (zip ([1..4]) ['a'..'d']) in
16  print (a1!2)
17
18
19