Compile-time stack overflow exception in GHC HEAD only
If I compile the following program in GHC HEAD:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind
import Data.Type.Equality
data F (a :: k) :: (a ~~ k) => Type where
MkF :: F a
Then it simply loops until the stack overflows:
$ ~/Software/ghc5/inplace/bin/ghc-stage2 --interactive Bug.hs
GHCi, version 8.9.0.20190620: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
*** Exception: stack overflow
This isn't strictly a regression since writing equality constraints in kinds (like in the kind of F
) is a featurette that GHC has only really supported properly as of HEAD, although it is worth noting that previous versions of GHC did not exhibit this behavior.