Skip to content

ghc master requires -XTypeInType where 8.2.1 does not

This was found while building https://hackage.haskell.org/package/foundation with ghc head.

The following code is reduced from Basement.Primitive.Error:

{-# LANGUAGE MagicHash, PolyKinds, RankNTypes #-}
module FoundationRegression where

import           GHC.Prim
import           GHC.Types (RuntimeRep)

error :: forall (r :: RuntimeRep) . forall (a :: TYPE r) . String -> a
error s = raise# undefined

This compiles works with 8.2.1, but fails on master:

$ /opt/ghc/8.2.1/bin/ghc -c FoundationRegression.hs 
$ /opt/ghc/head/bin/ghc -c FoundationRegression.hs 

FoundationRegression.hs:7:17: error:
    Variable ‘r’ used as both a kind and a type
    Did you intend to use TypeInType?
  |
7 | error :: forall (r :: RuntimeRep) . forall (a :: TYPE r) . String -> a
  |                 ^^^^^^^^^^^^^^^^^

After adding a TypeInType language pragma the program is accepted.

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