In my Haskell program, I want to have an expression, in essence, equivalent to the following
cList = [i | i <- [1 .. ], i <= 5]
but it seems that the evaluation of cList will not terminate, producing
[1, 2, 3, 5
in ghci session, but never return, and the CPU of my computer kept running.
but the following equivalent will terminate as expected:
bList = takeWhile (<= 5) [1 ..]
What's wrong with the expression cList as infinite list compression with a filter condition?
?