Skip to content

Problems getting information and kind from GHC.Prim ~#, ~R#, ...

>>> import GHC.Prim
>>> :bro GHC.Prim
  [...]
type role (~#) nominal nominal
data (~#) (t3 :: a) (t4 :: b)
type role ~P# phantom phantom
data ~P# (t3 :: a) (t4 :: b)
type role (~R#) representational representational
data (~R#) (t3 :: a) (t4 :: b)

getting the kind of ~, ~#, ~~ works fine:

>>> import GHC.Prim
>>> import GHC.Types

>>> :kind (~)
(~) :: k -> k -> Constraint
>>> :kind (~#)
(~#) :: a -> b -> TYPE 'VoidRep
>>> :kind (~~)
(~~) :: j -> k -> Constraint

but # gets incorrectly treated as an operator in ~R# and ~P#:

>>> :kind (~R#)

<interactive>:1:3: error:
    Illegal operator ‘#’ in type ‘~R #’
      Use TypeOperators to allow operators in types

<interactive>:1:3: error:
    Operator applied to too few arguments: ~R #

<interactive>:1:4: error:
    Not in scope: type constructor or class ‘R’

Furthermore while running :info on ~~ and ~# works fine

>>> :info (~~)
class a ~# b => (~~) (a :: j) (b :: k)  -- Defined in ‘GHC.Types’

>>> :info (~#)
type role (~#) nominal nominal
data (~#) (t3 :: a) (t4 :: b)
        -- Defined in ‘GHC.Prim’

the others don't parse

>>> :info (~)

<interactive>:1:2: error: parse error on input ‘~’
>>> :info (~R#)

<interactive>:1:2: error: parse error on input ‘~’
>>> :info (~P#)

<interactive>:1:2: error: parse error on input ‘~’
Trac metadata
Trac field Value
Version 7.10.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
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