
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
mailto:damian.nadales@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@gmail.com mailto:allbery.b@gmail.com