stm: newBroadcastTChan and friends (a proposal, and a question)
Edward Kmett
ekmett at gmail.com
Mon May 13 18:54:37 CEST 2013
+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
> read <- newTVar (error ...)
> 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)
>
> Thus, whoever changed the definition of newBroadcastTChan in 2.4.2 forgot
> to change newBroadcastTChanIO to keep it in sync.
>
> PROPOSAL: I propose changing newBroadcastTChanIO to match
> newBroadcastTChan. (Deadline: 2 weeks)
>
>
> QUESTION: Is there any way to re-implement these functions using only the
> public API of version 2.3?
>
> --
> Live well,
> ~wren
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
More information about the Libraries
mailing list