[GHC] #11966: Surprising behavior with higher-rank quantification of kind variables

#11966: Surprising behavior with higher-rank quantification of kind variables -------------------------------------+------------------------------------- Reporter: ocharles | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1-rc3 (Type checker) | 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: -------------------------------------+------------------------------------- Sorry about the rubbish title. I wrote the following code, which type checks: {{{#!hs {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeInType #-} {-# LANGUAGE TypeOperators #-} module Test where import Data.Kind (Type) -- Simplification type family Col (f :: k -> j) (x :: k) :: Type -- Base types data PGBaseType = PGInteger | PGText -- Transformations data Column t = Column Symbol t newtype Nullable t = Nullable t newtype HasDefault t = HasDefault t -- Interpretations data Expr k data Record (f :: forall k. k -> Type) = Record {rX :: Col f ('Column "x" 'PGInteger) ,rY :: Col f ('Column "y" ('Nullable 'PGInteger)) ,rZ :: Col f ('HasDefault 'PGText)} }}} However, if I play with this in GHCI, I can get the following error: {{{ λ> let x = undefined :: Record Expr <interactive>:136:29-32: error: • Expected kind ‘forall k. k -> Type’, but ‘Expr’ has kind ‘forall k. k -> *’ • In the first argument of ‘Record’, namely ‘Expr’ In an expression type signature: Record Expr In the expression: undefined :: Record Expr }}} It seems that if I write {{{#!hs data Expr :: forall k. k -> Type }}} things work, but I'm unclear if/why that is necessary, and the error message certainly needs to be fixed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11966 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11966: Surprising behavior with higher-rank quantification of kind variables -------------------------------------+------------------------------------- Reporter: ocharles | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1-rc3 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): Luckily, commit a7ee2d4c4229b27af324ebac93081f692835365d (Improve TcFlatten.flattenTyVar) fixed this! I'll add a regression test. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11966#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11966: Surprising behavior with higher-rank quantification of kind variables
-------------------------------------+-------------------------------------
Reporter: ocharles | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.0.1-rc3
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 Ryan Scott

#11966: Surprising behavior with higher-rank quantification of kind variables -------------------------------------+------------------------------------- Reporter: ocharles | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.0.1-rc3 checker) | Resolution: fixed | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | dependent/should_compile/T11966 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * testcase: => dependent/should_compile/T11966 * status: new => closed * resolution: => fixed * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11966#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC