import Data.IORef main :: IO () main = do r <- newIORef [] writeIORef r ["Hello"] x <- readIORef r print $ x + 1 return ()
I think that the reason why it works is that because there is no way to let-bind r except with a toplevel unsafePerformIO.