[GHC] #13913: Can't apply higher-ranked kind in type family

GHC ghc-devs at haskell.org
Tue Oct 23 13:48:30 UTC 2018


#13913: Can't apply higher-ranked kind in type family
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |
      Resolution:  duplicate         |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11719            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 I've found a workaround for this issue after much persistence. The trick
 is to associate `F2` with a type class:

 {{{#!hs
 class C (g :: forall a. a -> a) where
   type F2 g :: Bool
 }}}

 Then, define a flexible instance like so, using an explicit `forall` to
 give `g` the appropriate higher-rank kind:

 {{{#!hs
 instance forall (g :: forall a. a -> a). C g where
   type F2 g = g True
 }}}

 That's it!

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


More information about the ghc-tickets mailing list