[GHC] #14348: Poly-kinded definitions silently introduce extra type arguments captured by TypeApplications
GHC
ghc-devs at haskell.org
Fri Oct 13 13:21:02 UTC 2017
#14348: Poly-kinded definitions silently introduce extra type arguments captured by
TypeApplications
-------------------------------------+-------------------------------------
Reporter: gallais | Owner: (none)
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.0.1
checker) | Keywords:
Resolution: invalid | TypeApplications
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: |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):
* status: new => closed
* keywords: => TypeApplications
* resolution: => invalid
Comment:
This is expected behavior. As noted in the
[https://downloads.haskell.org/~ghc/8.2.1/docs/html/users_guide/glasgow_exts.html?highlight
=#ghc-flag--XTypeApplications users' guide], GHC determines the order of
arguments for type applications by doing a stable topological sort on the
user-written type variables, keeping kind variables before type variables.
Since `k` is user-written, this means it's available for type application,
and since it's the kind of `a`, `k` comes before `a`.
If you don't want `k` to be available for type application, then you can
do so by not writing it explicitly:
{{{#!hs
{-# LANGUAGE GADTs, PolyKinds, ScopedTypeVariables, TypeApplications #-}
data EQ :: k -> k -> * where
Refl :: EQ a a
data Wrap a = Wrap (EQ a a)
wrap :: forall a. Wrap a
wrap = Wrap @a Refl
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14348#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list