[Haskell-cafe] deriving

Hans Aberg haberg at math.su.se
Tue Apr 8 10:49:33 EDT 2008


On 8 Apr 2008, at 16:32, Anton van Straaten wrote:
>> There are two processes here: deriving, i.e., inheriting an  
>> interface; and instantiating, i.e., producing running code.  
>> Haskell denotes derivation by "=>". And "data <a> deriving  
>> (b_1, ..., b_k)" is really a short for
>>   data <a>
>>   instance b_1 where <compiler implementation>
>>   ...
>>   instance b_k where <compiler implementation>
>> So "instance" seems the word that should have been used.
>
> How about making "deriving x" an expression which means:
>
>   instance x where <compiler implementation>
>
> This innovative solution will minimize changes to the Haskell  
> compiler, documentation, and programmer's brains.

So what is the difference from the current state? They way you have  
written it, one can say
   data A ...

   deriving Eq A
Is that what you want?

> Seriously, there's only so much connotational meaning you can pack  
> into  or extract from a keyword.  Ultimately, programming language  
> keywords follow the rule given by Humpty Dumpty:
>
> "When _I_ use a word, it means just what I choose it to mean --  
> neither more nor less."

That is why computer languages are what they are. Think of C "static".

   Hans





More information about the Haskell-Cafe mailing list