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.

>   decPair v1 v1 :: TVar Int -> TVar Int -> IO ()
>   decPair v1 v2 = atomically (decT v1 `orElse` decT v2)
> 
> Will this actually compile?  I was under the impression that 'orElse'
> could only combine STM types, not IO () types.  

The type of atomically is STM a -> IO a.

        <b
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to