14 Jun
2009
14 Jun
'09
1:48 a.m.
Keith Sheppard wrote:
Is there any reason that sum isn't strict? I can't think of any case where that is a good thing.
Prelude> sum [0 .. 1000000] *** Exception: stack overflow
As others have said, there are cases where non-strictness is what you want. And if you are using a type that is strict (the common case), GHC's optimizations will catch it. The historical reason for this is that foldl' is not Haskell 98, only foldl. - Jake