diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2022-04-02 13:59:21 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-06 13:03:53 -0400 |
commit | 88d610317a707eb33fe8f1a1a8ab6456279861f2 (patch) | |
tree | 79e0f0847ec46dc39ce9007b972f8064ca94461f /compiler | |
parent | a62e983e695b48e37ba5d867fe55a08c964813df (diff) | |
download | haskell-88d610317a707eb33fe8f1a1a8ab6456279861f2.tar.gz |
Refactor OutputableBndrFlag instances
The matching on GhcPass introduced by 95275a5f25a is not necessary.
This patch reverts it to make the code simpler.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Hs/Type.hs | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/compiler/GHC/Hs/Type.hs b/compiler/GHC/Hs/Type.hs index 208d7777f7..de565fcae7 100644 --- a/compiler/GHC/Hs/Type.hs +++ b/compiler/GHC/Hs/Type.hs @@ -864,46 +864,17 @@ ambiguousFieldOcc (FieldOcc sel rdr) = Unambiguous sel rdr -} class OutputableBndrFlag flag p where - pprTyVarBndr :: OutputableBndrId p - => HsTyVarBndr flag (GhcPass p) -> SDoc + pprTyVarBndr :: OutputableBndrId p => HsTyVarBndr flag (GhcPass p) -> SDoc instance OutputableBndrFlag () p where - pprTyVarBndr (UserTyVar _ _ n) -- = pprIdP n - = case ghcPass @p of - GhcPs -> ppr n - GhcRn -> ppr n - GhcTc -> ppr n - pprTyVarBndr (KindedTyVar _ _ n k) = parens $ hsep [ppr_n, dcolon, ppr k] - where - ppr_n = case ghcPass @p of - GhcPs -> ppr n - GhcRn -> ppr n - GhcTc -> ppr n + pprTyVarBndr (UserTyVar _ _ n) = ppr n + pprTyVarBndr (KindedTyVar _ _ n k) = parens $ hsep [ppr n, dcolon, ppr k] instance OutputableBndrFlag Specificity p where - pprTyVarBndr (UserTyVar _ SpecifiedSpec n) -- = pprIdP n - = case ghcPass @p of - GhcPs -> ppr n - GhcRn -> ppr n - GhcTc -> ppr n - pprTyVarBndr (UserTyVar _ InferredSpec n) = braces $ ppr_n - where - ppr_n = case ghcPass @p of - GhcPs -> ppr n - GhcRn -> ppr n - GhcTc -> ppr n - pprTyVarBndr (KindedTyVar _ SpecifiedSpec n k) = parens $ hsep [ppr_n, dcolon, ppr k] - where - ppr_n = case ghcPass @p of - GhcPs -> ppr n - GhcRn -> ppr n - GhcTc -> ppr n - pprTyVarBndr (KindedTyVar _ InferredSpec n k) = braces $ hsep [ppr_n, dcolon, ppr k] - where - ppr_n = case ghcPass @p of - GhcPs -> ppr n - GhcRn -> ppr n - GhcTc -> ppr n + pprTyVarBndr (UserTyVar _ SpecifiedSpec n) = ppr n + pprTyVarBndr (UserTyVar _ InferredSpec n) = braces $ ppr n + pprTyVarBndr (KindedTyVar _ SpecifiedSpec n k) = parens $ hsep [ppr n, dcolon, ppr k] + pprTyVarBndr (KindedTyVar _ InferredSpec n k) = braces $ hsep [ppr n, dcolon, ppr k] instance OutputableBndrId p => Outputable (HsSigType (GhcPass p)) where ppr (HsSig { sig_bndrs = outer_bndrs, sig_body = body }) = |