
Another important data point:
When default optimization is enabled, GHC recognizes that the sum
should be strict.
That, together with the historical context explained by Brandon, is
the reason why the definition of sum has not changed. It has been
discussed numerous times on this list and in various other forums in
the community over the years.
Regards,
Yitz
On Thu, Aug 16, 2018 at 6:46 PM, André Popovitch
+1, I would even think strict sum should be the default
On Wed, Aug 15, 2018, 8:08 AM Michael Snoyman
wrote: On Wed, Aug 15, 2018 at 8:40 AM Tom Ellis
wrote: On Tue, Aug 14, 2018 at 08:50:01PM +0200, Damian Nadales wrote:
On Tue, Aug 14, 2018 at 8:08 PM Bryan Richter wrote:
On 08/14/2018 11:22 AM, Damian Nadales wrote: 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.
Your rationale seems utterly reasonable and I'm surprised that you've even been asked to provide it. Everyone knows the problems with lazy sum. I'm actually astonished (and sorry) about the pushback you've received here. Having easy access to a sum function that doesn't blow up and *not* having easy access to one that does seem self evidently worthwhile.
Tom _______________________________________________ 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.
+1, I agree with this wholeheartedly. _______________________________________________ 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.
_______________________________________________ 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.