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

GHC ghc-devs at haskell.org
Sat Jan 28 13:17:48 UTC 2017


#13199: TH-spliced class instances are pretty-printed incorrectly post-#3384
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  alanz
            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 alanz):

 Tracing it through, the problem comes inside `runRnSplice`, where we end
 up (using `showAstData`) with `zonked_q_expr` passing


 {{{
 ...
 ({ T13199.hs:9:16-28 }
   (HsAppTy
    ({ T13199.hs:9:16-18 }
     (HsAppTy
      ({ T13199.hs:9:16 }
       (HsTyVar
        (NotPromoted)
        ({ T13199.hs:9:16 }{Name: main:Bug.C{tc row}})))
      ({ T13199.hs:9:18 }
       (HsTyVar
        (NotPromoted)
        ({ T13199.hs:9:18 }{Name: a{tv aqF}})))))
    ({ T13199.hs:9:20-28 }
     (HsParTy
      ({ T13199.hs:9:21-27 }
       (HsAppTy
        ({ T13199.hs:9:21-25 }
         (HsTyVar
          (NotPromoted)
          ({ T13199.hs:9:21-25 }{Name: base:GHC.Base.Maybe{(w) tc 3Q}})))
        ({ T13199.hs:9:27 }
         (HsTyVar
          (NotPromoted)
          ({ T13199.hs:9:27 }{Name: b{tv aqG}})))))))))
 ...
 }}}

 to

 {{{#!hs
        ; result <- setStage (RunSplice mod_finalizers_ref) $
                      run_meta zonked_q_expr
 }}}

 giving

 {{{
 ...
 ({ T13199.hs:(9,3)-(10,6) }
   (HsAppTy
    ({ T13199.hs:(9,3)-(10,6) }
     (HsAppTy
      ({ T13199.hs:(9,3)-(10,6) }
       (HsTyVar
        (NotPromoted)
        ({ <no location info> }
         (Orig
          ({abstract:Module}) {OccName: C}))))
      ({ T13199.hs:(9,3)-(10,6) }
       (HsTyVar
        (NotPromoted)
        ({ T13199.hs:(9,3)-(10,6) }
         (Exact {Name: a_a3Ub{tv}}))))))
    ({ T13199.hs:(9,3)-(10,6) }
     (HsAppTy
      ({ T13199.hs:(9,3)-(10,6) }
       (HsTyVar
        (NotPromoted)
        ({ <no location info> }
         (Orig
          ({abstract:Module}) {OccName: Maybe}))))
      ({ T13199.hs:(9,3)-(10,6) }
       (HsTyVar
        (NotPromoted)
        ({ T13199.hs:(9,3)-(10,6) }
         (Exact {Name: b_a3Uc{tv}}))))))))
 ...
 }}}

 So something happening via the `run_meta` process is discarding the
 `HsParTy`.

 And in this instance `run_meta` is

 {{{#!hs
 runMetaD :: LHsExpr Id          -- Of type Q [Dec]
          -> TcM [LHsDecl RdrName]
 }}}

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


More information about the ghc-tickets mailing list