[GHC] #10059: :i doesn't work for ~

GHC ghc-devs at haskell.org
Fri Jun 1 12:08:34 UTC 2018


#10059: :i doesn't work for ~
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  GHCi              |              Version:  7.11
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #10056, #12023    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 After some digging, it turns out that the reason this doesn't work is
 because the `identifier` parser production doesn't catch `(~)`. It turns
 out that this patch:

 {{{#!diff
 diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
 index c6face8..06a5722 100644
 --- a/compiler/parser/Parser.y
 +++ b/compiler/parser/Parser.y
 @@ -629,6 +629,8 @@ identifier :: { Located RdrName }
          | qconop                        { $1 }
      | '(' '->' ')'      {% ams (sLL $1 $> $ getRdrName funTyCon)
                                 [mj AnnOpenP $1,mu AnnRarrow $2,mj
 AnnCloseP $3] }
 +    | '(' '~' ')'       {% ams (sLL $1 $> $ eqTyCon_RDR)
 +                               [mop $1,mj AnnTilde $2,mcp $3] }

 -----------------------------------------------------------------------------
  -- Backpack stuff
 }}}

 Is enough to make `:info (~)` go through:

 {{{
 λ> :info (~)
 class (a ~ b) => (~) (a :: k) (b :: k)
         -- Defined in ‘Data.Type.Equality’
 instance [incoherent] forall k (a :: k) (b :: k). (a ~ b) => a ~ b
   -- Defined in ‘Data.Type.Equality’
 }}}

 (The pretty-printing of the class definition of `(~)` is gnarly,
 though—I'm still figuring out how to work around that.)

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


More information about the ghc-tickets mailing list