arr004.hs 291 Bytes
Newer Older
1
2
3
4
5
-- !!! Array - accessing undefined element
-- 
-- Sample Haskell implementation in the 1.3 Lib report defines
-- this as being undefined/error.

6
import Data.Array
7
8
9
10
11
12
13
14
15

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

-- output: Fail: (Array.!): undefined array element