Skip to content

Pretty-printer butchers function arrow fixity on GHC HEAD

This code:

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

$([d| f :: Either Int (Int -> Int)
      f = undefined
    |])

Pretty-prints incorrectly on GHC HEAD:

$ /opt/ghc/head/bin/ghci Bug.hs
GHCi, version 8.3.20170706: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )
Bug.hs:(5,3)-(7,6): Splicing declarations
    [d| f_a1sG :: Either Int (Int -> Int)
        f_a1sG = undefined |]
  ======>
    f_a4bj :: Either Int Int -> Int
    f_a4bj = undefined

But not on GHC 8.2.1-rc3:

$ /opt/ghc/8.2.1/bin/ghci Bug.hs
GHCi, version 8.2.0.20170704: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )
Bug.hs:(5,3)-(7,6): Splicing declarations
    [d| f_a1su :: Either Int (Int -> Int)
        f_a1su = undefined |]
  ======>
    f_a4aV :: Either Int (Int -> Int)
    f_a4aV = undefined
Trac metadata
Trac field Value
Version 8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information