From a98c0b648d431a7200554ee6c376ac9ddcc9fcb4 Mon Sep 17 00:00:00 2001 From: simonm Date: Mon, 23 Feb 1998 12:22:46 +0000 Subject: [PATCH] [project @ 1998-02-23 12:22:45 by simonm] add multi-dimensional array test. --- ghc/tests/array/should_run/arr014.hs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 ghc/tests/array/should_run/arr014.hs create mode 100644 ghc/tests/array/should_run/arr014.stdout diff --git a/ghc/tests/array/should_run/arr014.hs b/ghc/tests/array/should_run/arr014.hs new file mode 100644 index 0000000..86996a1 --- /dev/null +++ b/ghc/tests/array/should_run/arr014.hs @@ -0,0 +1,28 @@ +{-# OPTIONS -fglasgow-exts #-} + +--!!! multi-dimensional arrays + +module Main ( main ) where +import GlaExts +import Array + +type TwoD s = MutableArray s Int (MutableArray s Int Int) + +setup :: ST s (TwoD s) +setup = let isz = 10 + imax = isz - 1 + osz = 2 + omax = osz - 1 in + do + -- gives : undefined reference to `IOBase_error_closure' +-- x <- newArray (0, omax) (error "uninitialised") + dmy <- newArray (0, imax) 0 + x <- newArray (0, omax) dmy + as <- (accumulate . replicate osz) (newArray (0, imax) 6) + mapM_ (\(i,v) -> writeArray x i v) (zip [0..omax] as) + return x + +main :: IO () +main = do + a <- stToIO setup + return () diff --git a/ghc/tests/array/should_run/arr014.stdout b/ghc/tests/array/should_run/arr014.stdout new file mode 100644 index 0000000..e69de29 -- 1.7.10.4