X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Flib%2Ftests%2FArray%2Farr002%2FMain.hs;fp=ghc%2Flib%2Ftests%2FArray%2Farr002%2FMain.hs;h=fd3bf7e3dd66001aa25fa110699cd24f25bf0503;hb=1fb1ab5d53a09607e7f6d2450806760688396387;hp=0000000000000000000000000000000000000000;hpb=fa6fb09e2e4e6918eebc79ed187f32c88817c9db;p=ghc-hetmet.git diff --git a/ghc/lib/tests/Array/arr002/Main.hs b/ghc/lib/tests/Array/arr002/Main.hs new file mode 100644 index 0000000..fd3bf7e --- /dev/null +++ b/ghc/lib/tests/Array/arr002/Main.hs @@ -0,0 +1,23 @@ +-- Array creation, (index,value) list with duplicates. +-- +-- Haskell library report 1.3 (and earlier) specifies +-- that `array' values created with lists containing dups, +-- are undefined ( _|_ ). +-- +-- GHC-2.02 (and earlier) does not flag this as such, the +-- last (index,value) is instead used. +-- +-- The report also specifies `array' is spine strict in +-- the (index,value) list argument and to check the +-- validity of the index values upon creation, it also +-- strict for the indices. To test this, we do (a!1) +-- twice, expecting to see the same value.. +-- +import Array + +main = + let a1 = array (1,3) (zip (1:[1..3]) ['a'..'d']) in + print (a1!1) >> + print a1 >> + print (a1!1) +