[GHC] #8958: Allow role inference on datatype contexts

GHC ghc-devs at haskell.org
Tue Apr 8 03:40:43 UTC 2014


#8958: Allow role inference on datatype contexts
-----------------------------------------------+---------------------------
        Reporter:  goldfire                    |            Owner:
            Type:  feature request             |  goldfire
        Priority:  normal                      |           Status:  closed
       Component:  Compiler                    |        Milestone:  7.8.1
      Resolution:  fixed                       |          Version:
Operating System:  Unknown/Multiple            |  7.8.1-rc2
 Type of failure:  None/Unknown                |         Keywords:
       Test Case:  roles/should_compile/T8958  |     Architecture:
        Blocking:                              |  Unknown/Multiple
                                               |       Difficulty:  Unknown
                                               |       Blocked By:
                                               |  Related Tickets:
-----------------------------------------------+---------------------------
Changes (by goldfire):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 The code in the original post is indeed a grievous hack, but the change in
 GHC in order to support it is not. Indeed, when Mark first suggested this
 approach, I thought it was too unprincipled to incorporate. However, the
 only change needed within GHC to support the idea in the original post is
 that role inference must look at datatype contexts. This is sensible, all
 on its own. In fact, the user manual, as originally written for role
 inference, needs no change: it states that role inference propagates role
 information from every place a type is used, which naturally includes a
 datatype context.

 Now with this support in GHC, the grievous hack in my original post can be
 built in user-land. I have released it as a package `no-role-annots`. I
 don't really like it, but it seems to cause no harm and some might find it
 useful.

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


More information about the ghc-tickets mailing list