[GHC] #15192: Refactor of Coercion

GHC ghc-devs at haskell.org
Tue Jul 10 01:38:53 UTC 2018


#15192: Refactor of Coercion
-------------------------------------+-------------------------------------
        Reporter:  ningning          |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4747
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Richard Eisenberg <rae@…>):

 In [changeset:"55a3f8552c9dc9b84e204ec6623c698912795347/ghc" 55a3f85/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="55a3f8552c9dc9b84e204ec6623c698912795347"
 Refactor coercion rule

 Summary:
 The patch is an attempt on #15192.

 It defines a new coercion rule

 ```
  | GRefl Role Type MCoercion
 ```

 which correspondes to the typing rule

 ```
      t1 : k1
   ------------------------------------
   GRefl r t1 MRefl: t1 ~r t1

      t1 : k1       co :: k1 ~ k2
   ------------------------------------
   GRefl r t1 (MCo co) : t1 ~r t1 |> co
 ```

 MCoercion wraps a coercion, which might be reflexive (MRefl)
 or not (MCo co). To know more about MCoercion see #14975.

 We keep Refl ty as a special case for nominal reflexive coercions,
 naemly, Refl ty :: ty ~n ty.

 This commit is meant to be a general performance improvement,
 but there are a few regressions. See #15192, comment:13 for
 more information.

 Test Plan: ./validate

 Reviewers: bgamari, goldfire, simonpj

 Subscribers: rwbarton, thomie, carter

 GHC Trac Issues: #15192

 Differential Revision: https://phabricator.haskell.org/D4747
 }}}

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


More information about the ghc-tickets mailing list