[GHC] #14555: GHC Panic with TypeInType / levity polymorphism

#14555: GHC Panic with TypeInType / levity polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 Keywords: | Operating System: Unknown/Multiple LevityPolymorphism, TypeInType | Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{#!hs {-# Language TypeInType #-} {-# Language TypeOperators, DataKinds, PolyKinds #-} import Data.Kind import GHC.Types (TYPE) data Exp :: [TYPE rep] -> TYPE rep -> Type where Lam :: Exp (a:xs) b -> Exp xs (a -> b) }}} gives {{{ $ ghci -ignore-dot-ghci hs/126-bug.hs GHCi, version 8.3.20171122: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( hs/126-bug.hs, interpreted ) ghc-stage2: panic! (the 'impossible' happened) (GHC version 8.3.20171122 for x86_64-unknown-linux): zonkTcTyVarToVar 'LiftedRep Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/utils/Outputable.hs:1147:37 in ghc:Outputable pprPanic, called at compiler/typecheck/TcType.hs:1640:17 in ghc:TcType Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} caused by `TypeInType`. Removing the first line, we get an error {{{ GHCi, version 8.3.20171122: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( hs/126-bug.hs, interpreted ) hs/126-bug.hs:7:19: error: • Expected kind ‘GHC.Types.RuntimeRep’, but ‘rep’ has kind ‘*’ • In the first argument of ‘TYPE’, namely ‘rep’ In the kind ‘[TYPE rep] -> TYPE rep -> Type’ | 7 | data Exp :: [TYPE rep] -> TYPE rep -> Type where | ^^^ hs/126-bug.hs:7:32: error: • Expected kind ‘GHC.Types.RuntimeRep’, but ‘rep’ has kind ‘*’ • In the first argument of ‘TYPE’, namely ‘rep’ In the kind ‘[TYPE rep] -> TYPE rep -> Type’ | 7 | data Exp :: [TYPE rep] -> TYPE rep -> Type where | ^^^ Failed, no modules loaded. Prelude> }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14555 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14555: GHC Panic with TypeInType / levity polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: | Keywords: | LevityPolymorphism, TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Iceland_jack): Simpler example {{{#!hs data Exp :: TYPE rep -> Type where Lam :: Exp (a -> b) }}} can be fixed by explicitly quantifying over `rep` {{{#!hs data Exp :: forall rep. TYPE rep -> Type where -- ... -- data Exp :: forall (rep::RuntimeRep). TYPE rep -> Type where -- ... }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14555#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14555: GHC Panic with TypeInType / levity polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: | Keywords: | LevityPolymorphism, TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14563 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Iceland_jack): * related: => #14563 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14555#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14555: GHC Panic with TypeInType / levity polymorphism
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.3
Resolution: | Keywords:
| LevityPolymorphism, TypeInType
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #14563 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#14555: GHC Panic with TypeInType / levity polymorphism -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: fixed | Keywords: | LevityPolymorphism, TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | polykinds/T14555 Blocked By: | Blocking: Related Tickets: #14563 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * testcase: => polykinds/T14555 * status: new => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14555#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC