Skip to content

GHC internal error when dodgily binding matchability variable

Please don't ask me why I wrote this code.

{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE UnsaturatedTypeFamilies #-}
module Bug where

import Data.Kind

type T :: forall m -> @m Type
type T x = Int
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:9:24: error:
    • GHC internal error: ‘m’ is not in scope during type checking, but it passed the renamer
      tcl_env of environment: [rgh :-> APromotionErr TyConPE]
    • In a standalone kind signature for ‘T’: forall m -> Type
  |
9 | type T :: forall m -> @m Type
  |                        ^