
#11471: Note [The kind invariant] in TyCoRep needs to be updated -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.10.3 checker) | Resolution: | Keywords: 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 simonpj): I wrote this code to try to get a seg-fault or something: {{{ import GHC.Exts import Data.Proxy type family F a :: k type instance F Int = Int# f :: Proxy a -> F a -> F a f _ x = x bad = f (undefined :: Proxy Int#) 3# }}} But instead I got some truly bizarre error messages {{{ Foo.hs:15:10: error: • Expected kind ‘Proxy Int#’, but ‘undefined :: Proxy Int#’ has kind ‘Proxy Int#’ • In the first argument of ‘f’, namely ‘(undefined :: Proxy Int#)’ In the expression: f (undefined :: Proxy Int#) 3# In an equation for ‘bad’: bad = f (undefined :: Proxy Int#) 3# Foo.hs:15:35: error: • Couldn't match a lifted type with an unlifted type When matching types F Int# :: * Int# :: # • In the second argument of ‘f’, namely ‘3#’ In the expression: f (undefined :: Proxy Int#) 3# In an equation for ‘bad’: bad = f (undefined :: Proxy Int#) 3# }}} We get a bit more of a clue with `-fprint-explicit-kinds` {{{ Foo.hs:15:10: error: • Expected kind ‘Proxy * Int#’, but ‘undefined :: Proxy Int#’ has kind ‘Proxy # Int#’ • In the first argument of ‘f’, namely ‘(undefined :: Proxy Int#)’ In the expression: f (undefined :: Proxy Int#) 3# In an equation for ‘bad’: bad = f (undefined :: Proxy Int#) 3# Foo.hs:15:35: error: • Couldn't match a lifted type with an unlifted type When matching types F * Int# :: * Int# :: # • In the second argument of ‘f’, namely ‘3#’ In the expression: f (undefined :: Proxy Int#) 3# In an equation for ‘bad’: bad = f (undefined :: Proxy Int#) 3# }}} but clearly life is not good here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11471#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler