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

GHC ghc-devs at haskell.org
Tue Nov 11 09:17:58 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        |          Version:  7.9
  Libraries                          |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:  Runtime     |  Related Tickets:
  performance bug                    |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by nomeata):

 We have a test case for this, T2110. I wonder why you observe something
 different.

 My guess: Your code is polymorphic in the member of the list, and hence
 the code looks different and is no longer matched.

 Now if GHC would float out the `case $dCoercible_arz of`, it would
 probably work. But of course it cannot, or we’d be stricter in the
 `Coercible` constraint than intended.

 Ah: And in the polymorphic case, `map coerce = coerce` does not even hold!
 If the `Coercible` evidence is ⊥, then `map coerce [] = []`, but `coerce
 [] = ⊥`.

 Given that high performance code is rarely polymorphic, I think we are
 fine.

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


More information about the ghc-tickets mailing list