[GHC] #15791: typeKind confuses Type and Constraint

GHC ghc-devs at haskell.org
Fri Oct 26 14:06:07 UTC 2018


#15791: typeKind confuses Type and Constraint
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Branch:
       Wiki Page:                    |  wip/T15791
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Here are the typing rules, as I see it:

 {{{
 t1 : Constraint
 t2 : TYPE rep    -- rep is a metavariable
 ----------------
 t1 => t2 : Type

 t1 : Constraint
 t2 : Constraint
 ---------------------
 t1 => t2 : Constraint

 ty : TYPE rep
 `a` is not free in rep
 -----------------------
 forall a. ty : TYPE rep

 ty : Constraint
 -------------------------
 forall a. ty : Constraint
 }}}

 The rules might be missing some side conditions for type safety, etc., but
 this should be enough to get `typeKind` working.

 Specifically: because the kind of `a` is `TYPE blah`, then `HasCallStack
 => a` has kind `Type`. Maybe you were thinking that `t1 => t2` has the
 kind of `t2`? That wouldn't work.

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


More information about the ghc-tickets mailing list