[Haskell-cafe] Re: Lock-Free Data Structures using STMs in Haskell
Pete Kazmier
pete-expires-20080608 at kazmier.com
Wed Apr 9 20:52:26 EDT 2008
Bryan O'Sullivan <bos at serpentine.com> writes:
> Pete Kazmier wrote:
>
>> data ArrayBlockingQueueSTM e = ArrayBlockingQueueSTM {
>> [...]
>> sa :: Array Int (TVar e)
>> }
>>
>> It's unclear to me why the Array's elements must be wrapped in TVars.
>
> To allow them to be modified. You can't otherwise modify the elements
> of an array without going into the ST monad.
Thanks! I forgot about the whole immutable thing :-) Haven't used
arrays yet while learning Haskell!
More information about the Haskell-Cafe
mailing list