Skip to content

GHC 8.4.1 pretty-prints data family instances with redundant kind signatures using -ddump-splices

Consider this program:

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

$([d| data family Foo :: *
      data instance Foo :: * |])

On GHC 8.2.2, this gives the following -ddump-splices output:

$ /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:(6,3)-(7,31): Splicing declarations
    [d| data family Foo_a1sB :: *
        
        data instance :: * |]
  ======>
    data family Foo_a494 :: GHC.Types.Type
    data instance :: GHC.Types.Type

But on GHC 8.4.1, we have:

$ /opt/ghc/8.4.1/bin/ghci Bug.hs
GHCi, version 8.4.0.20180209: 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)-(7,31): Splicing declarations
    [d| data family Foo_a1xd :: *
        
        data instance Foo_a1xd :: * :: * |]
  ======>
    data family Foo_a487 :: GHC.Types.Type
    data instance Foo_a487 :: GHC.Types.Type :: GHC.Types.Type

Notice how there is a redundant kind signature in data instance Foo_a1xd :: * :: *.

Trac metadata
Trac field Value
Version 8.4.1-alpha3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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