wren ng thornton | 13 May 07:24 2013

stm: newBroadcastTChan and friends (a proposal, and a question)

Hello all,

While looking through the pull requests for stm-chans I came across a
discrepancy in the new stm. Namely, we have the following definitions:

* stm == 2.4
    newBroadcastTChan :: STM (TChan a)
    newBroadcastTChan = do
        dummy_hole <- newTVar TNil
        write_hole <- newTVar TNil
        read <- newTVar dummy_hole
        write <- newTVar write_hole
        return (TChan read write)

    newBroadcastTChanIO :: IO (TChan a)
    newBroadcastTChanIO = do
        dummy_hole <- newTVarIO TNil
        write_hole <- newTVarIO TNil
        read <- newTVarIO dummy_hole
        write <- newTVarIO write_hole
        return (TChan read write)

* stm == 2.4.2
    newBroadcastTChan :: STM (TChan a)
    newBroadcastTChan = do
        write_hole <- newTVar TNil
        read <- newTVar (error ...)
        write <- newTVar write_hole
        return (TChan read write)

(Continue reading)

Edward Kmett | 13 May 18:54 2013
Picon

Re: stm: newBroadcastTChan and friends (a proposal, and a question)

+1

On May 13, 2013, at 1:24 AM, "wren ng thornton" <wren <at> freegeek.org> wrote:

> Hello all,
> 
> While looking through the pull requests for stm-chans I came across a
> discrepancy in the new stm. Namely, we have the following definitions:
> 
> * stm == 2.4
>    newBroadcastTChan :: STM (TChan a)
>    newBroadcastTChan = do
>        dummy_hole <- newTVar TNil
>        write_hole <- newTVar TNil
>        read <- newTVar dummy_hole
>        write <- newTVar write_hole
>        return (TChan read write)
> 
>    newBroadcastTChanIO :: IO (TChan a)
>    newBroadcastTChanIO = do
>        dummy_hole <- newTVarIO TNil
>        write_hole <- newTVarIO TNil
>        read <- newTVarIO dummy_hole
>        write <- newTVarIO write_hole
>        return (TChan read write)
> 
> * stm == 2.4.2
>    newBroadcastTChan :: STM (TChan a)
>    newBroadcastTChan = do
>        write_hole <- newTVar TNil
(Continue reading)

John Wiegley | 13 May 21:57 2013

Re: stm: newBroadcastTChan and friends (a proposal, and a question)

>>>>> Edward Kmett <ekmett <at> gmail.com> writes:

> +1

+1

--

-- 
John Wiegley
FP Complete                         Haskell tools, training and consulting
http://fpcomplete.com               johnw on #haskell/irc.freenode.net

Gmane