Representation polymorphism validity check is too strict
As of 465c6c5d GHC rejects this program,
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE RankNTypes #-}
module Hi where
import GHC.Exts
data TypeRep (a :: k) where
TrFun :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (a :: TYPE r1) (b :: TYPE r2).
TypeRep a
-> TypeRep b
-> TypeRep (a -> b)
Claiming that it has inappropriate polymorphism over RuntimeRep,
$ ghc hi2.hs
[1 of 1] Compiling Hi ( hi2.hs, hi2.o )
hi2.hs:7:5: error:
• A representation-polymorphic type is not allowed here:
Type: a
Kind: TYPE r1
• In the definition of data constructor ‘TrFun’
In the data type declaration for ‘TypeRep’
I suspect this check is unnecessarily strict since we never need to store a value of type a to represent TypeRep a at runtime.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |