[Haskell-cafe] curious about sum

Thomas Davie tom.davie at gmail.com
Tue Jun 16 07:31:53 EDT 2009


On 16 Jun 2009, at 05:18, Don Stewart wrote:

> keithshep:
>> The answer is sometimes (only if you use an optimize flag):
>
> You're turning on the strictness analyser. That's enabled with -O or
> -O2.
>
> But sum should be using a tail recursive foldl'. It's a bug in the H98
> report, IMO.

Not at all, as discussed, there are legitimate uses for a lazy sum,  
and haskell is a lazy language by default.  The only change here needs  
to be either claus' suggestion of generalizing functions over their  
application operator, or providing a strict sum'.

Bob


More information about the Haskell-Cafe mailing list