From: simonpj Date: Fri, 21 Jun 2002 13:31:50 +0000 (+0000) Subject: [project @ 2002-06-21 13:31:50 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~1940 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=f2123a38b5c050a5ff7bc4ea147eb80950cbe16b;p=ghc-hetmet.git [project @ 2002-06-21 13:31:50 by simonpj] Dont use the isomorphic-newtype deriving trick for recursive newtypes --- 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