diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-01-19 11:30:41 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-01-22 15:06:39 -0500 |
commit | 13d876bab3615174eb825d7b8048a0dd74eaebb8 (patch) | |
tree | c807b0f48e536b0fe0de17437d6a16d54ea49d23 | |
parent | 532337cb8181f31bd4a5475b2dc9740d428657b5 (diff) | |
download | haskell-13d876bab3615174eb825d7b8048a0dd74eaebb8.tar.gz |
Enhance nested TransCo pretty-printing
Nested TransCo were printed with a lot of indentation, e.g.:
`cast` (Sub (Sym (Foo.D:R:Index[0] <Bool>_N <'[]>_N)) ; ((Index
(Sym (SubDef (<1>_N,
<1>_N)))
<'[Bool]>_N)_R ; ...
With this patch we print them as follows:
`cast` (Sub (Sym (Foo.D:R:Index[0] <Bool>_N <'[]>_N))
; (Index (Sym (SubDef (<1>_N, <1>_N))) <'[Bool]>_N)_R
; Sub (Sym (Foo.D:R:Index[1] <1>_N <Int>_N <'[Bool]>_N))
; (Index (Sym (SubDef (<2>_N, <1>_N))) <'[Int, Bool]>_N)_R
-rw-r--r-- | compiler/GHC/Iface/Type.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/GHC/Iface/Type.hs b/compiler/GHC/Iface/Type.hs index e87998dd37..1e83aa2f10 100644 --- a/compiler/GHC/Iface/Type.hs +++ b/compiler/GHC/Iface/Type.hs @@ -1681,8 +1681,11 @@ ppr_co ctxt_prec (IfaceAxiomInstCo n i cos) ppr_co ctxt_prec (IfaceSymCo co) = ppr_special_co ctxt_prec (text "Sym") [co] ppr_co ctxt_prec (IfaceTransCo co1 co2) - = maybeParen ctxt_prec opPrec $ - ppr_co opPrec co1 <+> semi <+> ppr_co opPrec co2 + -- chain nested TransCo + = let ppr_trans (IfaceTransCo c1 c2) = semi <+> ppr_co topPrec c1 : ppr_trans c2 + ppr_trans c = [semi <+> ppr_co opPrec c] + in maybeParen ctxt_prec opPrec $ + vcat (ppr_co topPrec co1 : ppr_trans co2) ppr_co ctxt_prec (IfaceNthCo d co) = ppr_special_co ctxt_prec (text "Nth:" <> int d) [co] ppr_co ctxt_prec (IfaceLRCo lr co) |