Commit 83b96a47 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

More informative pretty-printing for phantom coercions

parent 2c7b1830
...@@ -1083,8 +1083,10 @@ ppr_co ctxt_prec (IfaceUnivCo IfaceUnsafeCoerceProv r ty1 ty2) ...@@ -1083,8 +1083,10 @@ ppr_co ctxt_prec (IfaceUnivCo IfaceUnsafeCoerceProv r ty1 ty2)
text "UnsafeCo" <+> ppr r <+> text "UnsafeCo" <+> ppr r <+>
pprParendIfaceType ty1 <+> pprParendIfaceType ty2 pprParendIfaceType ty1 <+> pprParendIfaceType ty2
ppr_co _ (IfaceUnivCo _ _ ty1 ty2) ppr_co _ (IfaceUnivCo prov role ty1 ty2)
= angleBrackets ( ppr ty1 <> comma <+> ppr ty2 ) = text "Univ" <> (parens $
sep [ ppr role <+> pprIfaceUnivCoProv prov
, dcolon <+> ppr ty1 <> comma <+> ppr ty2 ])
ppr_co ctxt_prec (IfaceInstCo co ty) ppr_co ctxt_prec (IfaceInstCo co ty)
= maybeParen ctxt_prec TyConPrec $ = maybeParen ctxt_prec TyConPrec $
...@@ -1124,6 +1126,17 @@ ppr_role r = underscore <> pp_role ...@@ -1124,6 +1126,17 @@ ppr_role r = underscore <> pp_role
Representational -> char 'R' Representational -> char 'R'
Phantom -> char 'P' Phantom -> char 'P'
------------------
pprIfaceUnivCoProv :: IfaceUnivCoProv -> SDoc
pprIfaceUnivCoProv IfaceUnsafeCoerceProv
= text "unsafe"
pprIfaceUnivCoProv (IfacePhantomProv co)
= text "phantom" <+> pprParendIfaceCoercion co
pprIfaceUnivCoProv (IfaceProofIrrelProv co)
= text "irrel" <+> pprParendIfaceCoercion co
pprIfaceUnivCoProv (IfacePluginProv s)
= text "plugin" <+> doubleQuotes (text s)
------------------- -------------------
instance Outputable IfaceTyCon where instance Outputable IfaceTyCon where
ppr tc = pprPromotionQuote tc <> ppr (ifaceTyConName tc) ppr tc = pprPromotionQuote tc <> ppr (ifaceTyConName tc)
......
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