Skip to content

Runtime representation confusingly displayed

  1. 3.20170605:
> :set -XRankNTypes -XTypeInType 
> import GHC.Exts (TYPE, RuntimeRep(LiftedRep))
> type Pair (a::TYPE rep) (b::TYPE rep') rep'' = forall (r::TYPE rep''). (a -> b -> r) -> r
> :kind Pair
Pair :: * -> * -> *
> :kind Pair Int
Pair Int :: * -> *
> :kind Pair Int Float
Pair Int Float :: *
> :kind Pair Int Float LiftedRep
Pair Int Float LiftedRep :: *

It still behaves oddly with -fprint-explicit-runtime-reps enabled

> :set -fprint-explicit-runtime-reps 
> :kind Pair
Pair :: * -> * -> forall (rep'' :: RuntimeRep) -> *
> :kind Pair Int
Pair Int :: * -> forall (rep'' :: RuntimeRep) -> *
> :kind Pair Int Float
Pair Int Float :: *
> :kind Pair Int Float LiftedRep 
Pair Int Float LiftedRep :: *

I would have also expected to see Pair's kind displayed something like this

forall {rep :: RuntimeRep} {rep' :: RuntimeRep}. TYPE rep -> TYPE rep' -> forall (rep'' :: RuntimeRep) -> *

which is how the kind of the corresponding newtype gets displayed

> newtype Pair2 (a::TYPE rep) (b::TYPE rep') rep'' = P2 (forall (r::TYPE rep''). (a -> b -> r) -> r)
> :kind Pair2
Pair2 :: forall {rep :: RuntimeRep} {rep' :: RuntimeRep}.
         TYPE rep -> TYPE rep' -> forall (rep'' :: RuntimeRep) -> *
Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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