Weak pointers and STM
s.clover at gmail.com
Tue Dec 2 21:10:08 EST 2008
> basically, what would be really nice is if there were something like
> > registerCommitIO :: IO () -> STM ()
> where all IO actions registered with this function (within an atomically
> block) are executed exactly once if and only if the atomically block
> commits. The IO action is not run within the STM block, notably
> atomically $ do foo; registerCommitIO bar; baz
> is equivalent to
> atomically (do foo; baz) >> bar
This is easy enough to whip up with a monad transformer over STM. I think
the AdvSTM implementations  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.
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Glasgow-haskell-users