[commit: ghc] wip/rae: Don't tidy vars when dumping a type (535eebe)

git at git.haskell.org git at git.haskell.org
Wed Jul 26 14:10:31 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/rae
Link       : http://ghc.haskell.org/trac/ghc/changeset/535eebee733a71a0d1deaa611e79a6e4cf8ee476/ghc

>---------------------------------------------------------------

commit 535eebee733a71a0d1deaa611e79a6e4cf8ee476
Author: Richard Eisenberg <rae at cs.brynmawr.edu>
Date:   Fri Apr 7 11:13:32 2017 -0400

    Don't tidy vars when dumping a type
    
    This makes variables print more consistenty in, say,
    -ddump-tc-trace.


>---------------------------------------------------------------

535eebee733a71a0d1deaa611e79a6e4cf8ee476
 compiler/types/TyCoRep.hs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs
index f5d3374..9b82ab8 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -137,8 +137,8 @@ import {-# SOURCE #-} DataCon( dataConFullSig
                              , dataConUnivTyVarBinders, dataConExTyVarBinders
                              , DataCon, filterEqSpec )
 import {-# SOURCE #-} Type( isPredTy, isCoercionTy, mkAppTy, mkCastTy
-                          , tyCoVarsOfTypesWellScoped
                           , tyCoVarsOfTypeWellScoped
+                          , tyCoVarsOfTypesWellScoped
                           , coreView, typeKind )
    -- Transitively pulls in a LOT of stuff, better to break the loop
 
@@ -2445,7 +2445,7 @@ pprType       = pprPrecType TopPrec
 pprParendType = pprPrecType TyConPrec
 
 pprPrecType :: TyPrec -> Type -> SDoc
-pprPrecType prec ty = pprPrecIfaceType prec (tidyToIfaceType ty)
+pprPrecType prec ty = getPprStyle $ \sty -> pprPrecIfaceType prec (tidyToIfaceTypeSty ty sty)
 
 pprTyLit :: TyLit -> SDoc
 pprTyLit = pprIfaceTyLit . toIfaceTyLit
@@ -2454,6 +2454,12 @@ pprKind, pprParendKind :: Kind -> SDoc
 pprKind       = pprType
 pprParendKind = pprParendType
 
+tidyToIfaceTypeSty :: Type -> PprStyle -> IfaceType
+tidyToIfaceTypeSty ty sty
+  | userStyle sty = tidyToIfaceType ty
+  | otherwise     = toIfaceTypeX (tyCoVarsOfType ty) ty
+     -- in latter case, don't tidy, as we'll be printing uniques.
+
 tidyToIfaceType :: Type -> IfaceType
 -- It's vital to tidy before converting to an IfaceType
 -- or nested binders will become indistinguishable!



More information about the ghc-commits mailing list