I'm new to Haskell and STM and I'm trying to understand the basics concept.
In Haskell and Functional Programming in general,correct me if I'm wrong, there's no such thing like assignment.
I cannot write x=3;
all I can do is generate an other binding with x
and 3
.
Now when it comes to TVar and threads, if I have a number of threads sharing the same TVar, if one thread changes the value, with writeTVar
, the others thread will see the changed value, am I right?
So if I have 2 thread sharing the same TVar Int
var, and the first one add 1 to it, in case of success, the second thread will see the updated value?
Thaks