[GHC] #11719: Cannot use higher-rank kinds with type families

GHC ghc-devs at haskell.org
Thu Oct 11 21:11:15 UTC 2018


#11719: Cannot use higher-rank kinds with type families
-------------------------------------+-------------------------------------
        Reporter:  ocharles          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.8.1
       Component:  Compiler (Type    |              Version:  8.0.1-rc2
  checker)                           |
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  GHC rejects       |            Test Case:
  valid program                      |  dependent/should_compile/T11719
      Blocked By:                    |             Blocking:
 Related Tickets:  #13913            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 The difference with terms is that the arity of type families matters. `F1`
 has arity 1, while `F2` has arity 0. The real question is: where is the
 `k` bound. In `F1`, `k` is bound "before the colon", while in `F2`, it's
 bound after the colon.

 In terms of [https://github.com/goldfirere/ghc-
 proposals/blob/pi/proposals/0000-pi.rst#the-quantifier-table this syntax]:

 {{{
 F1 :: foreach k  . k -> Type
 F2 :: foreach k '. k -> Type
 }}}

 Both are really `foreach`-kinds, like @int-index observed. The difference
 is that `F1`'s argument is not matchable. (Perversely, type families can
 pattern-match only on unmatchable arguments. Perhaps a name change is in
 order.) On the other hand, `F2`'s argument is matchable, as it's declared
 to be so. (Recall that every abstraction in a kind is currently
 interpreted as matchable, even though the future syntax for matchable
 kinds will change.)

 Accepting the program in comment:15 seems like an egregious bug, to me.
 I've reported it as #15740.

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


More information about the ghc-tickets mailing list