[GHC] #13140: Handle subtyping relation for roles in Backpack

GHC ghc-devs at haskell.org
Sat Feb 11 01:00:24 UTC 2017


#13140: Handle subtyping relation for roles in Backpack
-------------------------------------+-------------------------------------
        Reporter:  ezyang            |                Owner:  ezyang
            Type:  feature request   |               Status:  patch
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.1
  checker)                           |             Keywords:  backpack hs-
      Resolution:                    |  boot
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3123
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Sorry for not piping up sooner, but this change would be unsound. Consider
 this accepted program:

 {{{
 data T a
 type role T nominal

 foo :: Coercible (T a) (T b) => a -> b
 foo x = x
 }}}

 You can see that, if `T` were abstract, instantiating `T` with a concrete
 datatype that had a phantom role would be Wrong. While there is a sub-
 roling relationship, it does not induce a sub-typing relationship like the
 one you seek.

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


More information about the ghc-tickets mailing list