Skip to content

-ddump-splices does not parenthesize rank-n contexts correctly

Ryan discovers another -ddump-splices bug—news at 11:

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

$([d| f :: forall a. (Show a => a) -> a
      f _ = undefined
    |])
$ /opt/ghc/8.4.3/bin/ghci Bug.hs -dsuppress-uniques
GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help                                                                                                                                             
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )
Bug.hs:(6,3)-(8,6): Splicing declarations
    [d| f :: forall a. (Show a => a) -> a
        f _ = undefined |]
  ======>
    f :: forall a. Show a => a -> a
    f _ = undefined

Notice that f's type signature is pretty-printed as forall a. Show a => a -> a, which is just wrong. Patch incoming.

Trac metadata
Trac field Value
Version 8.4.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
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