You shouldn't try to write these functions. You should do all array modifications within the ST monad, rather than looking for a pure solution.
- Hal -- Hal Daume III "Computer science is no more about computers | [EMAIL PROTECTED] than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume On 21 Jan 2003, Ketil Z. Malde wrote: > [EMAIL PROTECTED] (Ketil Z. Malde) writes: > > >> replace :: UArray Int Int -> [(Int,Int)] -> UArray Int Int > >> replace a p = runST (thaw a >>= \u -> update u p >> freeze u) > >> > >> update :: STUArray s Int Int -> [(Int,Int)] -> ST s () > >> update u ps = mapM_ (uncurry (writeArray u)) ps > > > (I'll be right back with the benchmarks.) > > I know you're all eagerly waiting for this, so here's a small progress > report. Or lack-of-progress report, if you like. > > Apparently, I get really huge memory consumption when using the above > repeatedly. Normally, I can deal with it, but profiling (-h) doesn't > show any likely culprit, the curves stay well below 60k for the most > part. I know there are different kinds of memory profiles (retainer > profile, etc), is that where I have too look? Or is the problem > something else? > > -kzm > -- > If I haven't seen further, it is by standing in the footprints of giants > _______________________________________________ > Haskell-Cafe mailing list > [EMAIL PROTECTED] > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
