Thanks, Ryan, for the reminder and explanation of this problem.  - Conal

On Mon, Apr 28, 2008 at 8:01 PM, Ryan Ingram <ryani.spam@gmail.com> wrote:
The problem I have with all of these STM-based solutions to this
problem is that they don't actually cache until the action fully
executes successfully.

For example, if you have a :: TIVal a, and f :: a -> TIVal b, and you execute
  force (a >>= f)

and the action returned by f executes retry for whatever reason, then
the caching done in "a" gets undone.  Ideally I want to be able to
provide some proof that the result of a is pure and have it committed
immediately when it finishes.

Every attempt I've had so far to solve this problem ends up being some
type of the form
  newtype X a = IO (STM (Either a (X a)))
which has its own problems.

 -- ryan