Write the thunk 'next' to the MVar
authorBas van Dijk <v.dijk.bas@gmail.com>
Fri, 19 Mar 2010 12:59:51 +0000 (12:59 +0000)
committerBas van Dijk <v.dijk.bas@gmail.com>
Fri, 19 Mar 2010 12:59:51 +0000 (12:59 +0000)
Data/Unique.hs

index 38c8e48..55dfa50 100644 (file)
@@ -45,7 +45,7 @@ newUnique :: IO Unique
 newUnique = atomically $ do
   val <- readTVar uniqSource
   let next = val+1
-  writeTVar uniqSource $! val + 1
+  writeTVar uniqSource $! next
   return (Unique next)
 
 -- SDM (18/3/2010): changed from MVar to STM.  This fixes