Why does length return 1 for a tuple with 2 elements, and gives an error for a tuple with more elements?
You have encountered a Haskell cause célèbre that has sparked much discussion and gnashing of teeth. Basically, for the purposes of Foldable (the typeclass that provides length), 2-tuples are not considered a container of two elements, but a container of one element accompanied by some context. You can extract a list of elements of type … Read more