diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-08-30 08:57:40 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-08-31 08:16:58 +0100 |
commit | 805b29bb873c792ca5bcbd5540026848f9f11a8d (patch) | |
tree | 993291054fd388c0e493d11175ec27922d61bb1f /compiler/deSugar/Desugar.hs | |
parent | fca196280d38d07a697fbccdd8527821206b33eb (diff) | |
download | haskell-805b29bb873c792ca5bcbd5540026848f9f11a8d.tar.gz |
Add debugPprType
We pretty-print a type by converting it to an IfaceType and
pretty-printing that. But
(a) that's a bit indirect, and
(b) delibrately loses information about (e.g.) the kind
on the /occurrences/ of a type variable
So this patch implements debugPprType, which pretty prints
the type directly, with no fancy formatting. It's just used
for debugging.
I took the opportunity to refactor the debug-pretty-printing
machinery a little. In particular, define these functions
and use them:
ifPprDeubug :: SDoc -> SDOc -> SDoc
-- Says what to do with and without -dppr-debug
whenPprDebug :: SDoc -> SDoc
-- Says what to do with -dppr-debug; without is empty
getPprDebug :: (Bool -> SDoc) -> SDoc
getPprDebug used to be called sdocPprDebugWith
whenPprDebug used to be called ifPprDebug
So a lot of files get touched in a very mechanical way
Diffstat (limited to 'compiler/deSugar/Desugar.hs')
-rw-r--r-- | compiler/deSugar/Desugar.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/deSugar/Desugar.hs b/compiler/deSugar/Desugar.hs index 4bfd10f2ef..fbb6386c60 100644 --- a/compiler/deSugar/Desugar.hs +++ b/compiler/deSugar/Desugar.hs @@ -435,7 +435,7 @@ warnRuleShadowing rule_name rule_act fn_id arg_ids <+> text "might inline first") , text "Probable fix: add an INLINE[n] or NOINLINE[n] pragma for" <+> quotes (ppr lhs_id) - , ifPprDebug (ppr (idInlineActivation lhs_id) $$ ppr rule_act) ]) + , whenPprDebug (ppr (idInlineActivation lhs_id) $$ ppr rule_act) ]) | check_rules_too , bad_rule : _ <- get_bad_rules lhs_id @@ -446,7 +446,7 @@ warnRuleShadowing rule_name rule_act fn_id arg_ids <+> text "for"<+> quotes (ppr lhs_id) <+> text "might fire first") , text "Probable fix: add phase [n] or [~n] to the competing rule" - , ifPprDebug (ppr bad_rule) ]) + , whenPprDebug (ppr bad_rule) ]) | otherwise = return () |