<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
basically, what would be really nice is if there were something like<br>
<br>
&gt; registerCommitIO :: IO () -&gt; STM ()<br>
<br>
where all IO actions registered with this function (within an atomically<br>
block) are executed exactly once if and only if the atomically block<br>
commits. The IO action is not run within the STM block, notably<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;atomically $ do foo; registerCommitIO bar; baz<br>
<br>
is equivalent to<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;atomically (do foo; baz) &gt;&gt; bar<br><div><div class="Wj3C7c"></div></div></blockquote><div><br class="webkit-block-placeholder"></div><div>This is easy enough to whip up with a monad transformer over STM. I think the AdvSTM implementations [1] are rather complicated and heavyweight, but they give a general picture of how to proceed. A simple ReaderT with a TChan should do the trick quite nicely.</div>
<div><br class="webkit-block-placeholder"></div><div>[1]&nbsp;<a href="http://www.haskell.org/haskellwiki/New_monads/MonadAdvSTM">http://www.haskell.org/haskellwiki/New_monads/MonadAdvSTM</a></div></div><br><div>Regards,</div>
<div>Sterl.</div><div><br class="webkit-block-placeholder"></div><div>p.s. as for the issue of the Ord instance, I wonder if tsWord needs to be a TVar or if an IVar or IORef would be sufficient?</div>