
On Mon, 3 Nov 2014, Niklas Hambüchen wrote:
On 03/11/14 17:59, Henning Thielemann wrote:
I would prefer a strict foldl provided by the deepseq package and deprecate foldl' in favor of deepseq:foldl. This new foldl could immediately implement the unconditional strictness for the initial accumulator value.
This has the problem though that `deepseq` will traverse the entire structure, and while seq traversals are quite fast, if done n times it will still take n*n time
If 'seq' is faster than 'deepseq' it leaves things unevaluated and thus builds up unevaluated expressions, right?
What I mean to say is: Using `deepseq` in `foldl'` might forbid you to write some recursive code, e.g. in the cases where you call an outer foldl' on something whose substructure you used foldl', like when you use foldl' to fold up a tree from the leaves up.
I can't follow. :-( Do you have an example?