<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><div>And look at what we have: A definitive answer to OP's question:<br></div></span><div><br></div><div>Question: What is a fold of type "(a -> a -> a) -> [a] -> a" that promises to call its first parameter "associatively"?<br><br></div><div>Answer: It is a fold equivalent to a fold1 (left or right, it doesn't matter).<br><br></div><div>That's nice.<br><br>But is that all we can come up with? Does it really do justice to the original question? Viz.</div></div></div></div></blockquote><div><br></div><div>Hello,</div><div><br></div><div>Sorry for jumping into the thread, but I've read the previous responses, and I still don't get it (perhaps it's because I'm not a native English speaker): what does "associatively" mean in this context? From what I understand, "associativity" is a property of a function, that f (f a b) c = f a (f b c). Nothing more, nothing less. In order to encode this property in the type of a "fold" function, you'd need dependent types and a type-level proof that a given function is associative. Without dependent types, you can only trust the user to either supply an associative function, or accept wrong results (like REPA does). Am I missing something?<br></div><div><br></div><div>Best regards,</div><div>Marcin Mrotek</div></div></div></div>