Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,866
    • Issues 4,866
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 461
    • Merge requests 461
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14646
Closed
Open
Created Jan 08, 2018 by Ryan Scott@RyanGlScottMaintainer

GHC 8.4.1 regression: rank-n types no longer parenthesized when pretty-printed

Take this file:

{-# 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.
Trac metadata
Trac field Value
Version 8.4.1-alpha1
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component GHC API
Test case
Differential revisions
BlockedBy
Related
Blocking
CC alanz
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking