[GHC] #3709: Data.Either.partitionEithers is not lazy enough

Malcolm Wallace malcolm.wallace at cs.york.ac.uk
Thu Dec 3 20:19:10 EST 2009

>>> No non-bottoming program
>>> has changed, but fewer programs fail now. I find it hard to imagine
>>> that anyone could have been relying on getting a crash here.
>> Making something more lazy can cause a memory leak.

But in this case, leaving it strict would be responsible for a memory  
leak, whereas laziness removes the leak for some cases.  In those  
cases where the lazy version still has a memory leak, the strict  
version also suffers from the same leak.

> and a time leak, or a stack overflow.  People might complain if we  
> made foldl' more lazy :-)

I believe there is general agreement that Haskell library functions  
should be lazy by default.  Where there is a compelling case for  
strictness, it is usually noted by changing the name, e.g. foldl vs  
foldl'.  Where something has explicitly been strictified, of course  
making it lazy again would rightly provoke howls of protest.  But  
where a function seems to be *un*intentionally too strict...?

To come back to the specifics of partitionEithers, is anyone arguing  
that, in this case, the original over-strictness is either  
intentional, or useful?


More information about the Libraries mailing list