[GHC] #14887: Explicitly quantifying a kind variable causes a telescope to fail to kind-check

GHC ghc-devs at haskell.org
Thu Aug 9 14:14:50 UTC 2018


#14887: Explicitly quantifying a kind variable causes a telescope to fail to kind-
check
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  goldfire
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.8.1
       Component:  Compiler (Type    |              Version:  8.2.2
  checker)                           |
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 I've found another bizarre case where implicitly quantifying a kind
 variable works, but explicitly quantifying it does not. Consider the
 following program:

 {{{#!hs
 {-# LANGUAGE PartialTypeSignatures #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE TypeInType #-}
 {-# OPTIONS_GHC -Wno-partial-type-signatures #-}
 module Bug where

 import Data.Proxy

 f :: forall (x :: a). Proxy (x :: _)
 f = Proxy
 }}}

 This typechecks, but if I change the type signature of `f` to explicitly
 quantify `a`:

 {{{#!hs
 f :: forall a (x :: a). Proxy (x :: _)
 }}}

 Then it no longer typechecks! Here is the error you get an a somewhat
 recent GHC HEAD build:

 {{{
 GHCi, version 8.7.20180802: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Bug              ( Bug.hs, interpreted )

 Bug.hs:9:32: error:
     • Expected kind ‘a’, but ‘x’ has kind ‘a1’
     • In the first argument of ‘Proxy’, namely ‘(x :: _)’
       In the type ‘Proxy (x :: _)’
       In the type signature: f :: forall a (x :: a). Proxy (x :: _)
   |
 9 | f :: forall a (x :: a). Proxy (x :: _)
   |                                ^
 }}}

 Do you think that this shares a symptom in common with the other programs
 mentioned in this ticket? (Or is this a separate bug?)

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


More information about the ghc-tickets mailing list