
I've seen many threads, including the one going on now, about why we need to have: length (2,3) = 1 product (2,3) = 3 sum (2,3) = 3 or (True,False) = False but the justifications all go over my head. Is there a beginner-friendly explanation for why such seemingly unintuitive operations should be allowed by default?

On Sun, Apr 23, 2017 at 08:21:34AM +0000, Jonathon Delgado wrote:
I've seen many threads, including the one going on now, about why we need to have:
length (2,3) = 1 product (2,3) = 3 sum (2,3) = 3 or (True,False) = False
but the justifications all go over my head. Is there a beginner-friendly explanation for why such seemingly unintuitive operations should be allowed by default?
Hello Jonathon, the proponents of `Foldable (a,)` see `(2,3)` not as a pair of 'equal' values, but as a value *and* an annotation, much like some other folks see Either as having a value (Right a) *or* an annotation (usually an error in the form of Left e). So to go back to your examples: (2,3) ^ ^ | +------------- I am the value | +--------------- I am an annotation (and since tuples arguments can be heterogeneous, I could be a String, a Bool, anything). If you agree with this paradigm, `length`, `sum` and friend become a bit less icky. I would prefer tuples to be unbiased, but this intuition helped me connect with the people on the other side of the line. Does this help?

Hey Jonathon,
Based on the last email you sent, it seems like you're not quite satisfied
with the responses.
And for good reason.
It turns out that there is more to
length (2,3) = 1
sum (2,3) = product (2,3) = 3
than just the offending Traversable instance of the tuple pair (,).
Would you mind resending your first email of Apr 23 to the haskell-cafe
mailing list?
If you do so, I'll contribute by opening a discussion of the Functor
instance.
Best,
Kim-Ee
On Sunday, April 23, 2017, Jonathon Delgado
I've seen many threads, including the one going on now, about why we need to have:
length (2,3) = 1 product (2,3) = 3 sum (2,3) = 3 or (True,False) = False
but the justifications all go over my head. Is there a beginner-friendly explanation for why such seemingly unintuitive operations should be allowed by default? _______________________________________________ Beginners mailing list Beginners@haskell.org javascript:; http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- -- Kim-Ee
participants (3)
-
Francesco Ariis
-
Jonathon Delgado
-
Kim-Ee Yeoh