[GHC] #9123: Need for higher kinded roles

GHC ghc-devs at haskell.org
Mon May 21 13:24:43 UTC 2018


#9123: Need for higher kinded roles
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  goldfire
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.8.2
  checker)                           |             Keywords:  Roles,
      Resolution:                    |  QuantifiedConstraints
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 I don't see how you can use the implication given the way you've
 described. (Look at your "use given:" line. How is it working?)

 Indeed, I think the program, as written, should be rejected. Role
 inference correctly deems the final index to `StateT` to have a nominal
 role, as it appears as an argument to a type variable. Therefore, I think
 the solver is doing the right thing.

 On the other hand, what happens if you defined `StateT` to be a newtype?
 If `StateT` were a newtype, then the solver could (plausibly) unwrap the
 newtype, and then the given would apply. I don't know if the solver does
 this -- it's quite conceivable that changing `StateT` to newtype won't
 change the behavior, but then at least we'd have a possible way out.

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


More information about the ghc-tickets mailing list