There's no "the compiler". :)  There are many compilers.  I don't know of any that evaluate those expressions at compile time, but it's certainly not forbidden.  Nor would it be exceedingly hard to implement.
<br>But it&#39;s not too bad to do it at run time either, because it will (most likely) only be evaluated once at run time.<br><br>&nbsp; -- Lennart<br><br><div class="gmail_quote">On Nov 17, 2007 4:01 PM, Andrew Coppin &lt;<a href="mailto:andrewcoppin@btinternet.com">
andrewcoppin@btinternet.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Suppose I write something like this:<br><br> &nbsp;foo :: [Int]
<br> &nbsp;foo = concat (replicate 4 [4,7,2,9])<br><br>The value of &quot;foo&quot; is completely determined at compile-time. So, will<br>the compiler generate calls to concat and replicate, or will it just<br>insert a large list constant here?
<br><br>Obviously, once somebody has completely examined the contents of &quot;foo&quot;,<br>after that point it won&#39;t matter either way. I&#39;m just curiose.<br>Concatinating some strings is cheap; I sometimes write constructs like
<br>the above using much more expensive operations. (Expensive in time; the<br>space taken up by the result isn&#39;t that great.)<br><br>_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org">
Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></blockquote></div><br>