It definitely has a lot to do with types in Haskell though. You can only operate on transactional variables in STM context. The STM action when run is what gives you atomicity and isolation.
Ref page 8-9 in [1]
[1] https://www.microsoft.com/en-us/research/publication/beautif...