[Haskell-cafe] Small optimisation question

Tim Chevalier catamorphism at gmail.com
Sat Nov 17 19:31:35 EST 2007


On 11/17/07, Andrew Coppin <andrewcoppin at btinternet.com> 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?
>

To add to what others have said, you might want to read the Simons'
paper "Secrets of the Glasgow Haskell Compiler Inliner":
http://research.microsoft.com/~simonpj/Papers/inlining/
It's pretty accessible, and talks about the various knobs that can be
twiddled in order to influence the black art of inlining.

Cheers,
Tim

-- 
Tim Chevalier * catamorphism.org * Often in error, never in doubt
"'There are no atheists in foxholes' isn't an argument against
atheism, it's an argument against foxholes." -- James Morrow


More information about the Haskell-Cafe mailing list