[Haskell-cafe] deriving

Hans Aberg haberg at math.su.se
Tue Apr 8 04:17:38 EDT 2008

On 8 Apr 2008, at 00:30, Bulat Ziganshin wrote:
>> At least Hugs complains if one does not indent "deriving ...", but I
>> do not know what the standard says. If is required, then it can be
>> changed.
> deriving is a part of data clause and indentation just allows us to
> continue clause from prev. line. if not indented, deriving will be
> parsed as separate clause (and btw such clause, "standalone deriving"
> was added to ghc 6.8)

So it seems that if one uses the word "instance" instead of  
"deriving", then the compiler can immediately tell when this word  
appears whether it is a part if the "data" clause, or the start of a  
new "instance" clause. So it can probably be changed, getting rid of  
"deriving" which I think is not used elsewhere. It will break a lot  
of code, but it is easy to change, and also easy to make a  
compatibility mode.


More information about the Haskell-Cafe mailing list