Tell me more ×  I thought expressions like this would cause
Haskell to evaluate forever. But the behaviors in both GHCi and
the compiled program surprised me.  For example, in GHCi, these
expressions blocked until I Control+C, but consumed no CPU.
Looked like it was sleeping.  let loop = loop let loop = 1 +
loop  I tried compiling these programs with GHC:  main = print
loop   where loop = 1 + loop  main = print loop   where loop =
if True then loop else 1  What was printed was:  Main: <<loop>>
So my question is: Obviously these expressions are compiled to
something different than loops or recursive calls in imperative
languages. What are they compiled to? Is this a special rule to
handle 0-arg functions that have themselves in the right hand
side, or it's a special case of something more general that I
don't know?   One more question: If this happens to be a special
handling from the compiler, what is the reason behind doing this
when it's impossible to check for all infinite loops? 'Familiar'
languages don'