Skip to content
Snippets Groups Projects
Commit a98c0b64 authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 1998-02-23 12:22:45 by simonm]

add multi-dimensional array test.
parent e2f1d3a5
No related merge requests found
{-# 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 ()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment