haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

Kinds of type variables, inferred kinds of all types

Open Jashweii opened this issue 3 years ago • 1 comments

When hovering over types haskell-language-server gives you its kind, but this doesn't work for type variables

import Data.Kind (Type)
data X a = X
f :: forall a b . a -> X b
f v = X

For the term variable v I get v :: a, for the type level X I get forall {k} . k -> Type, but I only get the "defined at ..." for the type variables a and b. Similarly but maybe a separate issue - for uses of polymorphic types I also get the applied, more specific type at the use site, but this doesn't happen for types with polymorphic kinds.

import Data.Kind (Type)
type X :: forall k . k -> Type
data X a = X
f :: (forall (x :: Type) . X x -> b) -> X {- @Type -} () -> b
f h = h {- @() -}

If I hover the use of h (not the pattern binding it) it tells me both h :: forall x. X x -> b and _ :: X () -> b, but if I hover X in X () I only get X :: forall k. k -> Type, no _ :: Type -> Type.

Jashweii avatar Aug 13 '22 04:08 Jashweii

Unfortunately GHC doesn't expose this information to use in an easy to use format, see https://gitlab.haskell.org/ghc/ghc/-/issues/13737 for more information.

wz1000 avatar Sep 07 '22 11:09 wz1000