Commit deda0c55 authored by simonpj@microsoft.com's avatar simonpj@microsoft.com
Browse files

Minor refactoring: give an explicit name to the pretty-printing function for TyThing, and use it

parent 4d60ffc3
......@@ -908,16 +908,16 @@ lookupType dflags hpt pte name
\begin{code}
tyThingTyCon (ATyCon tc) = tc
tyThingTyCon other = pprPanic "tyThingTyCon" (ppr other)
tyThingTyCon other = pprPanic "tyThingTyCon" (pprTyThing other)
tyThingClass (AClass cls) = cls
tyThingClass other = pprPanic "tyThingClass" (ppr other)
tyThingClass other = pprPanic "tyThingClass" (pprTyThing other)
tyThingDataCon (ADataCon dc) = dc
tyThingDataCon other = pprPanic "tyThingDataCon" (ppr other)
tyThingDataCon other = pprPanic "tyThingDataCon" (pprTyThing other)
tyThingId (AnId id) = id
tyThingId other = pprPanic "tyThingId" (ppr other)
tyThingId other = pprPanic "tyThingId" (pprTyThing other)
\end{code}
%************************************************************************
......
......@@ -470,7 +470,7 @@ data RefinementVisibility
-- GADT refinement
instance Outputable TcTyThing where -- Debugging only
ppr (AGlobal g) = ppr g
ppr (AGlobal g) = pprTyThing g
ppr elt@(ATcId {}) = text "Identifier" <>
ifPprDebug (brackets (ppr (tct_id elt) <> dcolon <> ppr (tct_type elt) <> comma
<+> ppr (tct_level elt) <+> ppr (tct_co elt)))
......
......@@ -105,7 +105,7 @@ module Type (
substPred, substTyVar, substTyVars, substTyVarBndr, deShadowTy, lookupTyVar,
-- Pretty-printing
pprType, pprParendType, pprTypeApp, pprTyThingCategory, pprForAll,
pprType, pprParendType, pprTypeApp, pprTyThingCategory, pprTyThing, pprForAll,
pprPred, pprTheta, pprThetaArrow, pprClassPred, pprKind, pprParendKind
) where
......
......@@ -23,7 +23,7 @@ module TypeRep (
-- Pretty-printing
pprType, pprParendType, pprTypeApp,
pprTyThingCategory,
pprTyThing, pprTyThingCategory,
pprPred, pprTheta, pprForAll, pprThetaArrow, pprClassPred,
-- Kinds
......@@ -292,8 +292,11 @@ data TyThing = AnId Id
| ATyCon TyCon
| AClass Class
instance Outputable TyThing where
ppr thing = pprTyThingCategory thing <+> quotes (ppr (getName thing))
instance Outputable TyThing where
ppr = pprTyThing
pprTyThing :: TyThing -> SDoc
pprTyThing thing = pprTyThingCategory thing <+> quotes (ppr (getName thing))
pprTyThingCategory :: TyThing -> SDoc
pprTyThingCategory (ATyCon _) = ptext SLIT("Type constructor")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment