[Haskell-cafe] Small optimisation question
andrewcoppin at btinternet.com
Sat Nov 17 11:10:58 EST 2007
Stefan O'Rear wrote:
> On Sat, Nov 17, 2007 at 04:01:34PM +0000, Andrew Coppin wrote:
>> Suppose I write something like this:
>> foo :: [Int]
>> foo = concat (replicate 4 [4,7,2,9])
>> The value of "foo" is completely determined at compile-time. So, will the
>> compiler generate calls to concat and replicate, or will it just insert a
>> large list constant here?
> The compiler will generate calls to concat and replicate.
OK. I presume this is due to the fact that the result of executing an
expression at compile-time could be arbitrarily large?
Are there any buttons that can be twiddled to control this behaviour?
For that matter, when I say "[4,7,2,9]", what does that compile into?
Some data structures in memory? Or code to actually build said structures?
More information about the Haskell-Cafe