[GHC] #15527: TypeApplications error message doesn't parenthesize infix name

GHC ghc-devs at haskell.org
Wed Aug 15 20:29:06 UTC 2018


#15527: TypeApplications error message doesn't parenthesize infix name
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.4.3
           Keywords:                 |  Operating System:  Unknown/Multiple
  TypeApplications                   |
       Architecture:                 |   Type of failure:  Poor/confusing
  Unknown/Multiple                   |  error message
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 If you compile the following program:

 {{{#!hs
 module Bug where

 f :: (Int -> Int) -> (Int -> Int) -> (Int -> Int)
 f =  (.) @Int
 }}}

 You'll get this error:

 {{{
 $ /opt/ghc/8.4.3/bin/ghc Bug.hs
 [1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

 Bug.hs:4:6: error:
     Pattern syntax in expression context: . at Int
     Did you mean to enable TypeApplications?
   |
 4 | f =  (.) @Int
   |      ^^^^^^^^
 }}}

 I was taken aback by this strange `.@` thing before I realized what was
 actually going on: the error message simply forgot to parenthesize `.`.
 This is `ppr_expr`'s fault, since it calls `ppr` on an `RdrName` instead
 of `pprPrefixOcc`. Patch incoming.

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


More information about the ghc-tickets mailing list