From f2123a38b5c050a5ff7bc4ea147eb80950cbe16b Mon Sep 17 00:00:00 2001 From: simonpj Date: Fri, 21 Jun 2002 13:31:50 +0000 Subject: [PATCH] [project @ 2002-06-21 13:31:50 by simonpj] Dont use the isomorphic-newtype deriving trick for recursive newtypes --- ghc/compiler/typecheck/TcDeriv.lhs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ghc/compiler/typecheck/TcDeriv.lhs b/ghc/compiler/typecheck/TcDeriv.lhs index b072bb4..80dbea9 100644 --- a/ghc/compiler/typecheck/TcDeriv.lhs +++ b/ghc/compiler/typecheck/TcDeriv.lhs @@ -43,7 +43,7 @@ import RdrName ( RdrName ) import TyCon ( tyConTyVars, tyConDataCons, tyConArity, newTyConRep, tyConTheta, maybeTyConSingleCon, isDataTyCon, - isEnumerationTyCon, TyCon + isEnumerationTyCon, isRecursiveTyCon, TyCon ) import TcType ( TcType, ThetaType, mkTyVarTys, mkTyConApp, getClassPredTys_maybe, isUnLiftedType, mkClassPred, tyVarsOfTypes, tcSplitFunTys, @@ -426,6 +426,10 @@ makeDerivEqns tycl_decls && n_args_to_keep >= 0 -- Well kinded: -- eg not: newtype T a = T Int deriving( Monad ) && eta_ok -- Eta reduction works + && not (isRecursiveTyCon tycon) -- Does not work for recursive tycons: + -- newtype A = MkA [A] + -- Don't want + -- instance Eq [A] => Eq A !! -- Check that eta reduction is OK -- (a) the dropped-off args are identical -- 1.7.10.4