From 8166bb6c76b9a240c732ae3b20300123f0f0ad61 Mon Sep 17 00:00:00 2001 From: lewie Date: Sat, 14 Apr 2001 07:36:58 +0000 Subject: [PATCH] [project @ 2001-04-14 07:36:58 by lewie] Fix a couple of bugs affecting implicit params. With implicit params, you can have a rho type w/o being a forall type. --- ghc/compiler/typecheck/TcType.lhs | 3 ++- ghc/compiler/types/PprType.lhs | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ghc/compiler/typecheck/TcType.lhs b/ghc/compiler/typecheck/TcType.lhs index f332114..2cee03e 100644 --- a/ghc/compiler/typecheck/TcType.lhs +++ b/ghc/compiler/typecheck/TcType.lhs @@ -188,7 +188,8 @@ fresh type variables, splits off the dictionary part, and returns the results. tcInstType :: TcType -> NF_TcM ([TcTyVar], TcThetaType, TcType) tcInstType ty = case splitForAllTys ty of - ([], _) -> returnNF_Tc ([], [], ty) -- Nothing to do + ([], rho) -> tcSplitRhoTy rho `thenNF_Tc` \ (theta, tau) -> + returnNF_Tc ([], theta, tau) (tyvars, rho) -> tcInstTyVars tyvars `thenNF_Tc` \ (tyvars', _, tenv) -> tcSplitRhoTy (substTy tenv rho) `thenNF_Tc` \ (theta, tau) -> returnNF_Tc (tyvars', theta, tau) diff --git a/ghc/compiler/types/PprType.lhs b/ghc/compiler/types/PprType.lhs index 6e4d5d0..273a067 100644 --- a/ghc/compiler/types/PprType.lhs +++ b/ghc/compiler/types/PprType.lhs @@ -22,7 +22,7 @@ import TypeRep ( Type(..), TyNote(..), Kind, liftedTypeKind ) -- friend import Type ( PredType(..), ThetaType, splitPredTy_maybe, splitForAllTys, splitSigmaTy, splitRhoTy, - isDictTy, splitTyConApp_maybe, splitFunTy_maybe, + isPredTy, isDictTy, splitTyConApp_maybe, splitFunTy_maybe, predRepTy, isUTyVar ) import Var ( TyVar, tyVarKind ) @@ -189,8 +189,10 @@ ppr_ty ctxt_prec (FunTy ty1 ty2) -- so we mustn't use splitFunTys here. = maybeParen ctxt_prec fUN_PREC $ sep [ ppr_ty fUN_PREC ty1 - , ptext SLIT("->") <+> ppr_ty tOP_PREC ty2 + , ptext arrow <+> ppr_ty tOP_PREC ty2 ] + where arrow | isPredTy ty1 = SLIT("=>") + | otherwise = SLIT("->") ppr_ty ctxt_prec (AppTy ty1 ty2) = maybeParen ctxt_prec tYCON_PREC $ -- 1.7.10.4