It began to work. The code is still a mess, though.

* Works only for MVar functions putMVar and takeMVar, and new(Empty)?MVar for binding;

* Doesn't account yet for other functions but the one where the variable is selected;

* I haven't tested it with anything besides refactoring a single variable inside a main function.