Skip to content

:kind! is not expanding type synonyms anymore

Given

type A = ()
:kind! A

Expected result:

A :: *
= ()

Actual result:

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
Trac metadata
Trac field Value
Version 8.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Linux
Architecture x86_64 (amd64)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information