RE: Generics... no Tuples 2 either...
with reference to Ptr, I only need an instance of Data for the Ptr () case (ie opaque pointers) ... so for generics it only needs to know that a Ptr is a Ptr, and to treat it like a value. Regards, Keean Schupke. ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: Generics... no Tuples 2 either...
SimonPJ and I have just (hopefully) finished a revision of Data. Just committed. In this course, we also have added instances for several things including Ptr etc. As you propose, Ptr values are not traversed and fromConstr and toConstr will be undefined. Ralf with reference to Ptr, I only need an instance of Data for the Ptr () case (ie opaque pointers) ... so for generics it only needs to know that a Ptr is a Ptr, and to treat it like a value. Regards, Keean Schupke. ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: Generics... no Tuples 2 either...
Tuples and Double are there in the HEAD build now -- but we're still thinking about how best to treat Ptr, which is essentially un-marshalable. | -Original Message- | From: [EMAIL PROTECTED] [mailto:glasgow-haskell-users- | [EMAIL PROTECTED] On Behalf Of MR K P SCHUPKE | Sent: 26 February 2004 18:33 | To: [EMAIL PROTECTED] | Subject: Generics... no Tuples 2 either... | | | 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 | [EMAIL PROTECTED] | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: Generics... no Tuples 2 either...
Yes, sorry about that. We'll add them shortly. (It's nice to know that someone is using this stuff!) Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:glasgow-haskell-users- | [EMAIL PROTECTED] On Behalf Of Abraham Egnor | Sent: 26 February 2004 22:18 | To: MR K P SCHUPKE | Cc: [EMAIL PROTECTED] | 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 [EMAIL PROTECTED] 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 | [EMAIL PROTECTED] | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users | | | | | ___ | Glasgow-haskell-users mailing list | [EMAIL PROTECTED] | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users