daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Jul 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Control.Concurrent.STM
  2.  
  3. import Control.Concurrent.STM.TVar
  4.  
  5. transfer :: Int -> TVar Int -> TVar Int -> STM ()
  6.  
  7. transfer v a b = do
  8.  
  9.  x <- readTVar a
  10.  
  11.  y <- readTVar b
  12.  
  13.  writeTVar a (x - v)
  14.  
  15.  writeTVar b (y + v)  //displaying value of a and b
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top