[Haskell-cafe] Is there a library that has a strict version of `sum`?

Damian Nadales damian.nadales at gmail.com
Tue Aug 14 18:50:01 UTC 2018


On Tue, Aug 14, 2018 at 8:08 PM Bryan Richter <b at chreekat.net> wrote:

> On 08/14/2018 11:22 AM, Damian Nadales wrote:
>
> > Ok, so if understood the bottom line of the answers I got from
> > Vanessa and Hiromi the take away seems to be: if you're prototyping
> > then stick to the lazy version of sum, otherwise use more advanced
> > data structures (Vectors or Folds).
>
> Are you implying that lazy functions are only good for prototyping? Or
>
No. I know lazy functions can be quite useful.


> is there something wrong with sum in particular?
>
> From the point of view of somebody that is not that bright, like myself,
it seems. Why would you need to build a huge thunk containing the
representation of a sum of values. It is not that you can pattern match on
integers or consume the sum incrementally.

I apologize if I infuriate people, but I really don't get the usefulness of
a lazy sum function.



> More generally, why isn't sum working for you?
>
> Because if I want to test my function with 100000000 values it consumes a
lot of memory.


> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180814/830db3fe/attachment.html>


More information about the Haskell-Cafe mailing list