Proposal for stand-alone deriving declarations?
Bjorn Bringert
bringert at cs.chalmers.se
Sun Oct 8 13:30:52 EDT 2006
On 8 okt 2006, at 18.22, Brian Smith wrote:
> On 10/6/06, Björn Bringert <bringert at cs.chalmers.se> wrote:
> John Hughes wrote:
> > deriving (Eq Foo, Ord Foo)
> >
> > instead of
> >
> > deriving (Eq, Ord) for Foo
> >
> > I find the former syntax clearer and more readable, actually.
> >
> > John
>
> I'll implement this syntax instead and then write up a Haskell'
> proposal.
>
> I am sure that it was already argued at great length, but I think
> it is wrong to start the declaration with "deriving." I believe
> that "derive instance" fits much better into the language. I
> understand the desire to avoid adding new keywords but I think that
> something along the lines of what was done for "for" could be done
> here for "derive."
I agree that "derive" would be nicer, but as you say, the problem is
that it would add a new keyword. Since the declaration would then
start with "derive", I don't that think it could easily be made into
a special identifier. A deriving declaration would look like this:
derive Eq Foo
which looks just like the beginning of a declaration of a function
called "derive" which does some pattern matching, if derive can also
be an identifier.
/Björn
More information about the Haskell-prime
mailing list