
Hello Andrew, Thursday, November 29, 2007, 9:43:48 PM, you wrote:
Fifth thing: better use an STUArray, don't drag IO in if it's not necessary.
I don't understand the ST monad.
it's just a subset of IO monad, with renamed operations the subset is selected in the way that guarantees reference transparency, i.e. compiler is able to do more checks that your program is correct. so, instead of writing main = do a <- newArray writeArray a 1 3.14 x <- readArray a 1 print x you can write main = do x <- runST (do a <- newArray writeArray a 1 3.14 x <- readArray a 1 return x) print x -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com