<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><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/<wbr>package/stm-2.4.4.1/docs/<wbr>Control-Concurrent-STM-TChan.<wbr>html#v:newBroadcastTChan</a></div></blockquote><div><br></div><div><br></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)">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)">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)">retry</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)">dupTChan</a></code><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:13px">."</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"><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></div>
</div></div>