cvs commit: fptools/ghc/compiler/typecheck Inst.lhs TcDefaults.lhs TcDeriv.lhs TcMType.lhs TcSimplify.lhs

Simon Peyton Jones simonpj@glass.cse.ogi.edu
Fri, 28 Dec 2001 09:25:33 -0800


simonpj     2001/12/28 09:25:33 PST

  Modified files:
    ghc/compiler/typecheck Inst.lhs TcDefaults.lhs TcDeriv.lhs 
                           TcMType.lhs TcSimplify.lhs 
  Log:
  	---------------------
  	Dealing with deriving
  	---------------------
  
  I spent a ridiculously long time peering at a bug report whereby
  a 'deriving' clause sent GHC 5.02.1 into a loop.  It was all to
  do with allowing instances like
  
  	instance Foo a b => Baz (T a)
  
  (Notice the 'b' on the left which does not appear on the right.)
  
  I realised that it's hard for the deriving machinery to find a
  fixpoint when these sort of instance decls are around.  So I
  now constrain *derived* instance decls not to have this form;
  all the tyvars on the left must appear on the right.
  
  On the way I commoned up the previously-separate tcSimplify
  machinery for 'deriving' and 'default' decls with that for
  everything else.   As a result, quite a few files are touched.
  
  I hope I havn't broken anything.
  
  Revision  Changes    Path
  1.90      +12 -5     fptools/ghc/compiler/typecheck/Inst.lhs
  1.26      +14 -9     fptools/ghc/compiler/typecheck/TcDefaults.lhs
  1.90      +29 -31    fptools/ghc/compiler/typecheck/TcDeriv.lhs
  1.17      +33 -30    fptools/ghc/compiler/typecheck/TcMType.lhs
  1.91      +92 -129   fptools/ghc/compiler/typecheck/TcSimplify.lhs