[Haskell-cafe] runST

Joel Reymont joelr1 at gmail.com
Fri Oct 7 18:37:57 EDT 2005


Folks,

Why use runST in the following example at

http://www.n-heptane.com/nhlab/repos/NewBinary/Tests/BinDouble.hs ?

doubleToInts d = runST (
     do arr <- newDoubleArray (1,2)
        writeDoubleArray arr 1 d
        i1 <- readIntArray arr 1
        i2 <- readIntArray arr 2
        return (i1,i2))

Isn't it possible to do the same within the IO monad?

     Thanks, Joel

--
http://wagerlabs.com/idealab







More information about the Haskell-Cafe mailing list