On 12/13/05, Tomasz Zielonka <[EMAIL PROTECTED]> wrote: > On Tue, Dec 13, 2005 at 01:32:46PM +0100, Sebastian Sylvan wrote: > > Are there plans to include a mutable array for use in the STM monad, > > or a good reason for why this is not needed? Also, an unboxed version > > would be nice. > > Why not use an (Array idx (TVar a)) ?
Ah.. Good thinking! This should work for in the STM monad for anything you would IOArray for in the IO monad, if you write proper instances for MArray of course... It's a bit inefficient, an extra indirection (compared to a primitive implementation) but that shouldn't matter too much for the general case. And the TVars themselves introduces some extra overhead, I would suppose (which could be per-array rather than per-element, without losing the property that only writes to the same element causes retries). It gets even trickier if you want an unboxed mutable array in the STM monad. But still, it's useful and I think a mutable array for the STM monad should be in the libraries. It could be implemented as an Array at first, and perhaps later switch to a more efficient representation. /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862 _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell