[commit: ghc] master: Improve the equality-floating story (again), to fix Trac #8644 (9e10d18)
git at git.haskell.org
git at git.haskell.org
Fri Jan 3 16:14:46 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/9e10d1883d7ea5ea422cda79b426f51d2b59b14d/ghc
>---------------------------------------------------------------
commit 9e10d1883d7ea5ea422cda79b426f51d2b59b14d
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Fri Jan 3 16:04:04 2014 +0000
Improve the equality-floating story (again), to fix Trac #8644
We float equalities out of implications whose 'givens' include equalities.
But it's a bit tricky knowing whether some givens do or do not include
equalities, as #8644 shows. There the given has type 'c' (which might
have equalities), but we discover that 'c ~ ()', which definitely doesn't.
In short, we must look at the givens *after* normalisation, not before.
Moreover, something similar happens in approximateWC, where we need
to ask whether an implication has given equalities.
This patch does the job:
* Add a Boolean field inert_no_eqs to InertCans, which records
whether we've added a non-constant equality
* Add a field ic_no_eqs to Implication, which records whether the
ic_given binders include any equalities
* Get rid of Inst.hasEqualities altogether
On the way I did some un-forced refactoring
* Introduce the auxiliary function TcCanonical.flattenNestedFamApp
* Kill off FamHeadMap and PredMap in favour of
the new FunEqMap and DictMap respectively
>---------------------------------------------------------------
9e10d1883d7ea5ea422cda79b426f51d2b59b14d
compiler/typecheck/Inst.lhs | 19 ---
compiler/typecheck/TcCanonical.lhs | 81 +++++-----
compiler/typecheck/TcInteract.lhs | 51 ++++---
compiler/typecheck/TcRnTypes.lhs | 11 +-
compiler/typecheck/TcRules.lhs | 2 +
compiler/typecheck/TcSMonad.lhs | 292 ++++++++++++++++++------------------
compiler/typecheck/TcSimplify.lhs | 64 +++++---
compiler/typecheck/TcUnify.lhs | 15 +-
8 files changed, 283 insertions(+), 252 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9e10d1883d7ea5ea422cda79b426f51d2b59b14d
More information about the ghc-commits
mailing list