From: simonpj Date: Wed, 8 Jul 1998 15:10:53 +0000 (+0000) Subject: [project @ 1998-07-08 15:10:53 by simonpj] X-Git-Tag: Approx_2487_patches~522 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=2c0b0f40fd21a4e626a1e075fb2c4868c2ab59fa;p=ghc-hetmet.git [project @ 1998-07-08 15:10:53 by simonpj] Use constr-id application when building dictionary --- diff --git a/ghc/compiler/typecheck/TcInstDcls.lhs b/ghc/compiler/typecheck/TcInstDcls.lhs index 8e8f846..18fbbc6 100644 --- a/ghc/compiler/typecheck/TcInstDcls.lhs +++ b/ghc/compiler/typecheck/TcInstDcls.lhs @@ -439,9 +439,15 @@ tcInstDecl2 (InstInfo clas inst_tyvars inst_tys (HsLitOut (HsString msg) stringTy) | otherwise -- The common case - = HsCon dict_constr inst_tys' (map HsVar (sc_dict_ids ++ meth_ids)) + = foldl HsApp (TyApp (HsVar (RealId dict_constr)) inst_tys') + (map HsVar (sc_dict_ids ++ meth_ids)) -- We don't produce a binding for the dict_constr; instead we - -- just generate the saturated constructor directly + -- rely on the simplifier to unfold this saturated application + -- We do this rather than generate an HsCon directly, because + -- it means that the special cases (e.g. dictionary with only one + -- member) are dealt with by the common MkId.mkDataConId code rather + -- than needing to be repeated here. + where msg = _PK_ ("Compiler error: bad dictionary " ++ showSDoc (ppr clas))