[GHC] #13795: :kind! is not expanding type synonyms anymore

GHC ghc-devs at haskell.org
Tue Jun 6 23:58:14 UTC 2017


#13795: :kind! is not expanding type synonyms anymore
--------------------------------------+---------------------------------
           Reporter:  Hjulle          |             Owner:  (none)
               Type:  bug             |            Status:  new
           Priority:  normal          |         Milestone:
          Component:  Compiler        |           Version:  8.0.2
           Keywords:                  |  Operating System:  Linux
       Architecture:  x86_64 (amd64)  |   Type of failure:  None/Unknown
          Test Case:                  |        Blocked By:
           Blocking:                  |   Related Tickets:
Differential Rev(s):                  |         Wiki Page:
--------------------------------------+---------------------------------
 Given
 {{{#!hs
 type A = ()
 :kind! A
 }}}

 Expected result:
 {{{#!hs
 A :: *
 = ()
 }}}

 Actual result:
 {{{#!hs
 A :: *
 = A
 }}}

 ----

 Some IRC conversation on the topic (on #ghc):
 {{{
 23:37 < hjulle> :kind! does not seem to expand type synonyms for me (in
 GHC 8.0.2), it just prints them
                 verbatim. Does anyone else have this problem? Example:
 "type A = ()" ":kind! A" will print out "A :: * = A" (which is not very
 helpful).
 23:40 < hjulle> Is this a bug? The documentation
 (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html
 #ghci-cmd-:kind)
                 explicitly states that :kind! should expand type synonyms,
 so I think yes?
 23:57 < RyanGlScott> hjulle: That's absolute a bug. File a ticket!
 23:57 < RyanGlScott> *absolutely
 23:58 < RyanGlScott> Moreover, I know why that's happening
 23:59 < RyanGlScott> Internally, :kind! uses the normalise_type function
 to reduce type families:
 http://git.haskell.org/ghc.git/blob/e77b9a2069bca9018f989d7c4f54da099e3ab215:/compiler/types/FamInstEnv.hs#l1408
 23:59 < RyanGlScott> But see the comment there
 Day changed to 07 jun 2017
 00:00 < RyanGlScott> -- Try to not to disturb type synonyms if possible
 00:01 < RyanGlScott> So fixing this would just be a matter of calling
 coreView afterwards (which expands
                      type synonyms)
 00:02 < RyanGlScott> er, actually, expandTypeSynonyms is even better:
 http://git.haskell.org/ghc.git/blob/e77b9a2069bca9018f989d7c4f54da099e3ab215:/compiler/types/Type.hs#l364

 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13795>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list