<div dir="auto"><div>At a high level, it means it does what I think you're looking for: the "read end" of the channel created there isn't connected to anything, so there's no leak if there's no consumers. But duplicating it gives you a new "read end" that yields values as you would expect.<div dir="auto"><br></div><div dir="auto">Without going into too much detail about STM, everything runs in a transaction, and `retry` means to roll back any changes within the transaction and start again. An unconditional `retry` (including unconditionally reading from a channel created with `newBroadcastTChan`) is a deadlock and therefore probably a mistake. So don't do that!</div><br><div class="gmail_extra"><br><div class="gmail_quote">On 25 Jan 2017 05:41, "Saurabh Nanda" <<a href="mailto:saurabhnanda@gmail.com">saurabhnanda@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="quoted-text"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>The implementation in STM works well and certainly ticks the battle-tested box:</div><div><br></div><a href="https://hackage.haskell.org/package/stm-2.4.4.1/docs/Control-Concurrent-STM-TChan.html#v:newBroadcastTChan" target="_blank">https://hackage.haskell.org/pa<wbr>ckage/stm-2.4.4.1/docs/Control<wbr>-Concurrent-STM-TChan.html#v:<wbr>newBroadcastTChan</a></div></blockquote><div><br></div><div><br></div></div><div>What does the following comment in the documentation really mean (highlighted by >>><<<)?</div><div><br></div><div>"<span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px">Create a write-only</span><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px"> </span><code style="color:rgb(0,0,0);font-size:13px;margin:0px;padding:0px;line-height:16.12px"><a href="https://hackage.haskell.org/package/stm-2.4.4.1/docs/Control-Concurrent-STM-TChan.html#t:TChan" style="margin:0px;padding:0px;text-decoration:none;color:rgb(171,105,84)" target="_blank">TChan</a></code><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px">. >>> More precisely,</span><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px"> </span><code style="color:rgb(0,0,0);font-size:13px;margin:0px;padding:0px;line-height:16.12px"><a href="https://hackage.haskell.org/package/stm-2.4.4.1/docs/Control-Concurrent-STM-TChan.html#v:readTChan" style="margin:0px;padding:0px;text-decoration:none;color:rgb(171,105,84)" target="_blank">readTChan</a></code><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px"> </span><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px">will</span><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px"> </span><code style="color:rgb(0,0,0);font-size:13px;margin:0px;padding:0px;line-height:16.12px"><a href="https://hackage.haskell.org/package/stm-2.4.4.1/docs/Control-Monad-STM.html#v:retry" style="margin:0px;padding:0px;text-decoration:none;color:rgb(171,105,84)" target="_blank">retr<wbr>y</a></code><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px"> </span><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px">even after items have been written to the channel.<<< The only way to read a broadcast channel is to duplicate it with</span><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px"> </span><code style="color:rgb(0,0,0);font-size:13px;margin:0px;padding:0px;line-height:16.12px"><a href="https://hackage.haskell.org/package/stm-2.4.4.1/docs/Control-Concurrent-STM-TChan.html#v:dupTChan" style="margin:0px;padding:0px;text-decoration:none;color:rgb(171,105,84)" target="_blank">dupTChan</a></code><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px">."</span></div><font color="#888888"><div><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px">-- Saurabh.</span></div><div><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px"><br></span></div></font></div>
</div></div>
</blockquote></div><br></div></div></div>