
#13140: Handle subtyping relation for roles in Backpack -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: patch Priority: normal | Milestone: 8.4.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 ezyang): Here's another way to think about app-roles and proj-roles. Previously, we thought of roles as a single thing you ascribe to a type parameter. But it would be more accurate to say that a type parameter is given a role ''range'', which specifies the possible set of underlying roles that the type may be implemented with. For example, the range "phantom to nominal" says that the type could be implemented in a way that treats the type variable phantom, representationally, or nominally: this is the most flexible for the implementor and gives the least information to the client. Or you can say that it is "exactly" nominal: this gives the most information to the client. `type role T nominal; newtype T a = MkT a` gets "representational to nominal": the annotation sets the upper bound, but the lower bound has to actually include the true role which a is used at. Of course, when I say lower bound, I mean proj-role, and when I say upper- bound, I mean app role. (I also apologize for flipping the subroling order.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13140#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler