[Haskell-cafe] Flattening tail recursion?

Jules Bean jules at jellybean.co.uk
Fri Dec 10 10:53:26 EST 2004

On 10 Dec 2004, at 15:34, Robert Dockins wrote:
> So it should get "flattened," but it still doesn't run in constant 
> space because the "x" parmeter isn't strict, so it will accumulate a 
> bunch of closures like (((((((0)+1)+1)+1)+1)+1).... To make it strict, 
> do something like this:

Isn't this what the strictness analyser is for? Doesn't GHC know that + 
for Int is strict in both arguments, and therefore it shouldn't 
accumulate a great big thunk like that?


More information about the Haskell-Cafe mailing list