[GHC] #15415: GHCi's :kind doesn't work with wildcards

GHC ghc-devs at haskell.org
Thu Jul 19 00:40:07 UTC 2018


#15415: GHCi's :kind doesn't work with wildcards
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by goldfire:

Old description:

> Witness this GHCi session:
>
> {{{
> rae:20:35:37 ~/ghc/ghc-head/ghc> ~/ghc/ghc-head/inplace/bin/ghc-stage2
> --interactive
> GHCi, version 8.7.20180716: http://www.haskell.org/ghc/  :? for help
> Loaded GHCi configuration from /Users/rae/.ghc/ghci.conf
> Prelude> :set -XPartialTypeSignatures
> Prelude> import Data.Proxy
> Prelude Data.Proxy> :k Proxy _
> Proxy _ :: *
> Prelude Data.Proxy> :k Proxy (Maybe :: _)
>
> <interactive>:1:8: error:
>     • Expecting one more argument to ‘Maybe’
>       Expected kind ‘_’, but ‘Maybe’ has kind ‘* -> *’
>     • In the first argument of ‘Proxy’, namely ‘(Maybe :: _)’
>       In the type ‘Proxy (Maybe :: _)’
> }}}
>
> It seems we're not doing the correct wildcard thing here: GHCi should
> report that `_` should be `Type -> Type`.
>
> I believe that this is because `TcHsType.tcWildCardBinders` uses
> `newSkolemTyVar` internally; `tcWildCardBinders` is called from
> `TcRnDriver.tcRnType`, which is the implementation of GHCi's `:kind`.
> This is GHC's only call of `tcWildCardBinders`. All other places use
> `tcWildCardBindersX newWildTyVar`, which makes vastly more sense.
>
> I would just fix this myself, but it smells intentional. Does anyone know
> why we have all this?

New description:

 Witness this GHCi session:

 {{{
 rae:20:35:37 ~/ghc/ghc-head/ghc> ~/ghc/ghc-head/inplace/bin/ghc-stage2
 --interactive
 GHCi, version 8.7.20180716: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /Users/rae/.ghc/ghci.conf
 Prelude> :set -XPartialTypeSignatures
 Prelude> import Data.Proxy
 Prelude Data.Proxy> :k Proxy _
 Proxy _ :: *
 Prelude Data.Proxy> :k Proxy (Maybe :: _)

 <interactive>:1:8: error:
     • Expecting one more argument to ‘Maybe’
       Expected kind ‘_’, but ‘Maybe’ has kind ‘* -> *’
     • In the first argument of ‘Proxy’, namely ‘(Maybe :: _)’
       In the type ‘Proxy (Maybe :: _)’
 }}}

 It seems we're not doing the correct wildcard thing here: GHCi should
 report that `_` should be `Type -> Type`.

 I believe that this is because `TcHsType.tcWildCardBinders` uses
 `newSkolemTyVar` internally; `tcWildCardBinders` is called from
 `TcRnDriver.tcRnType`, which is the implementation of GHCi's `:kind`. This
 is GHC's only call of `tcWildCardBinders`. All other places use
 `tcWildCardBindersX newWildTyVar`, which makes vastly more sense.

 I would just fix this myself, but it smells intentional. Does anyone know
 why we have all this?

 (Credit to @int-index who found this bug.)

--

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


More information about the ghc-tickets mailing list