[Haskell-cafe] 'Associative' order of calling

Clinton Mead clintonmead at gmail.com
Fri Oct 23 23:01:43 UTC 2015

Basically you want to force an argument to be associative yes?

I don't think there's a way to do that in Haskell, but what you could do is
create a datatype:

data Associative a b = Associative (a -> b)

You could then make "Associative" a Category, or perhaps even an Arrow, so
you could combine Associative functions to make new Associative functions.

But it would still be up to the user to ensure they only promote actual
associative functions to "Associative".

On Sat, Oct 24, 2015 at 8:24 AM, Bardur Arantsson <spam at scientician.net>

> On 10/23/2015 06:07 PM, Charles Durham wrote:
> > I can think of a few properties that folds can honor:
> >
> > 1. Promises to call f on all data (does not have any guarantees on order)
> "Exhaustive"?
> ... but then that's not really observable in a language like Haskell,
> except if you monitor CPU heat.
> Regards,
> _______________________________________________
> 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/20151024/1d1ada18/attachment.html>

More information about the Haskell-Cafe mailing list