[GHC] #13044: make it possible to apply GHC rewrite rules to class methods

GHC ghc-devs at haskell.org
Wed Jan 4 13:45:48 UTC 2017


#13044: make it possible to apply GHC rewrite rules to class methods
-------------------------------------+-------------------------------------
        Reporter:  George            |                Owner:
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 I don't think there is anything fundamentally difficult here.

 Class methods have a special rewriting rule (see `MkId.dictSelRule`, which
 is not as well documented as it should be).  It rewrites `op dict`, where
 `op` is a class method and `dict` is a dictionary, when possible to the
 type-specialised function.

 All we need to do is to stop that rule firing immediately.  Perhaps it can
 fire in phase 2 (and hence 1 and 0) instead of always. That would give
 other rules a chance to match on it.

 I can't forsee all the consequences, but they should not be too drastic.
 But it would need careful perf testing; failure to optimise overloading
 can kill performance.

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


More information about the ghc-tickets mailing list