Opened 4 years ago

Closed 4 years ago

#7586 closed bug (fixed)

:kind command cannot show kind of type synonyms

Reported by: augustss Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: ghci/scripts/T7586
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The following illustrates the problem:

Prelude> type T a = Int
Prelude> :k T

    Type synonym `T' should have 1 argument, but has been given none
    In a type in a GHCi command: T

Undoubtedly, T has a kind, and there's no reason to insist that the type given to the :kind command should be fully applied.

Change History (5)

comment:1 Changed 4 years ago by simonpj

difficulty: Unknown

The :kind command takes a type not a name as its argument. So you can sy

Prelude> :k [Int]

for example. would you expect this to work?

Prelude> type T a b = Int
Prelude> :k (Monad (T Int))

Probably not. It's well-kinded but T is partially applied. OK, so how about this?

Prelude> type T a b = Int
Prelude> :k (T Int)

Now it's less obvious. Perhaps we should report * -> *, but it's clearly a hack ot do so.

For the case you give where it's just a simple name, it is arguably really pedantic not to report the kind of the synonym. Really you should use :info when you just have a name.

Suggestion: perhaps :kind (and :type), when applied to a name, should simply delegate to :info? Would that be better than some kind of hack to :kind?

(Mind you :info is not printing nicely for polykinded things, yet.)


comment:2 Changed 4 years ago by igloo

Resolution: wontfix
Status: newclosed

I think that special casing :kind and :type when applied to names would be a bad idea. That magic will just cause even more confusion overall.

comment:3 Changed 4 years ago by simonpj

Resolution: wontfix
Status: closednew

I'm not convinced. It occurs to me that we could simply make :kind less picky about the types it is given; in particular, not check that synonyms are fully applied.

comment:4 Changed 4 years ago by simonpj@…

commit 46e204f7e0dc08a84a64ecc2fdaa9e3abef8438f

Author: Simon Peyton Jones <>
Date:   Tue Apr 16 16:40:48 2013 +0100

    Allow partial applications of a type synonym in :kind in GHCi (Trac #7586)
    Documentation is done too

 compiler/typecheck/TcValidity.lhs |   68 ++++++++++++++++++++----------------
 docs/users_guide/ghci.xml         |   18 +++++++++-
 2 files changed, 55 insertions(+), 31 deletions(-)

comment:5 Changed 4 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: ghci/scripts/T7586

OK I've done this. If everyone hates it we can back out, but I see Lennart's point exactly. (And :info doesn't actually display the kind either!)


Note: See TracTickets for help on using tickets.