[commit: ghc] master: Treat equalities with incompatible kinds as "irreducible" constraints (c969cc3)
Simon Peyton Jones
simonpj at microsoft.com
Mon Mar 4 00:17:06 CET 2013
Repository : http://darcs.haskell.org/ghc.git/
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/c969cc3d2cfcd31fc8e7222c7c9ec116191c136b
>---------------------------------------------------------------
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(-)
Diff suppressed because of size. To see it, use:
git show c969cc3d2cfcd31fc8e7222c7c9ec116191c136b
More information about the ghc-commits
mailing list