
I take it that this follows from the lack of any mechanism to rollback
IO? If so, I think that the following guidelines suffice for when
it's acceptable to use unsafeIOtoSTM:
1. The IO action must be able to be safely repeated.
2. The IO action must be able to be safely performed with
possibly-incorrect arguments, even if it isn't supposed to be
performed.
3. Don't try to nest transactions.
If I understand it correctly, I think that covers it.
Thanks to everyone who answered; I really appreciate it.
John
On Wed, Feb 20, 2008 at 8:02 PM, Ryan Ingram
On 2/20/08, Bulat Ziganshin
wrote: STM operations can be repeated if first transaction was unsuccessful. so, you may se here only operations that may be safely repeated - say, reading/writing memory areas, or reading/writing files, or even sending network message as long as its duplication is ok
Actually, you have to be even more careful than that; you may only include not just operations that may be safely repeated, but operations that may be erroneously executed. Consider the following snippet: