Hi Brad

I think all you can do with an ST array is covered by the MArray class
and its derived operations - note the class is exported opaquely from
Data.Array.MArray - it has these two members that aren't exported so
aren't documented:


unsafeRead  :: Ix i => a i e -> Int -> m e
unsafeWrite :: Ix i => a i e -> Int -> e -> m ()

To actually read and write you have to use the safe derived operations
which wrap the unsafe versions:

readArray :: (MArray a e m, Ix i) => a i e -> i -> m e
writeArray :: (MArray a e m, Ix i) => a i e -> i -> e -> m ()

For practical purposes I've found STArray's a bit of a white elephant
- I always use IOArray instead, as I've either needed to initially
read an array from file or write one to file at the end. You can't do
this with ST.

Best wishes

Stephen

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to