[GHC] #14578: Incorrect parenthesization of types in -ddump-deriv

GHC ghc-devs at haskell.org
Wed Dec 13 18:56:39 UTC 2017


#14578: Incorrect parenthesization of types in -ddump-deriv
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:  deriving
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Debugging         |  Unknown/Multiple
  information is incorrect           |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 And here is why: the type `App (Compose f g) a` is produced by the
 function
 [http://git.haskell.org/ghc.git/blob/0a12d92a8f65d374f9317af2759af2b46267ad5c:/compiler/hsSyn/HsUtils.hs#l620
 typeToLHsType]. Here is the line of code that's responsible:

 {{{#!hs
     go (TyConApp tc args)   = nlHsTyConApp (getRdrName tc) (map go args')
        where
          args' = filterOutInvisibleTypes tc args
 }}}

 Notice that this does not attempt to put the appropriate `HsParTy`s in
 place. I think an appropriate way to fix this would be to adopt the same
 trick that alanz has used elsewhere: apply the
 [http://git.haskell.org/ghc.git/blob/0a12d92a8f65d374f9317af2759af2b46267ad5c:/compiler/hsSyn/Convert.hs#l1324
 mk_apps] function to `tc` and `args'`.

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


More information about the ghc-tickets mailing list