Opened 4 years ago

Closed 4 years ago

#8856 closed bug (fixed)

ScopedTypeVariables & PolyKinds lead to weird error message

Reported by: goldfire Owned by:
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.8.1-rc2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: typecheck/should_compile/T8856
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


When I try to compile

{-# LANGUAGE ScopedTypeVariables, RankNTypes, PolyKinds #-}

module Bug where

import Data.Proxy

foo = (undefined :: Proxy a) :: forall a. Proxy a

I get

    Kind variable ‘k’ used as a type
    In an expression type signature: Proxy a
    In the expression: (undefined :: Proxy a) :: forall a. Proxy a
    In an equation for ‘foo’:
        foo = (undefined :: Proxy a) :: forall a. Proxy a

This is all the more odd given that k does not appear in my code!

This bug happens both in HEAD and in 7.8.1 RC 2.

Change History (4)

comment:1 Changed 4 years ago by Simon Peyton Jones <simonpj@…>

In cf1a0f971966af633fbd932ad012ce716680465b/ghc:

Fix the treatment of lexically scoped kind variables (Trac #8856)

The issue here is described in Note [Binding scoped type variables] in
TcPat.  When implementing this fix I was able to make things quite a
bit simpler:
 * The type variables in a type signature now never unify
   with each other, and so can be straightfoward skolems.
 * We only need the SigTv stuff for signatures in patterns,
   and for kind variables.

comment:2 Changed 4 years ago by Simon Peyton Jones <simonpj@…>

comment:3 Changed 4 years ago by simonpj

Status: newmerge
Test Case: typecheck/should_compile/T8856

Good point, thank you.

This is a real bug and should probably be merged to 7.8 Simon

comment:4 Changed 4 years ago by thoughtpolice

Milestone: 7.8.1
Resolution: fixed
Status: mergeclosed


Note: See TracTickets for help on using tickets.