Skip to content

GHC panic when resolving Show instance

I'm playing around with rolling my own type defaulting and found a panic. Note: adding a stub Show (W a) instance resolves this (i.e. show _ = "test").

{- Test.hs -}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}

module Test where

import Data.Proxy

data W (a :: k) = Wk | W (MkStar a)

type family MkStar (a :: k) :: *

main = print (W Proxy :: W (Proxy (~)))
$ ghc Test.hs -o test 
[1 of 1] Compiling Test             ( Test.hs, Test.o )

Test.hs:13:8: error:ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.1 for x86_64-apple-darwin):
	print_equality ~

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

If x = W Proxy :: W (Proxy (~)) is only defined, there is no issue. It seems to occur exactly when resolving a Show instance for W (Proxy (~)) and one does not exist.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information