Skip to content

GHC panics on pattern synonym ‘kindPrimRep’

{-# Language PatternSynonyms, GADTs #-} 

data Ty a where
  B :: Ty Bool

class (Eq a, Ord a, Show a) => GetTy a where 
  getTy :: Ty a

instance GetTy Bool where 
  getTy = B

data Exp a where
  Constant :: GetTy a => Ty a -> a -> Exp a

pattern MkBool :: () => (GetTy t, Bool ~ t) => t -> Exp t
pattern MkBool bool = Constant B bool

pattern Tru :: () => Bool ~ t => Exp t
pattern Tru = MkBool True

with head:

$ ghci -ignore-dot-ghci /tmp/tywM.hs 
GHCi, version 8.1.20160503: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( /tmp/tywM.hs, interpreted )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.1.20160503 for x86_64-unknown-linux):
        kindPrimRep.go rep_a2tC

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

> 
pattern Tru :: () => Bool ~ t => Exp t
pattern Tru = Constant B True

works fine

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