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



About this list Date view Thread view Subject view Author view

Martin Norbäck (d95mback@dtek.chalmers.se)
Sun, 22 Apr 2001 20:34:30 +0200


2001-04-22T09:41:04+0000, Marcin 'Qrczak' Kowalczyk -> > Fri, 20 Apr 2001 14:49:49 +0200, Martin Norbäck <d95mback@dtek.chalmers.se> pisze: > > > > This is no particular reason for this restriction. Ghc defines > > > standard instances for tuples only up to 5. I suppose nhc98 should > > > at least match that. > > > > Would be nice if this was regulated by the Haskell standard in some way, > > 6.1.4 Tuples > > Tuples are algebraic datatypes with special syntax, as defined > in Section 3.8. Each tuple type has a single constructor. There > is no upper bound on the size of a tuple. However, some Haskell > implementations may restrict the size of tuples and limit the > instances associated with larger tuples. The Prelude and libraries > define tuple functions such as zip for tuples up to a size of 7. All > tuples are instances of Eq, Ord, Bounded, Read, and Show. Classes > defined in the libraries may also supply instances for tuple types. > > I don't like that Haskell implementations limit tuple instances so much. > I once needed equality on 9-tuples. Supplying own instance is not > portable for implementations which do supply enough instances... The sentence "All tuples are instances of Eq, Ord, Bounded, Read, and Show." seems to require that all tuples that are allowed (12 with nhc98) should also be instances of Eq, Ord, Bounded, Read and Show. So ghc, hugs and nhc98 are all wrong here. Although I still think you should use a labelled record or at least an own type for the kinds of values. n. -- [ http://www.dtek.chalmers.se/~d95mback/ ] [ PGP: 0x453504F1 ] [ UIN: 4439498 ] Opinions expressed above are mine, and not those of my future employees. SIGBORE: Signature boring error, core dumped


About this list Date view Thread view Subject view Author view