[GHC] #7696: Another kindFunResult panic

GHC cvs-ghc at haskell.org
Mon Mar 4 00:17:15 CET 2013


#7696: Another kindFunResult panic
-----------------------------+----------------------------------------------
Reporter:  nwf               |          Owner:                  
    Type:  bug               |         Status:  new             
Priority:  normal            |      Component:  Compiler        
 Version:  7.6.2             |       Keywords:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
 Failure:  None/Unknown      |      Blockedby:                  
Blocking:                    |        Related:                  
-----------------------------+----------------------------------------------

Comment(by simonpj@…):

 commit c969cc3d2cfcd31fc8e7222c7c9ec116191c136b
 {{{
 Author: Simon Peyton Jones <simonpj at microsoft.com>
 Date:   Sun Mar 3 23:04:09 2013 +0000

     Treat equalities with incompatible kinds as "irreducible" constraints

     Originally we had the invariant that CTyEqCan and CFunEqCan have LHS
     and RHS with compatible kinds.  This is important because if they have
     different kinds, then a substitution using the CTyEqCan can give rise
     to an ill-kinded type, which in turn makes typeKind crash, and this
     led to Trac #7696.  (The possibility of this happening really only
     occurred when we introduced kind polymorphism.)

     I thought at first this was going to be really awkward to solve, but
     happily it turned out to be easy.  We already have CIrredEvCan
     constraints, which are "stuck"; we can't use them and we can't solve
     them.  Yet. After some substitution from solving other constraints we
     may be able to make progress.

     So for equality constraints where the LHS and RHS don't have
 compatible kinds
     (although perhaps not YET compatible, eg k and *, just needing to
     unify k := *), we now generate a CIrredEvCan, plus the necessary kind
     equality constraint.

     This entailed some refactoring of course, but only in TcCanonical.  In
     particular, the emitKindConstraint code has gone, in favour of a kind
     check in canEqLeaf.  See Note [Equalities with incompatible kinds] in
     TcCanonical, and Note [CIrredEvCan constraints] in TcRnTypes

  compiler/typecheck/TcCanonical.lhs |  150
 +++++++++++++++++++-----------------
  compiler/typecheck/TcRnTypes.lhs   |   33 ++++++--
  2 files changed, 102 insertions(+), 81 deletions(-)
 }}}

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



More information about the ghc-tickets mailing list