Why are (constant) expressions not evaluated at compile time in Haskell?
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 expression is constant (meaning it is build only of known, hard coded values), the expression is not evaluated at compile time. Comming from a C/C++ background I am used to such kind of optimization. What is the reason to NOT perform such optimization (by default) in Haskell / GHC ? What are the advantages, if any? data Tree a = EmptyTree | Node a (Tree a) (Tree a) deriving (Show, Read, Eq) elementToTree :: a -> Tree a elementToTree x =