Higher-rank kind ascription oddities
GHC accepts these two definitions:
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeInType #-}
module Bug where
import Data.Proxy
f :: forall (x :: forall a. a -> Int). Proxy x
f = Proxy
g :: forall (x :: forall a. a -> Int). Proxy (x :: forall b. b -> Int)
g = Proxy
However, it does not accept this one, which (AFAICT) should be equivalent to the two above:
h :: forall x. Proxy (x :: forall b. b -> Int)
h = Proxy
GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:13:23: error:
• Expected kind ‘forall b. b -> Int’, but ‘x’ has kind ‘k0’
• In the first argument of ‘Proxy’, namely
‘(x :: forall b. b -> Int)’
In the type signature:
h :: forall x. Proxy (x :: forall b. b -> Int)
|
13 | h :: forall x. Proxy (x :: forall b. b -> Int)
| ^
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.2.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |