[Haskell-cafe] 'Associative' order of calling

Charles Durham ratzes at gmail.com
Fri Oct 23 15:45:13 UTC 2015

Yeah, sorry, should have provided an example to begin with.

Let's say you have a function "thisFold :: (a -> a -> a) -> [a] -> a"

and it says that the function 'f' passed in must be associative.

Then it goes on to use f in "thisFold f [0,1,2]" like "f (1 (f 0 2))".
Obviously f is still associative, but 'thisFold' did not call f
'associatively' on the data. My question is if there is a name for what
property this broke by not calling f 'associatively'.

Does that make sense?

On Fri, Oct 23, 2015 at 11:21 AM, Francesco Ariis <fa-ml at ariis.it> wrote:

> On Fri, Oct 23, 2015 at 10:26:08AM -0400, Charles Durham wrote:
> > Is there a name for a fold that promises to call a function such that
> only
> > an associative function will always return the same result. Or in other
> > words, it has the property that it promises to call a function
> > "associatively" on a set of data?
> I am not sure I am understanding the question correctly. Every Monoid has a
> single binary operation which happens to be associative and one of
> the basic fold functions has signature
>     foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
> (which does what you expect). Does that answer your question? If not,
> I'd be grateful if you would provide an example.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151023/b4cdbf48/attachment.html>

More information about the Haskell-Cafe mailing list