[Haskell] help with IOArray

robert bauer shlomobauer at mac.com
Sun Aug 19 10:52:59 EDT 2007


I have an IOArray, but it doesn't work the way I expected it to.

I defined

newMem s = newIOArray (0, size-1) 0

and then

x = newMem 30

then

do {
   y <- x
 ; v <- readIOArray y 2
 ; print v
 ; writeIOArray y 2 20
 ; v <- readIOArray y 2
 ; print v
}

this resulted in 0, 2  as expected.

however, then

do {
 y <- x
 ; v <- readIOArray y 20
 ; print v
}

results in 0

I thought the IOArray was basically a static structure?

Thanks


More information about the Haskell mailing list