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