16 Oct
2006
16 Oct
'06
6:43 p.m.
On Mon, 2006-10-16 at 14:23 +0400, Serge D. Mechveliani wrote:
Concerning the laziness support problem,
I thank people for explanations about foldl and foldr.
I wonder how to avoid these numerous cost pitfalls. Maybe, the complier could do more optimization?
Duncan Coutts <duncan.coutts@worc.ox.ac.uk> writes
There are important differences between foldl, foldl' and foldr. It is quite important to choose the right one. I don't think this can be done automatically.
In my experience, the choice is almost always between foldl' and foldr.
[..]
I do not see foldl' in the standard library. Is it of the GHC lib extension? has it strictness annotation?
It's in the standard Data.List module. It's not in the Prelude. Duncan