summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/Ppr.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simon.peytonjones@gmail.com>2022-01-21 13:01:11 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-01-27 02:40:11 -0500
commitf4ce41863c729f6b993b5e5dd3da69ebc3623327 (patch)
tree80780c5a8806a1a421a621528bdf801992714bea /compiler/GHC/Core/Ppr.hs
parent6e09b3cfdae6f034ee3a6dd52b61853c017b96f1 (diff)
downloadhaskell-f4ce41863c729f6b993b5e5dd3da69ebc3623327.tar.gz
Improve partial signatures
As #20921 showed, with partial signatures, it is helpful to use the same algorithm (namely findInferredDiff) for * picking the constraints to retain for the /group/ in Solver.decideQuantification * picking the contraints to retain for the /individual function/ in Bind.chooseInferredQuantifiers This is still regrettably declicate, but it's a step forward.
Diffstat (limited to 'compiler/GHC/Core/Ppr.hs')
-rw-r--r--compiler/GHC/Core/Ppr.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/GHC/Core/Ppr.hs b/compiler/GHC/Core/Ppr.hs
index f1791dfebf..853ed990bc 100644
--- a/compiler/GHC/Core/Ppr.hs
+++ b/compiler/GHC/Core/Ppr.hs
@@ -22,6 +22,7 @@ module GHC.Core.Ppr (
pprCoreExpr, pprParendExpr,
pprCoreBinding, pprCoreBindings, pprCoreAlt,
pprCoreBindingWithSize, pprCoreBindingsWithSize,
+ pprCoreBinder, pprCoreBinders,
pprRules, pprOptCo
) where
@@ -355,7 +356,6 @@ and @pprCoreExpr@ functions.
Note [Binding-site specific printing]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
pprCoreBinder and pprTypedLamBinder receive a BindingSite argument to adjust
the information printed.
@@ -393,6 +393,10 @@ pprCoreBinder bind_site bndr
= getPprDebug $ \debug ->
pprTypedLamBinder bind_site debug bndr
+pprCoreBinders :: [Var] -> SDoc
+-- Print as lambda-binders, i.e. with their type
+pprCoreBinders vs = sep (map (pprCoreBinder LambdaBind) vs)
+
pprUntypedBinder :: Var -> SDoc
pprUntypedBinder binder
| isTyVar binder = text "@" <> ppr binder -- NB: don't print kind
@@ -642,8 +646,7 @@ pprRule (Rule { ru_name = name, ru_act = act, ru_fn = fn,
ru_bndrs = tpl_vars, ru_args = tpl_args,
ru_rhs = rhs })
= hang (doubleQuotes (ftext name) <+> ppr act)
- 4 (sep [text "forall" <+>
- sep (map (pprCoreBinder LambdaBind) tpl_vars) <> dot,
+ 4 (sep [text "forall" <+> pprCoreBinders tpl_vars <> dot,
nest 2 (ppr fn <+> sep (map pprArg tpl_args)),
nest 2 (text "=" <+> pprCoreExpr rhs)
])