# [Haskell-cafe] 'Associative' order of calling

Janis Voigtländer janis.voigtlaender at gmail.com
Sat Oct 24 18:34:56 UTC 2015

```> If one has f a = Bool -> a, and a value
>
> xs :: f Int
> xs True = 2
> xs False = 3
>
> what are x1 and x2?

One answer I could give is: That depends on the definition of the
Traversable instance for the (Bool -> a) type constructor.

Another answer I could give is: Ask the authors of the Traversable
documentation. The first sentence on
is: "Class of data structures that can be traversed from left to right,
...". So it seems that the authors of that documentation (which I
criticize) assume that they can say -- for any given type constructor, so
also for your (Bool -> a) example -- what "left" means and what "right"
means.

2015-10-24 20:23 GMT+02:00 Matteo Acerbi <matteo.acerbi at gmail.com>:

> On Sat, Oct 24, 2015 at 8:12 PM, Janis Voigtländer <
> janis.voigtlaender at gmail.com> wrote:
>
>> It has already been established in this thread what Charles meant by 3.
>>
>> He meant that a fold-function that has the property he is after would
>> guarantee that it:
>>
>> a) takes all the content elements from a data structure, say x1,...,xn,
>>
>> b) builds an application tree with the to-be-folded, binary operation f
>> in the internal nodes of a binary tree, whose leafs, read from left to
>> right, form exactly the sequence x1,...,xn,
>>
>> c) evaluates that application tree.
>>
>> Do you agree that what I describe above is a property of a given
>> fold-like function, not of the f handed to that fold-like function?
>>
>
> I might lack some basic knowledge, so thanks for asking.
>
> What does it mean to take all the content elements from a data structure?
>
> If one has f a = Bool -> a, and a value
>
> xs :: f Int
> xs True  = 2
> xs False = 3
>
> what are x1 and x2?
>
> Best,
> Matteo
>
> PS. I won't be able to read the answer before tomorrow. :-)
>
-------------- next part --------------
An HTML attachment was scrubbed...