[GHC] #9123: Need for higher kinded roles

GHC ghc-devs at haskell.org
Mon Jun 2 18:36:46 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):

 `instance Rep f => Rep (Compose f)` where `newtype Compose f g a = Compose
 (f (g a))`:

 We wish to show `forall a. Coercible (m (f a)) (m (g a))` from `Rep m` and
 `Coercible f g`. Fix `a`.
 1. Use rule (*) to get `Coercible (f a) (g a)`.
 2. Use #9117's eta to get `Coercible f g`. We're done.

 `instance Rep p => Rep (WrappedArrow p)` where `newtype WrappedArrow a b c
 = WrappedArrow (a b c)`:

 We wish to show `forall a. Coercible (p x a) (p y a)` from `Rep p` and
 `Coercible x y`. Fix `a`.
 1. Use #9117's eta to get `Coercible (p x) (p y)`.
 2. Use rule (*), and we're done.

 `instance Rep (p a) => Rep (WrappedArrow p a)`:

 We wish to show `Coercible (p a x) (p a y)` from `Rep (p a)` and
 `Coercible x y`.
 1. Use rule (*), and we're done.

 --------------------------

 Unfortunately, I can't counter the point about `StateT` -- we still can't
 express that `s` should be representational if `m`'s argument is. But,
 what about this:

 {{{
 newtype Flip0 f a b = Flip0 (f b a)   -- not used; just to better
 understand Flip1
 newtype Flip1 f a b c = Flip1 (f b a c)

 instance Rep m => Rep (Flip1 StateT m)
 }}}

 Would that work for you?

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


More information about the ghc-tickets mailing list