Skip to content

Panic with TypeFamilies with type synonym instances

The code below brings GHC to panic.

{-# LANGUAGE TypeFamilies, FlexibleInstances #-}

module Bug where

type Node v = Int

class Predicate a where
   type Var a
   variable :: Var a -> a

instance Predicate (Node v) where
   type Var (Node v) = v
   variable = undefined

Panic details:

ghc: panic! (the 'impossible' happened)
  (GHC version 7.4.2 for i386-unknown-mingw32):
	tcTyVarDetails
    ( v{tv aa3} [tv] :: ghc-prim:GHC.Prim.*{(w) tc 34d} )

Can be reproduced on GHC versions 7.4.2 and 7.6.1.

Possibly, a duplicate of http://hackage.haskell.org/trac/ghc/ticket/7458, but difficult to tell without additional info on the latter.

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