[GHC] #13887: Template Haskell pretty-printer doesn't parenthesize infix datatype names in data declarations

GHC ghc-devs at haskell.org
Sat Jul 8 16:26:25 UTC 2017


#13887: Template Haskell pretty-printer doesn't parenthesize infix datatype names
in data declarations
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  ak3n
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.0.1
      Resolution:                    |             Keywords:  newcomer
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Replying to [comment:3 ak3n]:
 > Yep, I tried to run the whole test suite and it finished with 417
 unexpected failures.

 Well, chances are that most of the tests were pretty-printing information
 incorrectly, so this perhaps isn't so surprising. Make sure to eyeball the
 new test results to confirm that they look correct, and if so, you can run
 `make accept TEST="Test1 Test2 ... TestN"` to have GHC accept the new
 results. (If you're not sure, feel free to consult.)

 > Also, should we change `pprParendType (VarT v)            = ppr v` too?
 Because of `pprExp _ (VarE v)     = pprName' Applied v`.

 Good question. For consistency, I think we probably should apply this
 change to `VarE` as well. That being said, I'm not sure if you can
 actually have a type-level variable that's syntactically infix, so I don't
 think you can actually observe this behavior in practice. For instance, I
 tried this:

 {{{
 λ> $([d| type F ((**) :: * -> * -> *) x y = x ** y |] >>= stringE .
 pprint)

 <interactive>:30:14: error:
     Unexpected type ‘((**) :: * -> * -> *)’
     In the type declaration for ‘F’
     A type declaration should have form
       type F a b c = ...
 }}}

 But in case this ever changes, it would be nice to have Template Haskell
 Just Work™, so I'd be fine with this change.

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


More information about the ghc-tickets mailing list