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

GHC ghc-devs at haskell.org
Thu Oct 11 07:41:21 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 int-index):

 Replying to [comment:14 goldfire]:
 > These two declarations have quite different meanings:
 >
 > {{{#!hs
 > type family F1 :: k -> Type
 > type family F2 :: forall k. k -> Type
 > }}}
 >

 This statement doesn't sit well with me. I expect to be able to introduce
 any type variable explicitly, and `F1` with an explicit `forall` for `k`
 turns out to be `F2`. These declarations ''must'' have the same meaning.

 Let's compare to term-level functions:

 {{{#!hs
 f :: k -> Type
 f :: forall k. k -> Type
 }}}

 These types are the same (modulo specificity of `k`)!

 > `F1` takes one argument, `k`. `F2`, on the other hand, takes no
 arguments. `F1` can match on `k`, returning constructors of different
 kinds in different instances. On the other hand, `F2` must return a
 polykinded constructor, and can have only one instance.

 So you mean that we treat `F1` as having kind `pi k. k -> Type`, while
 `F2` has kind `forall k. k -> Type`: `F1` can match on its parameter `k`
 and `F2` cannot. Why? I thought we always treat `forall` as `pi` in kinds,
 at least for now.

 Therefore, I agree with Ryan's expectations in comment:13.

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


More information about the ghc-tickets mailing list