[Haskell-cafe] More STUArray questions

Einar Karttunen ekarttun at cs.helsinki.fi
Sun Mar 12 14:15:57 EST 2006

On 12.03 18:44, Martin Percossi wrote:
> However, just out of curiosity, I'm still curious at how I could do the
> runSTMatrix, which would really be the icing on the cake in terms of client
> usability.

You might want to look at the definition of Data.Array.ST
(at http://darcs.haskell.org/packages/base/Data/Array/ST.hs)
runSTUArray is defined as follows:

runSTUArray :: (Ix i)
   => (forall s . ST s (STUArray s i e))
   -> UArray i e
runSTUArray st = runST (st >>= unsafeFreezeSTUArray)

A similar way should work for matrixes.

- Einar

More information about the Haskell-Cafe mailing list