[GHC] #13140: Handle subtyping relation for roles in Backpack
GHC
ghc-devs at haskell.org
Mon Feb 13 15:19:47 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):
If, from your perspective, the added complexity is worth it, then this
looks OK to me.
What's frustrating here is that we don't really need a new `Abstract`
equality relation: the current `Phantom` one works fine. All we need is a
new role ''annotation''. Is it worth creating a new `data RoleAnnotation =
Abstract | Concrete Role`? Perhaps. You would also then need to be careful
about uses of `tyConRoles` and `tyConRolesX`, as they are currently used
both for construction and decomposition -- up until this proposal, both
directions were happy with the same roles.
I do agree that your approach is type safe. But I have to wonder if there
isn't a simpler solution somehow, as I'm hesitant to advocate yet another
wrinkle to the role system.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13140#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list