Proposal for stand-alone deriving declarations?
Simon Peyton-Jones
simonpj at microsoft.com
Wed Nov 1 04:10:44 EST 2006
The thread about "stand-alone" deriving is long-ish now, so I have summarised the issues here:
http://haskell.org/haskellwiki/GHC/StandAloneDeriving
Perhaps those who are interested can add their thoughts? Bjorn is busy at the moment, but I think he'll get back to the implementation in a while, so now is a good time to refine the design.
I've tried to note all the issues that came up by email, but I might have missed.
I put it on the GHC wiki, because I'm not proposing it for Haskell'. (Someone else is free to do so, of course.)
Simon
| -----Original Message-----
| From: haskell-prime-bounces at haskell.org [mailto:haskell-prime-bounces at haskell.org] On Behalf Of
| John Meacham
| Sent: 30 October 2006 05:17
| To: haskell-prime at haskell.org
| Subject: Re: Proposal for stand-alone deriving declarations?
|
| On Fri, Oct 06, 2006 at 10:39:39AM -0500, Michael Shulman wrote:
| > On 10/6/06, John Hughes <rjmh at cs.chalmers.se> wrote:
| > >deriving (Eq Foo, Ord Foo)
| > >
| > >instead of
| > >
| > >deriving (Eq, Ord) for Foo
| >
| > So what does
| >
| > newtype Foo a = Foo a
| > newtype Bar b = Bar b
| > class C a b
| > deriving (C (Foo a) (Bar b))
| >
| > mean? I could see it meaning any or all of the following:
| >
| > instance (C (Foo a) b) => (C (Foo a) (Bar b))
| > instance (C a (Bar b)) => (C (Foo a) (Bar b))
| > instance (C a b) => (C (Foo a) (Bar b))
|
|
| this is why we should make this explicit when deriving "complex" newtype
| instances, so we would write exactly the instance we want to derive:
|
| > deriving (C (Foo a) b) => (C (Foo a) (Bar b))
| > deriving (C a (Bar b)) => (C (Foo a) (Bar b))
| > deriving (C a b) => (C (Foo a) (Bar b))
|
| respectively.
|
| John
|
| --
| John Meacham - ⑆repetae.net⑆john⑈
| _______________________________________________
| Haskell-prime mailing list
| Haskell-prime at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-prime
More information about the Haskell-prime
mailing list