STM slightly conservative on write-only transactions
The STM appears to be slightly too conservative on write-only transactions.
It will store a copy of the current (that is, old) value on a writeTVar, even if it was never read from. This can cause a spurious retry.
atomically $ writeTVar tv 0 really has no reason to ever retry. Neither, in fact, does
atomically $ mapM (\tv -> writeTVar tv 0) [tv1,tv2,tv3,tv4].
My suggestion is to instead indicate "no prior value" for that TVar, and then make no consistency checks on TVars marked as no prior value...