[project @ 2002-02-07 12:50:00 by simonpj]
authorsimonpj <unknown>
Thu, 7 Feb 2002 12:50:47 +0000 (12:50 +0000)
committersimonpj <unknown>
Thu, 7 Feb 2002 12:50:47 +0000 (12:50 +0000)
Better pretty printing

ghc/compiler/typecheck/Inst.lhs
ghc/compiler/typecheck/TcSimplify.lhs
ghc/compiler/types/PprType.lhs

index 23eab62..64889ef 100644 (file)
@@ -61,7 +61,7 @@ import Class  ( Class )
 import Id      ( Id, idName, idType, mkUserLocal, mkSysLocal, mkLocalId, setIdUnique )
 import PrelInfo        ( isStandardClass, isCcallishClass, isNoDictClass )
 import Name    ( Name, mkMethodOcc, getOccName )
-import PprType ( pprPred )     
+import PprType ( pprPred, pprParendType )      
 import Subst   ( emptyInScopeSet, mkSubst, 
                  substTy, substTyWith, substTheta, mkTyVarSubst, mkTopTyVarSubst
                )
@@ -551,7 +551,7 @@ pprInst (Dict u pred loc) = pprPred pred <+> show_uniq u
 
 pprInst m@(Method u id tys theta tau loc)
   = hsep [ppr id, ptext SLIT("at"), 
-         brackets (interppSP tys) {- ,
+         brackets (sep (map pprParendType tys)) {- ,
          ptext SLIT("theta"), ppr theta,
          ptext SLIT("tau"), ppr tau
          show_uniq u,
index 9b49a02..ca9180f 100644 (file)
@@ -1059,7 +1059,7 @@ data Avail
                        --      is turned into an LinRhss
        [TcExpr]        -- A supply of suitable RHSs
 
-pprAvails avails = vcat [ppr inst <+> equals <+> pprAvail avail
+pprAvails avails = vcat [sep [ppr inst, nest 2 (equals <+> pprAvail avail)]
                        | (inst,avail) <- fmToList avails ]
 
 instance Outputable Avail where
index 0412c04..0285731 100644 (file)
@@ -70,13 +70,13 @@ pprPred = pprSourceType
 pprSourceType :: SourceType -> SDoc
 pprSourceType (ClassP clas tys) = pprClassPred clas tys
 pprSourceType (IParam n ty)     = hsep [ppr n, dcolon, ppr ty]
-pprSourceType (NType tc tys)    = ppr tc <+> hsep (map pprParendType tys)
+pprSourceType (NType tc tys)    = ppr tc <+> sep (map pprParendType tys)
 
 pprClassPred :: Class -> [Type] -> SDoc
-pprClassPred clas tys = ppr clas <+> hsep (map pprParendType tys)
+pprClassPred clas tys = ppr clas <+> sep (map pprParendType tys)
 
 pprTheta :: ThetaType -> SDoc
-pprTheta theta = parens (hsep (punctuate comma (map pprPred theta)))
+pprTheta theta = parens (sep (punctuate comma (map pprPred theta)))
 
 instance Outputable Type where
     ppr ty = pprType ty