[GHC] #15709: GHC panic using TypeInType with minimal source code

#15709: GHC panic using TypeInType with minimal source code -------------------------------------+------------------------------------- Reporter: jnape | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.3 Keywords: TypeInType | Operating System: Linux Architecture: x86_64 | Type of failure: Compile-time (amd64) | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following source code causes GHC 8.4.3 on 64bit Linux to panic: {{{#!haskell {-# LANGUAGE TypeInType #-} module Lib where import Data.Kind class Contravariant f where contramap :: (a -> b) -> f b -> f a dimap :: (Contravariant (p :: * -> b -> p * b), Functor (p a)) => (z -> a) -> (b -> c) -> p a b -> p z c dimap f g = contramap f . fmap g }}} I have no idea if it should compile or not, but it shouldn't do this: {{{ ghc: panic! (the 'impossible' happened) (GHC version 8.4.3 for x86_64-unknown-linux): piResultTy k_a34u[tau:1] * Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable pprPanic, called at compiler/types/Type.hs:947:35 in ghc:Type Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15709 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15709: GHC panic using TypeInType with minimal source code -------------------------------------+------------------------------------- Reporter: jnape | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.4.3 Resolution: duplicate | Keywords: TypeInType Operating System: Linux | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * resolution: => duplicate Comment: Happily, I think this is probably fixed. (Search for the many tickets with `piResultTy` in them. GHC 8.6 fails with {{{ T15709.hs:10:25: error: • Expecting one more argument to ‘(p :: * -> b -> p * b)’ Expected kind ‘* -> *’, but ‘(p :: * -> b -> p * b)’ has kind ‘* -> b -> p * b’ • In the first argument of ‘Contravariant’, namely ‘(p :: * -> b -> p * b)’ In the type signature: dimap :: (Contravariant (p :: * -> b -> p * b), Functor (p a)) => (z -> a) -> (b -> c) -> p a b -> p z c | 10 | dimap :: (Contravariant (p :: * -> b -> p * b), Functor (p a)) => (z -> a) -> (b -> c) -> p a b -> p z c | ^^^^^^^^^^^^^^^^^^^^^^ T15709.hs:10:26: error: • Expected kind ‘* -> b -> p * b’, but ‘p’ has kind ‘* -> * -> *’ • In the first argument of ‘Contravariant’, namely ‘(p :: * -> b -> p * b)’ In the type signature: dimap :: (Contravariant (p :: * -> b -> p * b), Functor (p a)) => (z -> a) -> (b -> c) -> p a b -> p z c | 10 | dimap :: (Contravariant (p :: * -> b -> p * b), Functor (p a)) => (z -> a) -> (b -> c) -> p a b -> p z c | ^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15709#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15709: GHC panic using TypeInType with minimal source code -------------------------------------+------------------------------------- Reporter: jnape | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.4.3 Resolution: duplicate | Keywords: TypeInType Operating System: Linux | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by jnape): Wonderful! Sorry for the duplicate. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15709#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC