Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#12017 closed bug (duplicate)

GHC panics on pattern synonym ‘kindPrimRep’

Reported by: Iceland_jack Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.1
Keywords: PatternSynonyms Cc: mpickering
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

{-# 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

Change History (3)

comment:1 Changed 10 months ago by Iceland_jack

Simplied

{-# Language PatternSynonyms, GADTs #-} 

data Exp a where
  Constant :: a -> Exp a

pattern MkBool :: Bool -> Exp Bool
pattern MkBool bool = Constant bool

pattern Tru :: Exp Bool
pattern Tru = MkBool True

this breaks my stuff, but it's easy to work around.

comment:2 Changed 10 months ago by simonpj

Resolution: duplicate
Status: newclosed

Always worth searching to see if someone has already reported!

Dup of #12007

comment:3 Changed 10 months ago by Iceland_jack

How embarrassing, I even commented on that ticket so there is no excuse :) thanks Simon

Note: See TracTickets for help on using tickets.