Running this code:
j = let x = 4
in let x = x * x
in x
in the interpreter:
ghci> j
... no response ...
hangs with very little CPU utilization. Why is this? I expected j = 16.
Running this code:
j = let x = 4
in let x = x * x
in x
in the interpreter:
ghci> j
... no response ...
hangs with very little CPU utilization. Why is this? I expected j = 16.
According to the Haskell report, section 3.12:
(emphasis mine)
So in the second
let, wherex = x * x, allxs refer to the same binding, none refer to the outerx = 4binding.