<div dir="ltr"><div><div><span style="white-space:pre-wrap">> If one has f a = Bool -> a, and a value<br>> <br>> xs :: f Int<br>> xs True = 2<br>> xs False = 3<br>> <br>> what are x1 and x2?<br><br></span></div><span style="white-space:pre-wrap">One answer I could give is: That depends on the definition of the Traversable instance for the (Bool -> a) type constructor.<br><br></span></div><span style="white-space:pre-wrap">Another answer I could give is: Ask the authors of the Traversable documentation. The first sentence on <a href="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Traversable.html" target="_blank">https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Traversable.html</a> is: "</span>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.<br><div><div><br><div class="gmail_extra"><br><div class="gmail_quote">2015-10-24 20:23 GMT+02:00 Matteo Acerbi <span dir="ltr"><<a href="mailto:matteo.acerbi@gmail.com" target="_blank">matteo.acerbi@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Oct 24, 2015 at 8:12 PM, Janis Voigtländer <span dir="ltr"><<a href="mailto:janis.voigtlaender@gmail.com" target="_blank">janis.voigtlaender@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>It has already been established in this thread what Charles meant by 3.<br><br></div>He meant that a fold-function that has the property he is after would guarantee that it:<br></div><br>a) takes all the content elements from a data structure, say x1,...,xn,<br><br></div>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,<br><br></div>c) evaluates that application tree.<br><br></div>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?<br></div></div></blockquote><div><br><div style="font-family:monospace,monospace">I might lack some basic knowledge, so thanks for asking.<br></div><div style="font-family:monospace,monospace"><br></div><div style="font-family:monospace,monospace">What does it mean to take all the content elements from a data structure?<br><br></div><div style="font-family:monospace,monospace">If one has f a = Bool -> a, and a value<br><br></div><div style="font-family:monospace,monospace">xs :: f Int<br></div><div style="font-family:monospace,monospace">xs True = 2<br></div><div style="font-family:monospace,monospace">xs False = 3<br><br></div><div style="font-family:monospace,monospace">what are x1 and x2?<br><br></div><div style="font-family:monospace,monospace">Best,<br></div><div style="font-family:monospace,monospace">Matteo<br><br></div><div style="font-family:monospace,monospace">PS. I won't be able to read the answer before tomorrow. :-)<br></div></div></div></div></div>
</blockquote></div><br></div></div></div></div>