[GHC] #13199: TH-spliced class instances are pretty-printed incorrectly post-#3384

GHC ghc-devs at haskell.org
Sat Jan 28 04:44:43 UTC 2017


#13199: TH-spliced class instances are pretty-printed incorrectly post-#3384
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 This change was triggered by
 [http://git.haskell.org/ghc.git/blobdiff/83d69dca896c7df1f2a36268d5b45c9283985ebf..499e43824bda967546ebf95ee33ec1f84a114a7c:/compiler/hsSyn/HsTypes.hs
 this modification] in `HsTypes`:

 {{{#!diff
 diff --git a/compiler/hsSyn/HsTypes.hs b/compiler/hsSyn/HsTypes.hs
 index 6d82f92..e3e5246 100644 (file)
 --- a/compiler/hsSyn/HsTypes.hs
 +++ b/compiler/hsSyn/HsTypes.hs
 @@ -1279,13 +1313,11 @@ ppr_mono_ty ctxt_prec (HsEqTy ty1 ty2)
    = maybeParen ctxt_prec TyOpPrec $
      ppr_mono_lty TyOpPrec ty1 <+> char '~' <+> ppr_mono_lty TyOpPrec ty2

 -ppr_mono_ty ctxt_prec (HsAppsTy tys)
 -  = maybeParen ctxt_prec TyConPrec $
 -    hsep (map (ppr_app_ty TopPrec . unLoc) tys)
 +ppr_mono_ty _ctxt_prec (HsAppsTy tys)
 +  = hsep (map (ppr_app_ty TopPrec . unLoc) tys)

 -ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty)
 -  = maybeParen ctxt_prec TyConPrec $
 -    hsep [ppr_mono_lty FunPrec fun_ty, ppr_mono_lty TyConPrec arg_ty]
 +ppr_mono_ty _ctxt_prec (HsAppTy fun_ty arg_ty)
 +  = hsep [ppr_mono_lty FunPrec fun_ty, ppr_mono_lty TyConPrec arg_ty]
 }}}

 Adding back the `maybeParen ctxt_prec TyConPrec` part in the `HsAppTy`
 case fixes the issue for me. However, I suspect you made this change for a
 reason, alanz - do you know what's going on here?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13199#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list