[Haskell-cafe] curious about sum

Thomas Davie tom.davie at gmail.com
Sun Jun 14 15:10:57 EDT 2009


On 14 Jun 2009, at 12:47, Roman Cheplyaka wrote:

> * Deniz Dogan <deniz.a.m.dogan at gmail.com> [2009-06-13 16:17:57+0200]
>> I remember needing a non-strict sum at least once, but I do not
>> remember the exact application.
>
> We may agree that lazy sum is sometimes (rarely) needed, but then it  
> can
> be always written as fold. However, in most cases user wants strict  
> sum.
>
> So it's not really an excuse.

How's this for an "excuse" - Haskell is a lazy language.  It also  
happens to have support for strictifying things when necessary.  The  
Haskell API is designed to be lazy, like the rest of the language,  
similarly though, where commonly used, strict versions are provided,  
like for example foldl'.

A much better idea than making sum strict, would simply be to add a  
sum'.

Bob


More information about the Haskell-Cafe mailing list