[GHC] #9123: Need for higher kinded roles

GHC ghc-devs at haskell.org
Wed May 21 14:24:23 UTC 2014


#9123: Need for higher kinded roles
-------------------------------------+------------------------------------
        Reporter:  simonpj           |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.8.2
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by goldfire):

 I agree with everything Simon said.

 About hand-written instances of `Representational`: We need some facility
 for this. For example, take `ReaderT`:

 {{{
 newtype ReaderT r m a = ReaderT (r -> m a)
 }}}

 `ReaderT` gets roles R, R, N. But, this instance is sensible:

 {{{
 instance Representational m => Representational (ReaderT r m)
 }}}

 I suppose it wouldn't be beyond possibility to beef up the role inference
 algorithm to spit out such `Representational` instances. Or, we could
 require that users request such instances (with a standalone `deriving`
 perhaps) but fill in the details automatically.

 If we do allow users to write their own instances, we seem to lose the
 guarantee that `coerce` is free at runtime, no?

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


More information about the ghc-tickets mailing list