length (1,2)
returns a result, but
length (1, 2, 3)
gives an error. Why is that?
Reading the types of (,) and (,,) did not help.
Edit: I'm thinking of the length from Data.Foldable length :: Foldable t => t a -> Int
The Functor, Traversable, and most especially Foldable instances for pairs are somewhat controversial. There are circumstances where they allow code to compile and do something that was not intended. I proposed adding the missing functor instances for triples, etc. and, as the ensuing threads show, that really touched a nerve. So why doesn't (,,) have a Foldable instance? Because the community hasn't reached a consensus that it should.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With