Strict foldl

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Mon Feb 6 14:43:46 EST 2006


Haskell standard should get a strict foldl: either under some new
standard name (foldl' is most common), or just replacing foldl.

Is there a real-life case where a lazy foldl is desirable? I don't
mean a constructed artificial example, I know they exist, but
something which is really used.

Currently usages of foldl fall into two major groups: those which are
inlined and transformed into a strict foldl by an optimizing compiler,
and those which have a space leak and a potential for stack overflow
for large data.

Even if there are cases where a lazy foldl is essential, I would
prefer to have to code them with an explicit recursion, and reserve
foldl for the more common cases where it should better be strict.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Haskell-prime mailing list