I went to check why the hell this happened. It looks like the pair (“(,)”) is defined as an instance of Foldable, for some reason, which is the class used by functions like foldl() and foldr(). Meanwhile, triples and other tuples of higher order (such as triples, quadruples, …) are not instances of Foldable.
The weirdest part is that, if you try to use a pair as a Foldable, you only get the second value, for some reason… Here is an example.
Wait, now I need to know why.
* some time later *
I went to check why the hell this happened. It looks like the pair (“
(,)
”) is defined as an instance ofFoldable
, for some reason, which is the class used by functions likefoldl()
andfoldr()
. Meanwhile, triples and other tuples of higher order (such as triples, quadruples, …) are not instances ofFoldable
.The weirdest part is that, if you try to use a pair as a
Foldable
, you only get the second value, for some reason… Here is an example.ghci> foldl (\acc x -> x:acc) [] (1,2) [2]
This makes it so that the returned length is 1.