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

Vanessa McHale vanessa.mchale at iohk.io
Tue Aug 14 19:35:44 UTC 2018

Yes, writing sum' = foldl' (+) 0 in a project-specific prelude (or even
a local binding) is much more maintainable than grabbing a dependency on
a custom prelude.

On 08/14/2018 02:25 PM, Brandon Allbery wrote:
> On Tue, Aug 14, 2018 at 2:57 PM Damian Nadales
> <damian.nadales at gmail.com <mailto:damian.nadales at gmail.com>> wrote:
>     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.
> There's a certain tendency for people to look for even trivial canned
> solutions, which to my mind misses the point of functional
> programming. It's trivial to build exactly what you need from the
> building blocks you have, so canned solutions like Prelude "sum" lead
> both to this kind of problem when they don't quite fit, and at the
> same time inappropriately encourage people to go looking for "more
> appropriate" canned solutions.
> -- 
> brandon s allbery kf8nh
> allbery.b at gmail.com <mailto:allbery.b at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180814/2fa440bb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180814/2fa440bb/attachment.sig>

More information about the Haskell-Cafe mailing list