[commit: ghc] wip/custom-type-errors: Move custom printing of `TypeError` with custom printing of tycons. (6a4c0e4)

git at git.haskell.org git at git.haskell.org
Sat Oct 31 20:18:48 UTC 2015


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

On branch  : wip/custom-type-errors
Link       : http://ghc.haskell.org/trac/ghc/changeset/6a4c0e4b5b30b60e9804df9024fc0041f5bffffb/ghc

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

commit 6a4c0e4b5b30b60e9804df9024fc0041f5bffffb
Author: Iavor S. Diatchki <iavor.diatchki at gmail.com>
Date:   Sat Oct 31 12:47:26 2015 -0700

    Move custom printing of `TypeError` with custom printing of tycons.


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

6a4c0e4b5b30b60e9804df9024fc0041f5bffffb
 compiler/types/TypeRep.hs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/compiler/types/TypeRep.hs b/compiler/types/TypeRep.hs
index 8b05555..c5bfec3 100644
--- a/compiler/types/TypeRep.hs
+++ b/compiler/types/TypeRep.hs
@@ -573,9 +573,7 @@ instance Outputable TyLit where
 
 ppr_type :: TyPrec -> Type -> SDoc
 ppr_type _ (TyVarTy tv)       = ppr_tvar tv
-ppr_type p (TyConApp tc tys)
-  | tyConName tc == errorMessageTypeErrorFamName = text "(type error)"
-  | otherwise = pprTyTcApp p tc tys
+ppr_type p (TyConApp tc tys)  = pprTyTcApp p tc tys
 ppr_type p (LitTy l)          = ppr_tylit p l
 ppr_type p ty@(ForAllTy {})   = ppr_forall_type p ty
 
@@ -715,6 +713,8 @@ pprTyTcApp p tc tys
     if gopt Opt_PrintExplicitKinds dflags then pprTcApp  p ppr_type tc tys
                                    else pprTyList p ty1 ty2
 
+  | tc `hasKey` errorMessageTypeErrorFamKey = text "(type error)"
+
   | otherwise
   = pprTcApp p ppr_type tc tys
 
@@ -724,6 +724,7 @@ pprTcApp _ pp tc [ty]
   | tc `hasKey` listTyConKey = pprPromotionQuote tc <> brackets   (pp TopPrec ty)
   | tc `hasKey` parrTyConKey = pprPromotionQuote tc <> paBrackets (pp TopPrec ty)
 
+
 pprTcApp p pp tc tys
   | Just sort <- tyConTuple_maybe tc
   , tyConArity tc == length tys



More information about the ghc-commits mailing list