[GHC] #14246: Probably AllowAmbiguousTypes + UndecidableInstances + TypeInType
GHC
ghc-devs at haskell.org
Sat May 26 15:56:08 UTC 2018
#14246: Probably AllowAmbiguousTypes + UndecidableInstances + TypeInType
-------------------------------------+-------------------------------------
Reporter: Toricon | Owner: (none)
Type: bug | Status: infoneeded
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: x86_64
Type of failure: Compile-time | (amd64)
crash or panic | Test Case:
Blocked By: | Blocking:
Related Tickets: #13271 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
I was able to reverse engineer this. Here is a program which panics on GHC
8.0.2:
{{{#!hs
{-# LANGUAGE RankNTypes, GADTs, TypeOperators, PolyKinds, DataKinds,
TypeFamilies, AllowAmbiguousTypes, UndecidableInstances, TypeInType #-}
module MCS.Function where
-- import MCS.Core
--import MCS.Value
import Data.Kind -- necessary for *
data Nat = Z | S Nat
data Vect :: Nat -> Type -> Type where
Nil :: Vect Z a
Cons :: a -> Vect n a -> Vect (S n) a
data Label a = Label a
data L
type family KLN (n :: k) :: Nat where
KLN (f :: v -> k) = S (KLN (forall t. f t))
KLN (f :: *) = Z
type family Reveal (n :: k) (l :: Vect (KLN n) L) :: * where
Reveal (f :: v -> k) (Cons (Label (t :: v)) l) = Reveal (f t) l
Reveal (a :: *) Nil = a
}}}
{{{
$ /opt/ghc/8.0.2/bin/ghc Bug.hs
[1 of 1] Compiling MCS.Function ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
isInjectiveTyCon sees a TcTyCon KLN
}}}
However, this does //not// panic on GHC 8.2.2 and later, so I believe that
this has a symptom in common with #13271. It's different enough that it
warrants its own test case, I believe, so I'll commit that shortly.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14246#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list