diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-05-17 08:45:53 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-05-17 08:46:38 -0400 |
commit | 5bcf86063c0e5b6ee0d162ea64c88fdaad89e620 (patch) | |
tree | dd1a42850b158872277122f4d215eb6f4ba852eb | |
parent | 568d7279a80cf945271f0659f11a94eea3f1433d (diff) | |
download | haskell-wip/duplicate-forall-printing-notes.tar.gz |
Remove duplicate Note [When to print foralls] in GHC.Core.TyCo.Pprwip/duplicate-forall-printing-notes
There are two different Notes named `[When to print foralls]`. The
most up-to-date one is in `GHC.Iface.Type`, but there is a second
one in `GHC.Core.TyCo.Ppr`. The latter is less up-to-date, as it was
written before GHC switched over to using ifaces to pretty-print
types. I decided to just remove the latter and replace it with a
reference to the former.
[ci skip]
-rw-r--r-- | compiler/GHC/Core/TyCo/Ppr.hs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/compiler/GHC/Core/TyCo/Ppr.hs b/compiler/GHC/Core/TyCo/Ppr.hs index 6678a00559..71077bdb76 100644 --- a/compiler/GHC/Core/TyCo/Ppr.hs +++ b/compiler/GHC/Core/TyCo/Ppr.hs @@ -171,7 +171,8 @@ pprSigmaType = pprIfaceSigmaType ShowForAllWhen . tidyToIfaceType pprForAll :: [TyCoVarBinder] -> SDoc pprForAll tvs = pprIfaceForAll (map toIfaceForAllBndr tvs) --- | Print a user-level forall; see Note [When to print foralls] in this module. +-- | Print a user-level forall; see @Note [When to print foralls]@ in +-- "GHC.Iface.Type". pprUserForAll :: [TyCoVarBinder] -> SDoc pprUserForAll = pprUserIfaceForAll . map toIfaceForAllBndr @@ -253,24 +254,6 @@ debug_ppr_ty prec ty@(ForAllTy {}) = ([], ty) {- -Note [When to print foralls] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Mostly we want to print top-level foralls when (and only when) the user specifies --fprint-explicit-foralls. But when kind polymorphism is at work, that suppresses -too much information; see #9018. - -So I'm trying out this rule: print explicit foralls if - a) User specifies -fprint-explicit-foralls, or - b) Any of the quantified type variables has a kind - that mentions a kind variable - -This catches common situations, such as a type siguature - f :: m a -which means - f :: forall k. forall (m :: k->*) (a :: k). m a -We really want to see both the "forall k" and the kind signatures -on m and a. The latter comes from pprTCvBndr. - Note [Infix type variables] ~~~~~~~~~~~~~~~~~~~~~~~~~~~ With TypeOperators you can say |