Is there a library that has a strict version of `sum`?

I thought the answer would be easy to find on the internet, but I cannot find any package that features a strict version of `sum`. Do you know if such a function is defined anywhere? (like a custom prelude for instance) I know it is trivial to define, but I would prefer not to repeat myself (and somebody else). Thanks!

Hello Damian,
If anything, I would expect this function to be called sum'. Hayoo knows
just a handful of such functions, only one of which does what you want:
http://hackage.haskell.org/package/combinat-0.2.8.2/docs/Math-Combinat-Helpe...
This doesn't imply that there is no such function at all: the name could be
different or Hayoo might have troubles to find it.
--
Best, Artem
On Tue, 14 Aug 2018, 12:10 Damian Nadales,
I thought the answer would be easy to find on the internet, but I cannot find any package that features a strict version of `sum`.
Do you know if such a function is defined anywhere? (like a custom prelude for instance)
I know it is trivial to define, but I would prefer not to repeat myself (and somebody else).
Thanks! _______________________________________________ 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.

If you'd rather import a custom prelude instead of writing `sum = foldl' (+) 0` you might want to think about how dependencies affect maintaining a package. What's the actual problem you're trying to solve? On 08/14/2018 04:09 AM, Damian Nadales wrote:
I thought the answer would be easy to find on the internet, but I cannot find any package that features a strict version of `sum`.
Do you know if such a function is defined anywhere? (like a custom prelude for instance)
I know it is trivial to define, but I would prefer not to repeat myself (and somebody else).
Thanks!
_______________________________________________ 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.

`sum = foldl' (+) 0`
here is another possibility with "sum" in it:
Prelude Data.Monoid> let f = getSum . mconcat . (Sum <$>)
Prelude Data.Monoid> f [1,2,3,4]
10
On 14 August 2018 at 17:24, Vanessa McHale
If you'd rather import a custom prelude instead of writing `sum = foldl' (+) 0` you might want to think about how dependencies affect maintaining a package.
What's the actual problem you're trying to solve?
On 08/14/2018 04:09 AM, Damian Nadales wrote:
I thought the answer would be easy to find on the internet, but I cannot find any package that features a strict version of `sum`.
Do you know if such a function is defined anywhere? (like a custom prelude for instance)
I know it is trivial to define, but I would prefer not to repeat myself (and somebody else).
Thanks!
_______________________________________________ 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.

That isn't strict. On 8/14/2018 4:38 PM, Imants Cekusins wrote:
`sum = foldl' (+) 0`
here is another possibility with "sum" in it:
Prelude Data.Monoid> let f = getSum . mconcat . (Sum <$>) Prelude Data.Monoid> f [1,2,3,4] 10
On 14 August 2018 at 17:24, Vanessa McHale
mailto:vanessa.mchale@iohk.io> wrote: If you'd rather import a custom prelude instead of writing `sum = foldl' (+) 0` you might want to think about how dependencies affect maintaining a package.
What's the actual problem you're trying to solve?
On 08/14/2018 04:09 AM, Damian Nadales wrote:
I thought the answer would be easy to find on the internet, but I cannot find any package that features a strict version of `sum`.
Do you know if such a function is defined anywhere? (like a custom prelude for instance)
I know it is trivial to define, but I would prefer not to repeat myself (and somebody else).
Thanks!
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe 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 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.
participants (5)
-
Artem Pelenitsyn
-
Damian Nadales
-
David Kraeutmann
-
Imants Cekusins
-
Vanessa McHale