summaryrefslogtreecommitdiff
path: root/testsuite/tests/array/should_run/arr003.hs
blob: 8f156ab6d902773e50a0f3694b79b4d01d000fdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-- !!! Array creation, (index,value) list with out of bound index.
-- 
-- Haskell library report 1.3 (and earlier) specifies
-- that `array' values created with lists containing out-of-bounds indices,
-- are undefined ( _|_ ).
--
-- GHC implementation of `array' catches this (or, rather, 
-- `index' does) - the argument list to `array' is defined
-- to have its spine be evaluated - so the indexing below
-- should cause a failure.
--
import Data.Array

main =
 let a1 = array (1::Int,3) (zip ([1..4]) ['a'..'d']) in
 print (a1!2)