[GHC] #9792: map/coerce rule never seems to fire

GHC ghc-devs at haskell.org
Tue Nov 11 02:37:12 UTC 2014


#9792: map/coerce rule never seems to fire
-------------------------------------+-------------------------------------
       Reporter:  dfeuer             |                   Owner:  ekmett
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:  7.10.1
      Component:  Core Libraries     |                 Version:  7.9
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:  Runtime
     Blocked By:                     |  performance bug
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 If I write a nice, simple use, like:

 {{{#!hs
 myPotato = map coerce
 }}}

 or even

 {{{#!hs
 myPotato = Data.OldList.map coerce
 }}}

 the "`map/coerce`" rule does not fire.

 It looks like there are two things getting in the way:

 1. The `map` rule fires first, turning `map` into a `build/foldr` form,
 which `map/coerce` does not recognize.

 2. Even if `map` gets written back, `coerce` has been expanded into
 something the rule doesn't recognize.

 So we end up with something that looks like

 {{{#!hs
 myPotato =
   \ (@ a_are)
     (@ b_arf)
     ($dCoercible_arz :: Coercible a_are b_arf)
     (lst_aqx :: [a_are]) ->
     map
       @ a_are
       @ b_arf
       (\ (tpl_B2 [OS=ProbOneShot] :: a_are) ->
          case $dCoercible_arz
          of _ [Occ=Dead] { GHC.Types.MkCoercible tpl1_B3 ->
          tpl_B2 `cast` (tpl1_B3 :: a_are ~R# b_arf)
          })
       lst_aqx
 }}}

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


More information about the ghc-tickets mailing list