Concerning the scoping rules, in the following the variable x is not being reassigned. Instead there are two variables with the same name.

main = 
  do
    x <- getLine
    do x<- getLine
       putStrLn x
    putStrLn x