[GHC] #14348: Poly-kinded definitions silently introduce extra type arguments captured by TypeApplications

GHC ghc-devs at haskell.org
Fri Oct 13 11:43:46 UTC 2017


#14348: Poly-kinded definitions silently introduce extra type arguments captured by
TypeApplications
-------------------------------------+-------------------------------------
           Reporter:  gallais        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
  (Type checker)                     |
           Keywords:                 |  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:
-------------------------------------+-------------------------------------
 The first type argument of a poly-kinded definition is not the one
 explicitly quantified over in the definition but rather the implicitly
 inserted kind.

 This leads to the puzzling error message "Expected a type, but ‘a’ has
 kind ‘k’" when ghc actually expected a kind.

 {{{#!haskell
 {-# LANGUAGE GADTs, PolyKinds, ScopedTypeVariables, TypeApplications #-}

 data EQ :: k -> k -> * where
   Refl :: EQ a a

 data Wrap (a :: k) = Wrap (EQ a a)

 wrap :: forall (a :: k). Wrap a
 wrap = Wrap @a Refl -- fails
 -- wrap = Wrap @k @a Refl -- works
 }}}

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


More information about the ghc-tickets mailing list