[GHC] #12023: Problems getting information and kind from GHC.Prim ~#, ~R#, ...

GHC ghc-devs at haskell.org
Sat May 7 00:43:22 UTC 2016


#12023: Problems getting information and kind from GHC.Prim ~#, ~R#, ...
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  GHCi           |           Version:  7.10.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{
 >>> 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 ‘~’
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12023>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list