Guest User

Untitled

a guest
Jun 19th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. withraw :: Account -> Int -> STM ()
  2. withraw acc amount =
  3.     do { bal <- readTVar acc
  4.        ; if amount > 0 && amount > bal
  5.          then retry
  6.          else writeTVar acc (bal - amount) }
Add Comment
Please, Sign In to add comment