[Haskell-cafe] STM and FFI

Jules Bean jules at jellybean.co.uk
Tue Sep 9 05:58:57 EDT 2008

Arnar Birgisson wrote:
> On Tue, Sep 9, 2008 at 11:36, Jules Bean <jules at jellybean.co.uk> wrote:
>> ...not only must it be safe to be called with invalid inputs, but it most
>> not have any long-term effects, whether the input is valid or invalid, since
>> I do not believe that there is any way for the function to 'undo' its effect
>> at 'retry' time.
> Maybe this is an idea for an extension to the STM system, adding
> something like unsafeIOToSTM, except that in addition to the main IO
> action, it also takes two more IO actions that are invoked on rollback
> and commit, respectively.
> This might allow for integration with transactional systems (e.g. a
> remote transaction on an rdbms), although to support two-phased commit
> we'd need a third action for the "prepare" step.

That would be an absolutely killer feature.

A common problem in large systems is that the underlying RDBMS supports 
transactionality, but then the software layer has to handle its own 
rollbacks. I've seen some nasty bugs when the DB rolled back and the 
software didn't.

If we could have a transactional RDBMS linked into STM with matching 
semantics, that would be a very nice thing.


More information about the Haskell-Cafe mailing list