On 25 June 2004 15:09, Daan Leijen wrote: > Ok, I never thought of that. However, isn't it the case > that I normally just want to get the old value back? > In that case, the current interface is not so friendly. > > Is anyone using this function to get something else than the > old/new value *and* where the computation is expensive? > > If not, maybe we should (also) provide a nicer interface?
I've no objection to providing simpler versions of the more general interface - in fact I believe we discussed this when atomicModifyIORef was introduced. How about: atomicModifyIORef_ :: IORef a -> (a -> a) -> IO a atomicModifyIORef_ r f = atomicModifyIORef r (\a -> (f a, a)) If this turned out to be a common case that needs to be fast, then we can implement it using a primitive in GHC. Cheers, Simon _______________________________________________ FFI mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/ffi