I recently wrote some Haskell code and it never terminates. After I carefully examined my code, the problem boiled down to the following code piece
main :: I
The second binding (a = a
) shadows the other one. The first example is (almost) exactly equivalent to
main = print $ let xyz = 10 in
let a = a in
a :: Int
and I hope it's clear why that one doesn't terminate! You can get GHC to warn you about this by using the -fwarn-name-shadowing
flag (or by entering :set -fwarn-name-shadowing
in GHCi)