[commit: ghc] wip/exp-pat-frame: Fix #16299 by deleting incorrect code from IfaceSyn (8b476d8)

git at git.haskell.org git at git.haskell.org
Wed Feb 13 08:49:52 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/exp-pat-frame
Link       : http://ghc.haskell.org/trac/ghc/changeset/8b476d822e97cfe4cebe6e74924d9a79148d608c/ghc

>---------------------------------------------------------------

commit 8b476d822e97cfe4cebe6e74924d9a79148d608c
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Sun Feb 10 11:21:12 2019 -0500

    Fix #16299 by deleting incorrect code from IfaceSyn
    
    GHCi's `:info` command was pretty-printing Haskell98-style data types
    with explicit return kinds if the return kind wasn't `Type`. This
    leads to bizarre output like this:
    
    ```
    λ> :i (##)
    data (##) :: TYPE ('GHC.Types.TupleRep '[]) = (##)
            -- Defined in ‘GHC.Prim’
    ```
    
    Or, with unlifted newtypes:
    
    ```
    λ> newtype T = MkT Int#
    λ> :i T
    newtype T :: TYPE 'IntRep = MkT Int#
            -- Defined at <interactive>:5:1
    ```
    
    The solution is simple: just delete one part from `IfaceSyn` where
    GHC mistakenly pretty-prints the return kinds for non-GADTs.


>---------------------------------------------------------------

8b476d822e97cfe4cebe6e74924d9a79148d608c
 compiler/iface/IfaceSyn.hs                | 2 +-
 testsuite/tests/ghci/scripts/T7627.stdout | 7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs
index 5478c94..3dd8a21 100644
--- a/compiler/iface/IfaceSyn.hs
+++ b/compiler/iface/IfaceSyn.hs
@@ -713,7 +713,7 @@ pprIfaceDecl ss (IfaceData { ifName = tycon, ifCType = ctype,
                      , nest 2 (vcat pp_cons)
                      , nest 2 $ ppShowIface ss pp_extra ]
   | otherwise = vcat [ pp_roles
-                     , hang (pp_nd <+> pp_lhs <+> pp_kind) 2 (add_bars pp_cons)
+                     , hang (pp_nd <+> pp_lhs) 2 (add_bars pp_cons)
                      , nest 2 $ ppShowIface ss pp_extra ]
   where
     is_data_instance = isIfaceDataInstance parent
diff --git a/testsuite/tests/ghci/scripts/T7627.stdout b/testsuite/tests/ghci/scripts/T7627.stdout
index 8bf93a0..ff4e670 100644
--- a/testsuite/tests/ghci/scripts/T7627.stdout
+++ b/testsuite/tests/ghci/scripts/T7627.stdout
@@ -7,8 +7,7 @@ instance Show () -- Defined in ‘GHC.Show’
 instance Read () -- Defined in ‘GHC.Read’
 instance Enum () -- Defined in ‘GHC.Enum’
 instance Bounded () -- Defined in ‘GHC.Enum’
-data (##) :: TYPE ('GHC.Types.TupleRep '[]) = (##)
-  	-- Defined in ‘GHC.Prim’
+data (##) = (##) 	-- Defined in ‘GHC.Prim’
 () :: ()
 (##) :: (# #)
 (   ) :: ()
@@ -29,9 +28,7 @@ instance Foldable ((,) a) -- Defined in ‘Data.Foldable’
 instance Traversable ((,) a) -- Defined in ‘Data.Traversable’
 instance (Bounded a, Bounded b) => Bounded (a, b)
   -- Defined in ‘GHC.Enum’
-data (#,#) (a :: TYPE k0) (b :: TYPE k1) :: TYPE
-                                              ('GHC.Types.TupleRep '[k0, k1])
-  = (#,#) a b
+data (#,#) (a :: TYPE k0) (b :: TYPE k1) = (#,#) a b
   	-- Defined in ‘GHC.Prim’
 (,) :: a -> b -> (a, b)
 (#,#) :: a -> b -> (# a, b #)



More information about the ghc-commits mailing list