Proposal for stand-alone deriving declarations?
Bjorn Bringert
bringert at cs.chalmers.se
Sun Oct 8 14:21:59 EDT 2006
On 8 okt 2006, at 20.11, Brian Smith wrote:
> On 10/8/06, Bjorn Bringert
> <bringert at cs.chalmers.se> wrote:
> 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.
>
> That is why I suggested "derive instance." Then the only ambiguity
> comes when "derive" is used as a name immediately before an
> instance declaration. which should be really, really rare. It's not
> 100% backward compatible but it is a better compromise than using
> "deriving."
Oops, sorry. I should read more carefully. Would that work? I guess
I'll have to try.
I think that after layout resolution there can't be any identifiers
right before instance declarations, so I guess that wouldn't be a
problem.
/Björn
More information about the Haskell-prime
mailing list