
19 Mar
2010
19 Mar
'10
9:16 a.m.
On Thu, Mar 18, 2010 at 11:45 AM, Simon Marlow
Thanks, I'm actually going to change this to use STM as it does a better job than MVars in this case.
Hi Simon, I see you actually write 'val+1' to the MVar: newUnique :: IO Unique newUnique = atomically $ do val <- readTVar uniqSource let next = val+1 writeTVar uniqSource $! val + 1 return (Unique next) Why don't you write 'next' so that when you force the returned Unique it doesn't need to be computed a second time? (The attached patch fixes it) regards, Bas