
On Tue, Mar 28, 2006 at 12:24:09AM +0100, Ross Paterson wrote:
How about STM (minus retry/orElse) and TVars as the portable interface? They're trivial for a single-threaded implementation, and provide a comfortable interface for everyone.
It may be relevant for this discussion: I believe I reimplemented STM, including retry and orElse, on top of old GHC's concurrency primitives. I say 'believe' because I didn't prove it's correct, and I only performed limited testing. However, it shouldn't be too surprising that it was possible - after all if STM can be implemented in C, why couldn't it be implemented in Haskell/GHC itself? The code is here in a darcs repo: http://www.uncurry.com/repos/FakeSTM/ Perhaps it could serve as a drop-in replacement for STM in haskell compilers which don't implement STM directly. Best regards Tomasz