summaryrefslogtreecommitdiff
path: root/compiler/GHC/Hs/Pat.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-03-17 18:44:51 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-01 10:37:39 -0400
commitde9fc995c2170bc34600ee3fc80393c67cfecad1 (patch)
tree71a179e2b899cf9253ada7bddea40ab3c1e1c3e6 /compiler/GHC/Hs/Pat.hs
parentb3df9e780fb2f5658412c644849cd0f1e6f50331 (diff)
downloadhaskell-de9fc995c2170bc34600ee3fc80393c67cfecad1.tar.gz
Fully remove PprDebug
PprDebug was a pain to deal with consistently as it is implied by `-dppr-debug` but it isn't really a PprStyle. We remove it completely and query the appropriate SDoc flag instead (`sdocPprDebug`) via helpers (`getPprDebug` and its friends).
Diffstat (limited to 'compiler/GHC/Hs/Pat.hs')
-rw-r--r--compiler/GHC/Hs/Pat.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/compiler/GHC/Hs/Pat.hs b/compiler/GHC/Hs/Pat.hs
index 4f73aa3e98..50d3cf4aef 100644
--- a/compiler/GHC/Hs/Pat.hs
+++ b/compiler/GHC/Hs/Pat.hs
@@ -514,14 +514,13 @@ hsRecUpdFieldOcc = fmap unambiguousFieldOcc . hsRecFieldLbl
instance OutputableBndrId p => Outputable (Pat (GhcPass p)) where
ppr = pprPat
+-- | Print with type info if -dppr-debug is on
pprPatBndr :: OutputableBndr name => name -> SDoc
-pprPatBndr var -- Print with type info if -dppr-debug is on
- = getPprStyle $ \ sty ->
- if debugStyle sty then
- parens (pprBndr LambdaBind var) -- Could pass the site to pprPat
- -- but is it worth it?
- else
- pprPrefixOcc var
+pprPatBndr var
+ = getPprDebug $ \case
+ True -> parens (pprBndr LambdaBind var) -- Could pass the site to pprPat
+ -- but is it worth it?
+ False -> pprPrefixOcc var
pprParendLPat :: (OutputableBndrId p)
=> PprPrec -> LPat (GhcPass p) -> SDoc