[GHC] #11735: Optimize coercionKind

GHC ghc-devs at haskell.org
Thu Jan 25 01:35:14 UTC 2018


#11735: Optimize coercionKind
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Thanks for finding `Note [Computing a coercion kind and role]`. I believe
 this note is correct and is as relevant today as it was when I wrote it.
 And, I'm afraid to say that `coercionRole (NthCo ...)` manifestly
 '''does''' require `coercionKind`. See the call in the `where` clause in
 the suggested patch.

 However, perhaps the solution lies in including the role of an `NthCo` in
 the `NthCo`, essentially caching this result. I think this would be easy
 to do, especially as the caller of `mkNthCo` generally has to know what
 role its getting -- `mkNthCo` could take this role as a parameter. Lint
 could check that the supplied role is the same as what would have been
 calculated. With this change to `NthCo`, then `coercionRole` really would
 be independent of `coercionKind` and we could separate the functions.

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


More information about the ghc-tickets mailing list