[GHC] #10114: Kind mismatches with AnyK in rank-2 types

GHC ghc-devs at haskell.org
Tue Mar 10 04:58:17 UTC 2015


#10114: Kind mismatches with AnyK in rank-2 types
-------------------------------------+-------------------------------------
        Reporter:  cam               |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.8.4
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by goldfire):

 * cc: sweirich@… (added)


Comment:

 Replying to [comment:5 simonpj]:
 > So I think I retract my claim in comment:1. Perhaps we do want to
 generalise "inside".
 I agree with your (now retracted) claim.

 If `T = forall k1 k2 (f :: k1 -> k2) (a :: k1). f a`, then I think `T`'s
 type would have to be `k2`, which is nonsense. As I understand it, the
 kind of a forall-type is the kind of the body of the forall-type.

 >
 > Can anyone say why it is "generally more common to restrict the body of
 a forall to have kind `*`"?  I can't articulate a clear argument.

 This claim of mine is direct from Stephanie. Stephanie, do you know why
 this is?

 >
 > In GHC's case, a good reason not to do this was types like  `forall a. a
 -> (# a, a #)`, but levity polymorpism will help here.

 I don't think that's quite what you want to say, because the kind of the
 body of that forall is `*`! Maybe `forall a. (# a, a #)`?

 I don't see how levity polymorphism fixes this problem. Even with levity
 polymorphism, the kind of the body of that last forall is still `#`.

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


More information about the ghc-tickets mailing list