[GHC] #14646: GHC 8.4.1 regression: rank-n types no longer parenthesized when pretty-printed

GHC ghc-devs at haskell.org
Mon Jan 8 01:43:56 UTC 2018


#14646: GHC 8.4.1 regression: rank-n types no longer parenthesized when pretty-
printed
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  high           |         Milestone:  8.4.1
          Component:  GHC API        |           Version:  8.4.1-alpha1
           Keywords:                 |  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:
-------------------------------------+-------------------------------------
 Take this file:

 {{{#!hs
 {-# LANGUAGE RankNTypes #-}
 {-# LANGUAGE TemplateHaskell #-}
 {-# OPTIONS_GHC -ddump-splices #-}
 module Bug where

 import Language.Haskell.TH

 $([d| f :: (forall a. a) -> Int
       f _ = undefined |])
 }}}

 In GHC 8.2.2, `-ddump-splices` behaves as you'd expect:

 {{{
 $ /opt/ghc/8.2.2/bin/ghci Bug.hs
 GHCi, version 8.2.2: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Bug              ( Bug.hs, interpreted )
 Bug.hs:(8,3)-(9,24): Splicing declarations
     [d| f_a1zL :: (forall a_a1zM. a_a1zM) -> Int
         f_a1zL _ = undefined |]
   ======>
     f_a49Z :: (forall a_a4a0. a_a4a0) -> Int
     f_a49Z _ = undefined
 Ok, one module loaded.
 }}}

 But in GHC 8.4.1-alpha (and HEAD), the GHC pretty-printer incorrectly
 leaves off the parentheses around the type `(forall a. a)`:

 {{{
 $ /opt/ghc/8.4.1/bin/ghci Bug.hs
 GHCi, version 8.4.0.20171222: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Bug              ( Bug.hs, interpreted )
 Bug.hs:(8,3)-(9,24): Splicing declarations
     [d| f_a1EF :: (forall a_a1EG. a_a1EG) -> Int
         f_a1EF _ = undefined |]
   ======>
     f_a4ap :: forall a_a4aq. a_a4aq -> Int
     f_a4ap _ = undefined
 Ok, one module loaded.
 }}}

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


More information about the ghc-tickets mailing list