Eq instance for (a,b,c,d,e) and upwards

Henrik Nilsson nilsson@cs.yale.edu
Wed, 30 May 2001 22:07:29 -0400


Hi,

Simon Peyton-Jones wrote:

> Folks,
> 
> I'm about to put out (what I hope is) the final revised Haskell98
> report.
> 
> Here, though, is one good point I propose to clarify.  I propose to
> say that
> 
>        every H98 impl must support tuples up to size 7
>        and their instances for Eq, Ord, Bounded, Read, Show
>
> 
> [Of course, one might hope that impls would do better, but the report
> should be conservative.]

Clearly, the report has to state the minimal bound.
And I agree that 7 is a choice which is consistent with the
current Prelude.

However, 7 is also a number which is uncomfortably close to what
I've seen in real code and used myself. Yes, one might hope
that this is a non issue, since all implementations I'm aware
of does considerably better anyway. But if one wants to write
portable code, it does become an issue. And yes, one could
argue that records or user-defined product types should be
used anyway. But that is really a matter of taste, and I'd say
that there are reasonable examples where forcing the user to
introduce a product type just to wrap up a bunch of values would
harm rather than improve the readability.

So, if, in the interest of being conservative, the stated minimal
bound cannot be "infinity", could it at least be a great deal
bigger than what reasonably would be used in *hand-written*
code? Say 15. An arbitrary choice, of course, but it is not
excessive from an implementation perspective, yet large enough
that I cannot imagine hand-written code getting close to the
limit.

Best regards,

/Henrik

-- 
Henrik Nilsson
Yale University
Department of Computer Science
nilsson@cs.yale.edu