On Tue, Feb 1, 2011 at 6:26 PM, Roman Leshchinskiy <[email protected]> wrote:
> No, the operation is still impure. Suppose we had
>
> thawArray# :: Array# a -> Int# -> Int# -> MutableArray# s a
>
> Then, we write
>
> f xs = let ys = thawArray# xs 0 n#
>           zs = thawArray# xs 0 n#
>       in e
>
> Do ys and zs refer to the same MutableArray# in e?
>
>> Is it
>> even possible to return a MutableArray# without taking a state token as an
>> input parameter?
>
> No, for precisely this reason. In contrast to pure arrays, mutable arrays
> have an "identity", hence allocating them is impure.

Thanks for the clarification Roman. So the conclusion is that
cloneArray# loses its state token but everything else keeps it.

Johan

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to