
#15428: GHC 8.6+ panics (piResultTys2), older GHCs don't -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Keywords: TypeInType, | Operating System: Unknown/Multiple TypeFamilies | Architecture: | Type of failure: Compile-time Unknown/Multiple | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following program panics when compiled with GHC 8.6.1 or HEAD: {{{#!hs {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeInType #-} {-# LANGUAGE TypeOperators #-} module Bug where import Data.Kind import Data.Proxy import Data.Type.Equality type family Flurmp :: k type family Pure (x :: a) :: f a wat :: forall (f :: Type -> Type) (p :: Type). Proxy (f p) -> () wat _ = let s :: (Flurmp :: f p) :~: Pure (Flurmp :: p -> p) (Flurmp :: p) s = undefined in () }}} {{{ $ /opt/ghc/8.6.1/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.6.0.20180714 for x86_64-unknown-linux): piResultTys2 f_aAT a_aAU [(->) p_a1uI[sk:1], p_a1uI[sk:1] -> p_a1uI[sk:1], Flurmp, Flurmp] [Flurmp] Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable pprPanic, called at compiler/types/Type.hs:1041:9 in ghc:Type }}} On GHC 8.4 and earlier, this simply gives an error message: {{{ $ /opt/ghc/8.4.3/bin/ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) Bug.hs:18:16: error: • Expecting one more argument to ‘Pure (Flurmp :: p -> p)’ Expected kind ‘p -> f p’, but ‘Pure (Flurmp :: p -> p)’ has kind ‘p -> p -> p’ • In the second argument of ‘(:~:)’, namely ‘Pure (Flurmp :: p -> p) (Flurmp :: p)’ In the type signature: s :: (Flurmp :: f p) :~: Pure (Flurmp :: p -> p) (Flurmp :: p) In the expression: let s :: (Flurmp :: f p) :~: Pure (Flurmp :: p -> p) (Flurmp :: p) s = undefined in () • Relevant bindings include wat :: Proxy (f p) -> () (bound at Bug.hs:16:1) | 18 | :~: Pure (Flurmp :: p -> p) (Flurmp :: p) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15428 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler