Generics... no Tuples > 2 either...
Simon Peyton-Jones
simonpj at microsoft.com
Fri Feb 27 08:32:02 EST 2004
Yes, sorry about that. We'll add them shortly. (It's nice to know that
someone is using this stuff!)
Simon
| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org
[mailto:glasgow-haskell-users-
| bounces at haskell.org] On Behalf Of Abraham Egnor
| Sent: 26 February 2004 22:18
| To: MR K P SCHUPKE
| Cc: glasgow-haskell-users at haskell.org
| Subject: Re: Generics... no Tuples > 2 either...
|
| I've been frustrated by the same lack of instances; as a stopgap,
here's
| one for a three-tuple. The pattern is pretty clear and can easily be
| extended to whatever size you'd like.
|
| tupCon = mkConstr 1 "(,,)" Prefix
|
| instance (Data a, Data b, Data c) => Data (a, b ,c) where
| gfoldl k z (a, b, c) = ((z (,,) `k` a) `k` b) `k` c
| toConstr _ = tupCon
| fromConstr _ = (undefined, undefined, undefined)
| dataTypeOf _ = mkDataType [tupCon]
|
| MR K P SCHUPKE <k.schupke at imperial.ac.uk> writes:
| >
| >Any chance of Data instances for tuples of size
| >greater than 2... One of the nice things about generics is
| >you can use them by deriving Data on your datatypes - of
| >course this doesn't work if you all of a sudden have to
| >put a load of boiler-plate in just to use tuples...
| >
| > Regards,
| > Keean Schupke
| >_______________________________________________
| >Glasgow-haskell-users mailing list
| >Glasgow-haskell-users at haskell.org
| >http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
| >
|
|
|
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
More information about the Glasgow-haskell-users
mailing list