From: keithw Date: Tue, 11 May 1999 16:31:33 +0000 (+0000) Subject: [project @ 1999-05-11 16:31:33 by keithw] X-Git-Tag: Approximately_9120_patches~6229 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=39b581ba6d9ecd90db9a080d487cec140595877d;p=ghc-hetmet.git [project @ 1999-05-11 16:31:33 by keithw] (this is number 1 of 9 commits to be applied together) Dictionaries now appear in interface files explicitly, rather than as contexts: __forall [a] => {Show a} -> ... rather than __forall [a] {Show a} => ... . --- diff --git a/ghc/compiler/types/PprType.lhs b/ghc/compiler/types/PprType.lhs index b3b3163..a719a24 100644 --- a/ghc/compiler/types/PprType.lhs +++ b/ghc/compiler/types/PprType.lhs @@ -18,7 +18,7 @@ module PprType( -- friends: -- (PprType can see all the representations it's trying to print) -import Type ( Type(..), TyNote(..), Kind, ThetaType, +import Type ( Type(..), TyNote(..), Kind, ThetaType, UsageAnn(..), splitDictTy_maybe, splitForAllTys, splitSigmaTy, splitRhoTy, isDictTy, splitTyConApp_maybe, splitFunTy_maybe, @@ -163,21 +163,15 @@ ppr_ty env ctxt_prec ty@(ForAllTy _ _) = getPprStyle $ \ sty -> maybeParen ctxt_prec fUN_PREC $ if ifaceStyle sty then - sep [ ptext SLIT("__forall") <+> brackets pp_tyvars, pp_ctxt, pp_body ] + sep [ ptext SLIT("__forall") <+> brackets pp_tyvars <+> ptext SLIT("=>"), pp_body ] else - sep [ ptext SLIT("forall") <+> pp_tyvars <> ptext SLIT("."), pp_maybe_ctxt, pp_body ] + sep [ ptext SLIT("forall") <+> pp_tyvars <> ptext SLIT("."), pp_body ] where - (tyvars, rho_ty) = splitForAllTys ty - (theta, body_ty) = splitRhoTy rho_ty + (tyvars, body_ty) = splitForAllTys ty -- don't treat theta specially any more (KSW 1999-04) pp_tyvars = hsep (map (pBndr env LambdaBind) tyvars) pp_body = ppr_ty env tOP_PREC body_ty - pp_maybe_ctxt | null theta = empty - | otherwise = pp_ctxt - - pp_ctxt = ppr_theta env theta <+> ptext SLIT("=>") - ppr_ty env ctxt_prec (FunTy ty1 ty2) = maybeParen ctxt_prec fUN_PREC (sep (ppr_ty env fUN_PREC ty1 : pp_rest ty2)) @@ -194,9 +188,14 @@ ppr_ty env ctxt_prec (AppTy ty1 ty2) ppr_ty env ctxt_prec (NoteTy (SynNote ty) expansion) = ppr_ty env ctxt_prec ty +-- = ppr_ty env ctxt_prec expansion -- if we don't want to see syntys ppr_ty env ctxt_prec (NoteTy (FTVNote _) ty) = ppr_ty env ctxt_prec ty +ppr_ty env ctxt_prec (NoteTy (UsgNote u) ty) + = maybeParen ctxt_prec tYCON_PREC $ + ppr u <+> ppr_ty env tYCON_PREC ty + ppr_theta env [] = empty ppr_theta env theta = braces (hsep (punctuate comma (map (ppr_dict env tOP_PREC) theta))) @@ -210,6 +209,13 @@ pprTyEnv = initPprEnv b b (Just ppr) b (Just (\site -> pprTyVarBndr)) b b = panic "PprType:init_ppr_env" \end{code} +\begin{code} +instance Outputable UsageAnn where + ppr UsOnce = ptext SLIT("__o") + ppr UsMany = ptext SLIT("__m") + ppr (UsVar uv) = ptext SLIT("__uv") <> ppr uv +\end{code} + %************************************************************************ %* * \subsection[TyVar]{@TyVar@} @@ -255,6 +261,7 @@ getTyDescription ty TyConApp tycon _ -> getOccString tycon NoteTy (FTVNote _) ty -> getTyDescription ty NoteTy (SynNote ty1) _ -> getTyDescription ty1 + NoteTy (UsgNote _) ty -> getTyDescription ty ForAllTy _ ty -> getTyDescription ty } where