I am strugging with grouping sequences of events into one atomic transaction.
Consider a Map
stored in acid-state, and imagine you want to implement Data.Map.alter
. The function that takes a maybe-value and returns one cannot be stored in the change log, so it is not possible to define an acidic event Alter
. However, if I write a function that calls query st Lookup ...
to lookup the old value and then update st Insert ...
to write the new one (or delete the old), there is a race condition and I might destroy information from updates that have happened in between.
In https://github.com/acid-state/acid-state/pull/48, I have used an extra MVar
to do manual locking, but there must be a better solution.
Any ideas?