From: sof Date: Tue, 16 Jun 1998 08:55:32 +0000 (+0000) Subject: [project @ 1998-06-16 08:55:30 by sof] X-Git-Tag: Approx_2487_patches~574 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=1d27115b664e2343ec06b3eec3700f6b48c6d239;p=ghc-hetmet.git [project @ 1998-06-16 08:55:30 by sof] Don\'t generate con2tag, tag2con funs for newtype derivings --- diff --git a/ghc/compiler/typecheck/TcDeriv.lhs b/ghc/compiler/typecheck/TcDeriv.lhs index 6c45ca9..eb10d71 100644 --- a/ghc/compiler/typecheck/TcDeriv.lhs +++ b/ghc/compiler/typecheck/TcDeriv.lhs @@ -676,12 +676,12 @@ gen_taggery_Names inst_infos do_con2tag acc_Names tycon | isDataTyCon tycon && - (we_are_deriving eqClassKey tycon + ((we_are_deriving eqClassKey tycon && any isNullaryDataCon (tyConDataCons tycon)) || (we_are_deriving ordClassKey tycon && not (maybeToBool (maybeTyConSingleCon tycon))) || (we_are_deriving enumClassKey tycon) - || (we_are_deriving ixClassKey tycon) + || (we_are_deriving ixClassKey tycon)) = returnTc ((con2tag_RDR tycon, tycon, GenCon2Tag) : acc_Names) @@ -689,14 +689,14 @@ gen_taggery_Names inst_infos = returnTc acc_Names do_tag2con acc_Names tycon - = if (we_are_deriving enumClassKey tycon) - || (we_are_deriving ixClassKey tycon) - then - returnTc ( (tag2con_RDR tycon, tycon, GenTag2Con) - : (maxtag_RDR tycon, tycon, GenMaxTag) - : acc_Names) - else - returnTc acc_Names + | isDataTyCon tycon && + (we_are_deriving enumClassKey tycon || + we_are_deriving ixClassKey tycon) + = returnTc ( (tag2con_RDR tycon, tycon, GenTag2Con) + : (maxtag_RDR tycon, tycon, GenMaxTag) + : acc_Names) + | otherwise + = returnTc acc_Names we_are_deriving clas_key tycon = is_in_eqns clas_key tycon all_CTs diff --git a/ghc/compiler/typecheck/TcInstDcls.lhs b/ghc/compiler/typecheck/TcInstDcls.lhs index e3efa78..8e8f846 100644 --- a/ghc/compiler/typecheck/TcInstDcls.lhs +++ b/ghc/compiler/typecheck/TcInstDcls.lhs @@ -429,7 +429,7 @@ tcInstDecl2 (InstInfo clas inst_tyvars inst_tys dict_rhs | null scs_and_meths - = -- Blatant special case for CCallable, CReturnable + = -- Blatant special case for CCallable, CReturnable [and Eval -- sof 5/98] -- If the dictionary is empty then we should never -- select anything from it, so we make its RHS just -- emit an error message. This in turn means that we don't