[Haskell-cafe] deriving

Hans Aberg haberg at math.su.se
Tue Apr 8 10:00:46 EDT 2008


On 8 Apr 2008, at 15:26, PR Stanley wrote:
> I'm sure you could introduce change gradually without too much pain.

So then you only have to get the compilers to gradually understand  
it :-).

> I personally think "deriving" is a descriptive term, now that I  
> understand its role better.

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.

But discussions of a change seems is likely just a café thing - I  
must go finishing mine :-).

> I suppose you could consider "specialize" or "instanciate" but both  
> those terms are very closely associated with OO and deriving an  
> instance of a class with a type isn't quite like instantiation or  
> even specialisation.

So then you introduce a new keyword and screwing up all existing code.

> We want a single word which is equivalent  to "derives from".  
> Deriving by itself can seem a bit ambiguous at first.

What about the already used "=>"?

   Hans




More information about the Haskell-Cafe mailing list