foldl laziness support. Reply
duncan.coutts at worc.ox.ac.uk
Mon Oct 16 06:43:02 EDT 2006
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 at 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.
More information about the Glasgow-haskell-users