<div dir="ltr">Thank you all for your answers, and my apologies for not framing the question properly.<br><div><br></div><div class="gmail_quote"><div dir="ltr">On Tue, Aug 14, 2018 at 9:57 PM Artem Pelenitsyn <<a href="mailto:a.pelenitsyn@gmail.com">a.pelenitsyn@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Damian,</div><div><br></div><div>thank you for this question, The discussion was thought-provoking for me. Going back to your original inquiry, by the way, I've just noticed this prelude where `sum` and `product` are strict: <a href="https://github.com/serokell/universum" target="_blank">https://github.com/serokell/universum</a> <br></div><div><br></div></div></blockquote><div>Great! Thanks (<a href="https://www.stackage.org/haddock/lts-12.6/universum-1.2.0/Universum-Container-Class.html#v:sum">https://www.stackage.org/haddock/lts-12.6/universum-1.2.0/Universum-Container-Class.html#v:sum</a>).<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>Bryan,</div><div><br></div><div>I still fail to see (in this thread also) any rationale for lazy `sum`. I looked at this2014 Reddit thread, and it seems that not only I am puzzled: <a href="https://www.reddit.com/r/haskell/comments/2agxcb/why_is_sum_lazy/" target="_blank">https://www.reddit.com/r/haskell/comments/2agxcb/why_is_sum_lazy/</a> <br></div><div><br></div><div>There is also an opinion (from quite authoritative source, may I add)  that `foldl` should be strict, not just `sum`: <a href="http://www.well-typed.com/blog/90/" target="_blank">http://www.well-typed.com/blog/90/</a></div><div><br></div><div>I wonder what does libraries committee think about all that. One way to find… <a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" target="_blank">https://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a> </div><div><br></div><div>--</div><div>Best, Artem<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, 14 Aug 2018 at 22:37 Bryan Richter <<a href="mailto:b@chreekat.net" target="_blank">b@chreekat.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 08/14/2018 02:57 PM, Damian Nadales wrote:<br>
> <br>
> <br>
> On Tue, Aug 14, 2018 at 8:10 PM Vanessa McHale <<a href="mailto:vanessa.mchale@iohk.io" target="_blank">vanessa.mchale@iohk.io</a> <mailto:<a href="mailto:vanessa.mchale@iohk.io" target="_blank">vanessa.mchale@iohk.io</a>>> wrote:<br>
> <br>
>     Yes, that was what I was never quite clear on. What is your *actual problem, in context*, not the problem you think you have because you read elsewhere that foldl' is more efficient?<br>
> <br>
> <br>
> The problem I have is that sum consumes huge amount of memory. In particular I'm modeling the Chimeric ledgers described in this paper <a href="https://eprint.iacr.org/2018/262.pdf" rel="noreferrer" target="_blank">https://eprint.iacr.org/2018/262.pdf</a>. In several places I have to<br>
> sum up values in different lists, and as soon as I try this with large lists the memory usage blows up. So that's my concrete scenario.<br>
> <br>
> In view of this, I though, "I can write this replacing `sum` by `foldl' (+) 0` but wouldn't be nice if this function was defined already somewhere else?" That's it.<br>
> <br>
> Please ignore this if it is a silly question, and my apologies in advance.<br>
>  <br>
<br>
I think your question is not silly, and quite reasonable. I think that giving more context up front, however, would have helped people understand what your were actually asking. Based solely on what<br>
you wrote, you might have been someone who was summing [1..10] for the first time ever and looking for that hypothetical foldl/foldl' analogue, like Vanessa said. :) Being specific helps.<br>
<br>
Having said all that, I am also surprised that `sum [1..100000000]` blows up! (But now I see others are responding with rationale for that.)<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div></div>