Re: [GHC] #10698: Forall'd variable ‘$rcobox’ is not bound in RULE lhs

GHC ghc-devs at haskell.org
Tue Jul 28 13:54:17 UTC 2015


#10698: Forall'd variable ‘$rcobox’ is not bound in RULE lhs
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.11
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by nomeata):

 It can be triggered already with
 {{{
 {-# RULES
 "coerce/id" coerce = id
  #-}
 }}}

 so my hypothesis is that the desugar creates something like
 {{{
       Orig bndrs: [b, $rcobox]
       Orig lhs: let {
                   cobox_acD :: Coercible b b
                   [LclId, Str=DmdType]
                   cobox_acD = MkCoercible @ * @ b @ b @~ $rcobox } in
                 coerce @ b @ b cobox_acD
 }}}
 but since `$rcobox :: b ~_R b`, the coercion simplifier simplifies this to
 {{{
       Orig bndrs: [b, $rcobox]
       Orig lhs: let {
                   cobox_acD :: Coercible b b
                   [LclId, Str=DmdType]
                   cobox_acD = MkCoercible @ * @ b @ b @~ <b>_R } in
                 coerce @ b @ b cobox_acD
 }}}
 and the “Forall'd variable ‘`$rcobox`’“ is is no longer used.

 One possibly sensible fix would be to remove forall’ed variables that are
 also not mentioned on the right hand side (I would assume that to be the
 case here, although I did not check), and do that before the warning is
 triggered.

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


More information about the ghc-tickets mailing list