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

GHC ghc-devs at haskell.org
Tue Mar 10 14:25:59 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:
-------------------------------------+-------------------------------------

Comment (by simonpj):

 It's amazing how easily I can be confused by this stuff!

 To the question of why restricting foralls to have result of kind `*`,
 maybe I can attempt to answer my own question, thus: in what context could
 you could use such a type?  Obviously not in a type signature, since that
 must have kind `*`.  Where else?  Would it make sense to say `T (forall a.
 Either a)`?  But if `T` expected an arg of kind `* -> *`, does it make
 sense to instantiate it with `(forall a. Either a)`?  Does the type
 `(forall a. Either a) Int` make sense?  Maybe not.

 Re unboxed tuples, maybe you are right. Perhaps it only matters in very
 special cases like `forall a. (# a, a #)` which may not be very important.

 In short, maybe we should explore
  * `forall` always has kind `*`
  * Kind-generalise the RHS of type synonyms, so we get the kind in
 comment:4

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


More information about the ghc-tickets mailing list