[commit: ghc] wip/rae: Don't tidy vars when dumping a type (77c8e72)
git at git.haskell.org
git at git.haskell.org
Wed Jul 19 12:03:47 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/rae
Link : http://ghc.haskell.org/trac/ghc/changeset/77c8e72c32e762f9b55887c3c966358214a403c7/ghc
>---------------------------------------------------------------
commit 77c8e72c32e762f9b55887c3c966358214a403c7
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.
>---------------------------------------------------------------
77c8e72c32e762f9b55887c3c966358214a403c7
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 5ac63e5..90c6a31 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
@@ -2435,7 +2435,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
@@ -2444,6 +2444,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