[Haskell-cafe] Re: Caching the Result of a Transaction?

Ryan Ingram ryani.spam at gmail.com
Mon Apr 28 23:01:24 EDT 2008


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


More information about the Haskell-Cafe mailing list