I am currently learning Haskell, and there is one thing that baffles me:
When I build a complex expression (whose computation will take some time) and this expressio
In this case, GHC can not be sure that the computation would finish. It's not a question of lazy versus strict, but rather the halting problem. To you, it looks quite simple to say that treeFromlist [0..90000]
is a constant that can be evaluated at compile time, but how does the compiler know this? The compiler can easily optimize [0..90000]
to a constant, but you wouldn't even notice this change.