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

GHC ghc-devs at haskell.org
Tue Jul 28 11:06:02 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
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 I tried to add this rule to the code of `Data.Map`:
 {{{
 {-# RULES
 "mapKeysMonotonic/coerce" mapKeysMonotonic coerce = coerce
  #-}
 }}}

 but it would not go through:

 {{{#!hs
 libraries/containers/Data/Map/Base.hs:1800:1: warning:
     Forall'd variable ‘$rcobox’ is not bound in RULE lhs
       Orig bndrs: [k2, a, $rcobox]
       Orig lhs: let {
                   cobox_ab8H :: Coercible k2 k2
                   [LclId, Str=DmdType]
                   cobox_ab8H =
                     MkCoercible @ * @ k2 @ k2 @~ (<k2>_R :: k2 ~R# k2) }
 in
                 mapKeysMonotonic @ k2 @ k2 @ a (coerce @ k2 @ k2
 cobox_ab8H)
       optimised lhs: mapKeysMonotonic
                        @ k2
                        @ k2
                        @ a
                        (\ (tpl_B2 :: k2) ->
                           case cobox_ab8H of _ [Occ=Dead] { MkCoercible
 tpl_B3 -> tpl_B2 })
 }}}

 The same syntax works for mapping the second parameter, i.e.
 {{{
 {-# RULES
 "map/coerce" map coerce = coerce
  #-}
 }}}
 (this still `Data.Map`’s `map`).

 This blocks https://github.com/haskell/containers/pull/163

 I’ll see if I can produce a stand-alone testcase.

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


More information about the ghc-tickets mailing list